not really known
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

54 lines
1.5 KiB

define(["sugar-web/dictstore", "sugar-web/env"], function (dictstore, env) {
'use strict';
describe("dictstore on standalone mode", function () {
beforeEach(function () {
spyOn(env, 'isStandalone').andReturn(true);
});
describe("init method", function () {
it("should execute callback", function () {
var callback = jasmine.createSpy();
dictstore.init(callback);
expect(callback).toHaveBeenCalled();
});
it("should maintain localStorage", function () {
localStorage.testKey = "test";
dictstore.init(function () {});
expect(localStorage.testKey).toBe("test");
});
});
describe("save method", function () {
it("should just execute the callback", function () {
var callbackExecuted;
localStorage.test_key = "test";
runs(function () {
callbackExecuted = false;
dictstore.save(function () {
callbackExecuted = true;
});
});
waitsFor(function () {
return callbackExecuted === true;
}, "The callback should executed");
runs(function () {
expect(localStorage.test_key).toBe("test");
});
});
});
});
});