Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
jio
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Yaxel Perez
jio
Commits
4c66f034
Commit
4c66f034
authored
Feb 16, 2019
by
Yaxel Perez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
forgot remove method
parent
66c28293
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
4 deletions
+37
-4
src/jio.storage/liststorage.js
src/jio.storage/liststorage.js
+11
-4
test/jio.storage/liststorage.tests.js
test/jio.storage/liststorage.tests.js
+26
-0
No files found.
src/jio.storage/liststorage.js
View file @
4c66f034
...
...
@@ -59,10 +59,17 @@
});
};
ListStorage
.
prototype
.
remove
=
function
(
id
)
{
var
updated_list
=
this
.
_signature_storage
.
get
(
"
_
"
)
.
list
.
filter
(
function
(
x
)
{
return
x
!==
id
;
});
this
.
_signature_storage
.
put
(
"
_
"
,
{
list
:
updated_list
});
ListStorage
.
prototype
.
remove
=
function
()
{
var
ctx
=
this
;
return
this
.
_sub_storage
.
remove
.
apply
(
this
.
_sub_storage
,
arguments
)
.
then
(
function
(
id
)
{
return
ctx
.
list
().
then
(
function
(
list
)
{
list
=
list
.
filter
(
function
(
x
)
{
return
id
!==
x
;
});
return
ctx
.
_signature_storage
.
put
(
'
_
'
,
list
).
then
(
function
()
{
return
id
;
});
});
});
};
jIO
.
addStorage
(
"
list
"
,
ListStorage
);
...
...
test/jio.storage/liststorage.tests.js
View file @
4c66f034
...
...
@@ -64,5 +64,31 @@
}).
fail
(
console
.
error
);
});
QUnit
.
test
(
'
remove method correctly removes id
'
,
function
(
assert
)
{
QUnit
.
stop
();
QUnit
.
expect
(
1
);
var
jio
=
jIO
.
createJIO
({
type
:
'
list
'
,
sub_storage
:
{
type
:
'
uuid
'
,
sub_storage
:
{
type
:
'
memory
'
}
}
});
jio
.
put
(
'
test
'
,
{}).
then
(
function
()
{
jio
.
put
(
'
test2
'
,
{}).
then
(
function
()
{
jio
.
remove
(
'
test
'
).
then
(
function
()
{
jio
.
list
().
then
(
function
(
l2
)
{
QUnit
.
start
();
assert
.
deepEqual
(
l2
,
[
'
test2
'
]);
});
});
});
}).
fail
(
console
.
error
);
});
// }(jIO, RSVP, QUnit));
}(
jIO
,
QUnit
));
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment