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
Labels
Merge Requests
18
Merge Requests
18
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
jio
Commits
2f255abb
Commit
2f255abb
authored
Aug 02, 2019
by
Romain Courteaud
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
idb: check capacity
parent
8ecb7533
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
src/jio.storage/indexeddbstorage.js
src/jio.storage/indexeddbstorage.js
+1
-4
test/jio.storage/indexeddbstorage.tests.js
test/jio.storage/indexeddbstorage.tests.js
+24
-0
No files found.
src/jio.storage/indexeddbstorage.js
View file @
2f255abb
...
@@ -64,10 +64,7 @@
...
@@ -64,10 +64,7 @@
}
}
IndexedDBStorage
.
prototype
.
hasCapacity
=
function
(
name
)
{
IndexedDBStorage
.
prototype
.
hasCapacity
=
function
(
name
)
{
if
(
name
===
"
subquery
"
)
{
return
((
name
===
"
list
"
)
||
(
name
===
"
include
"
));
return
this
.
_index_keys
;
}
return
((
name
===
"
list
"
)
||
(
name
===
"
include
"
))
||
(
name
===
"
subquery
"
);
};
};
function
buildKeyPath
(
key_list
)
{
function
buildKeyPath
(
key_list
)
{
...
...
test/jio.storage/indexeddbstorage.tests.js
View file @
2f255abb
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
deepEqual
=
QUnit
.
deepEqual
,
deepEqual
=
QUnit
.
deepEqual
,
equal
=
QUnit
.
equal
,
equal
=
QUnit
.
equal
,
module
=
QUnit
.
module
,
module
=
QUnit
.
module
,
throws
=
QUnit
.
throws
,
big_string
=
""
,
big_string
=
""
,
j
;
j
;
...
@@ -244,12 +245,35 @@
...
@@ -244,12 +245,35 @@
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
module
(
"
indexeddbStorage.hasCapacity
"
);
module
(
"
indexeddbStorage.hasCapacity
"
);
test
(
"
can list documents
"
,
function
()
{
test
(
"
can list documents
"
,
function
()
{
expect
(
2
);
var
jio
=
jIO
.
createJIO
({
var
jio
=
jIO
.
createJIO
({
type
:
"
indexeddb
"
,
type
:
"
indexeddb
"
,
database
:
"
qunit
"
database
:
"
qunit
"
});
});
ok
(
jio
.
hasCapacity
(
"
list
"
));
ok
(
jio
.
hasCapacity
(
"
list
"
));
ok
(
jio
.
hasCapacity
(
"
include
"
));
});
test
(
"
can not search documents
"
,
function
()
{
expect
(
4
);
var
jio
=
jIO
.
createJIO
({
type
:
"
indexeddb
"
,
database
:
"
qunit
"
});
throws
(
function
()
{
jio
.
hasCapacity
(
"
query
"
);
},
function
(
error
)
{
ok
(
error
instanceof
jIO
.
util
.
jIOError
);
equal
(
error
.
status_code
,
501
);
equal
(
error
.
message
,
"
Capacity 'query' is not implemented on 'indexeddb'
"
);
return
true
;
}
);
});
});
/////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////
...
...
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