aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorStephen Blott2015-06-01 10:53:42 +0100
committerStephen Blott2015-06-01 11:12:03 +0100
commit5f0400ebac5867df74225b987ea1238bdaeb40b2 (patch)
treecff0937f2b82f3aeb3ef6fbf735ea02d6730c1d7 /tests
parent83fefcae893f9ba57f291681f7b0328e6ee41db0 (diff)
downloadvimium-5f0400ebac5867df74225b987ea1238bdaeb40b2.tar.bz2
Refactor and eliminate Sync object.
Diffstat (limited to 'tests')
-rw-r--r--tests/unit_tests/settings_test.coffee11
-rw-r--r--tests/unit_tests/test_chrome_stubs.coffee4
2 files changed, 11 insertions, 4 deletions
diff --git a/tests/unit_tests/settings_test.coffee b/tests/unit_tests/settings_test.coffee
index a2aca6fd..08145190 100644
--- a/tests/unit_tests/settings_test.coffee
+++ b/tests/unit_tests/settings_test.coffee
@@ -38,16 +38,23 @@ context "settings",
Settings.clear 'scrollStepSize'
assert.equal Settings.get('scrollStepSize'), 60
+context "synced settings",
+
+ setup ->
+ stub global, 'localStorage', {}
+ Settings.cache = global.localStorage # Point the settings cache to the new localStorage object.
+ Settings.postUpdateHooks = {} # Avoid running update hooks which include calls to outside of settings.
+
should "propagate non-default value via synced storage listener", ->
Settings.set 'scrollStepSize', 20
assert.equal Settings.get('scrollStepSize'), 20
- Settings.Sync.handleStorageUpdate { scrollStepSize: { newValue: "40" } }
+ Settings.propagateChangesFromChromeStorage { scrollStepSize: { newValue: "40" } }
assert.equal Settings.get('scrollStepSize'), 40
should "propagate default value via synced storage listener", ->
Settings.set 'scrollStepSize', 20
assert.equal Settings.get('scrollStepSize'), 20
- Settings.Sync.handleStorageUpdate { scrollStepSize: { newValue: "60" } }
+ Settings.propagateChangesFromChromeStorage { scrollStepSize: { newValue: "60" } }
assert.isFalse Settings.has 'scrollStepSize'
should "propagate non-default values from synced storage", ->
diff --git a/tests/unit_tests/test_chrome_stubs.coffee b/tests/unit_tests/test_chrome_stubs.coffee
index 16f0e144..fe2fc298 100644
--- a/tests/unit_tests/test_chrome_stubs.coffee
+++ b/tests/unit_tests/test_chrome_stubs.coffee
@@ -70,14 +70,14 @@ exports.chrome =
chrome.runtime.lastError = undefined
key_value = {}
key_value[key] = { newValue: value }
- @func(key_value,'synced storage stub') if @func
+ @func(key_value,'sync') if @func
callEmpty: (key) ->
chrome.runtime.lastError = undefined
if @func
items = {}
items[key] = {}
- @func(items,'synced storage stub')
+ @func(items,'sync')
session:
MAX_SESSION_RESULTS: 25