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

  1. define(["sugar-web/dictstore", "sugar-web/env"], function (dictstore, env) {
  2. 'use strict';
  3. describe("dictstore on standalone mode", function () {
  4. beforeEach(function () {
  5. spyOn(env, 'isStandalone').andReturn(true);
  6. });
  7. describe("init method", function () {
  8. it("should execute callback", function () {
  9. var callback = jasmine.createSpy();
  10. dictstore.init(callback);
  11. expect(callback).toHaveBeenCalled();
  12. });
  13. it("should maintain localStorage", function () {
  14. localStorage.testKey = "test";
  15. dictstore.init(function () {});
  16. expect(localStorage.testKey).toBe("test");
  17. });
  18. });
  19. describe("save method", function () {
  20. it("should just execute the callback", function () {
  21. var callbackExecuted;
  22. localStorage.test_key = "test";
  23. runs(function () {
  24. callbackExecuted = false;
  25. dictstore.save(function () {
  26. callbackExecuted = true;
  27. });
  28. });
  29. waitsFor(function () {
  30. return callbackExecuted === true;
  31. }, "The callback should executed");
  32. runs(function () {
  33. expect(localStorage.test_key).toBe("test");
  34. });
  35. });
  36. });
  37. });
  38. });