Commit 1575d745 authored by preetwinder's avatar preetwinder

use consistent string format

parent 2a1f2697
......@@ -48,7 +48,7 @@
}
IndexStorage2.prototype.hasCapacity = function (name) {
return (name === 'query') || (name === 'limit') || (name === 'list') ||
return (name === "query") || (name === "limit") || (name === "list") ||
this._sub_storage.hasCapacity(name);
};
......@@ -270,10 +270,10 @@
signature_storage_name) {
var db = evt.target.result, store, i, current_indices, required_indices;
required_indices = new Set(index_keys.map(function (name) {
return 'Index-' + name;
return "Index-" + name;
}));
if (db.objectStoreNames[0] === 'index-store') {
store = evt.target.transaction.objectStore('index-store');
if (db.objectStoreNames[0] === "index-store") {
store = evt.target.transaction.objectStore("index-store");
}
current_indices = new Set(store ? store.indexNames : []);
......@@ -287,16 +287,16 @@
}
} else {
if (store) {
db.deleteObjectStore('index-store');
db.deleteObjectStore("index-store");
current_indices.clear();
}
store = db.createObjectStore('index-store', {
keyPath: 'id',
store = db.createObjectStore("index-store", {
keyPath: "id",
autoIncrement: false
});
for (i = 0; i < index_keys.length; i += 1) {
store.createIndex('Index-' + index_keys[i],
'doc.' + index_keys[i], { unique: false });
store.createIndex("Index-" + index_keys[i],
"doc." + index_keys[i], { unique: false });
}
return repairInTransaction(sub_storage_description,
evt.target.transaction, index_keys, signature_storage_name, true);
......@@ -429,7 +429,7 @@
if (options.query && !options.include_docs && !options.sort_on &&
!options.select_list) {
query = parseStringToObject(options.query);
if (query.type === 'simple') {
if (query.type === "simple") {
if (context._index_keys.indexOf(query.key) !== -1) {
return context._runQuery(query.key, query.value, options.limit)
.then(function (result) {
......
......@@ -63,7 +63,7 @@
function DummyStorage3() {
return this;
}
jIO.addStorage('dummystorage3', DummyStorage3);
jIO.addStorage("dummystorage3", DummyStorage3);
/////////////////////////////////////////////////////////////////
// indexStorage2.constructor
......@@ -274,7 +274,7 @@
module("indexStorage2.buildQuery", {
setup: function () {
DummyStorage3.prototype.hasCapacity = function (name) {
return (name === 'list') || (name === 'include') || (name === 'select');
return (name === "list") || (name === "include") || (name === "select");
};
DummyStorage3.prototype.buildQuery = function () {
return [];
......@@ -546,7 +546,7 @@
};
DummyStorage3.prototype.hasCapacity = function (name) {
return (name === 'list') || (name === 'select');
return (name === "list") || (name === "select");
};
DummyStorage3.prototype.put = function (id, value) {
fake_data[id] = value;
......@@ -599,7 +599,7 @@
return id;
};
DummyStorage3.prototype.hasCapacity = function (capacity) {
return (capacity === 'list') || (capacity === 'query');
return (capacity === "list") || (capacity === "query");
};
DummyStorage3.prototype.buildQuery = function (options) {
equal(options.query, 'a: "5"');
......@@ -693,7 +693,7 @@
throw new jIO.util.jIOError("Cannot find document: " + id, 404);
};
DummyStorage3.prototype.hasCapacity = function (name) {
return (name === 'list') || (name === 'include') || (name === 'select');
return (name === "list") || (name === "include") || (name === "select");
};
DummyStorage3.prototype.buildQuery = function () {
return Object.values(dummy_data);
......@@ -804,7 +804,7 @@
DummyStorage3.prototype.buildQuery = undefined;
context.jio.allDocs({query: 'c: "control"'})
context.jio.allDocs({query: "c: 'control'"})
.fail(function (error) {
equal(error, "Connection to: jio:index2_test failed: Version change " +
"transaction was aborted in upgradeneeded event handler. " +
......@@ -836,7 +836,7 @@
};
DummyStorage3.prototype.hasCapacity = function (name) {
return (name === 'list') || (name === 'select');
return (name === "list") || (name === "select");
};
DummyStorage3.prototype.put = function (id, value) {
fake_data[id] = value;
......@@ -1116,7 +1116,7 @@
};
DummyStorage3.prototype.hasCapacity = function (name) {
return (name === 'list') || (name === 'include') || (name === 'select');
return (name === "list") || (name === "include") || (name === "select");
};
DummyStorage3.prototype.buildQuery = function () {
......@@ -1130,7 +1130,7 @@
])
.then(function () {
return new RSVP.Promise(function (resolve) {
request = indexedDB.open('jio:index2_test');
request = indexedDB.open("jio:index2_test");
request.onsuccess = function () {
resolve(request.result);
};
......@@ -1138,17 +1138,17 @@
})
.then(function (result) {
equal(result.version, 1);
equal(result.name, 'jio:index2_test');
equal(result.name, "jio:index2_test");
equal(result.objectStoreNames.length, 1);
equal(result.objectStoreNames[0], 'index-store');
store = result.transaction('index-store').objectStore('index-store');
equal(result.objectStoreNames[0], "index-store");
store = result.transaction("index-store").objectStore("index-store");
equal(store.indexNames.length, 2);
equal(store.keyPath, "id");
deepEqual(Array.from(store.indexNames).sort(), ['Index-a', 'Index-b']);
equal(store.index('Index-a').keyPath, 'doc.a');
equal(store.index('Index-b').keyPath, 'doc.b');
equal(store.index('Index-a').unique, false);
equal(store.index('Index-b').unique, false);
deepEqual(Array.from(store.indexNames).sort(), ["Index-a", "Index-b"]);
equal(store.index("Index-a").keyPath, "doc.a");
equal(store.index("Index-b").keyPath, "doc.b");
equal(store.index("Index-a").unique, false);
equal(store.index("Index-b").unique, false);
return new RSVP.Promise(function (resolve) {
records = store.getAll();
records.onsuccess = function () {
......@@ -1208,7 +1208,7 @@
};
DummyStorage3.prototype.hasCapacity = function (name) {
return (name === 'list') || (name === 'include') || (name === 'select');
return (name === "list") || (name === "include") || (name === "select");
};
DummyStorage3.prototype.buildQuery = function () {
......@@ -1222,7 +1222,7 @@
])
.then(function () {
return new RSVP.Promise(function (resolve) {
request = indexedDB.open('jio:index2_test');
request = indexedDB.open("jio:index2_test");
request.onsuccess = function () {
resolve(request.result);
};
......@@ -1230,17 +1230,17 @@
})
.then(function (result) {
equal(result.version, 1);
equal(result.name, 'jio:index2_test');
equal(result.name, "jio:index2_test");
equal(result.objectStoreNames.length, 1);
equal(result.objectStoreNames[0], 'index-store');
store = result.transaction('index-store').objectStore('index-store');
equal(result.objectStoreNames[0], "index-store");
store = result.transaction("index-store").objectStore("index-store");
equal(store.indexNames.length, 2);
equal(store.keyPath, "id");
deepEqual(Array.from(store.indexNames).sort(), ['Index-a', 'Index-b']);
equal(store.index('Index-a').keyPath, 'doc.a');
equal(store.index('Index-b').keyPath, 'doc.b');
equal(store.index('Index-a').unique, false);
equal(store.index('Index-b').unique, false);
deepEqual(Array.from(store.indexNames).sort(), ["Index-a", "Index-b"]);
equal(store.index("Index-a").keyPath, "doc.a");
equal(store.index("Index-b").keyPath, "doc.b");
equal(store.index("Index-a").unique, false);
equal(store.index("Index-b").unique, false);
return new RSVP.Promise(function (resolve) {
records = store.getAll();
records.onsuccess = function () {
......@@ -1302,14 +1302,14 @@
])
.then(function () {
return new RSVP.Promise(function (resolve) {
request = indexedDB.open('jio:index2_test');
request = indexedDB.open("jio:index2_test");
request.onsuccess = function () {
resolve(request.result);
};
});
})
.then(function (result) {
store = result.transaction('index-store').objectStore('index-store');
store = result.transaction("index-store").objectStore("index-store");
return new RSVP.Promise(function (resolve) {
records = store.getAll();
records.onsuccess = function () {
......@@ -1328,8 +1328,8 @@
return context.jio.remove("33");
})
.then(function () {
store = request.result.transaction('index-store')
.objectStore('index-store');
store = request.result.transaction("index-store")
.objectStore("index-store");
return new RSVP.Promise(function (resolve) {
records = store.getAll();
records.onsuccess = function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment