aboutsummaryrefslogtreecommitdiffstats
path: root/tests/unit_tests/settings_test.coffee
diff options
context:
space:
mode:
authorJez Ng2012-09-09 16:46:12 -0400
committerJez Ng2012-09-09 16:47:35 -0400
commit44ed1848548d4c73c35c3302fc47ebfc8295dcae (patch)
tree3df2f20c93ee7cea10b6a54aa5e31e4f0bd6edb5 /tests/unit_tests/settings_test.coffee
parent8c2a65dfdf9c3b4e69bca15eb7705280758245c2 (diff)
downloadvimium-44ed1848548d4c73c35c3302fc47ebfc8295dcae.tar.bz2
Add more tests, and remove old settings code.
Diffstat (limited to 'tests/unit_tests/settings_test.coffee')
-rw-r--r--tests/unit_tests/settings_test.coffee30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/unit_tests/settings_test.coffee b/tests/unit_tests/settings_test.coffee
new file mode 100644
index 00000000..f86d63dc
--- /dev/null
+++ b/tests/unit_tests/settings_test.coffee
@@ -0,0 +1,30 @@
+require "./test_helper.js"
+
+{Utils} = require "../../lib/utils.js"
+Utils.getCurrentVersion = -> '1.39'
+global.localStorage = {}
+{Settings} = require "../../background_scripts/settings.js"
+
+context "settings",
+
+ setup ->
+ stub global, 'localStorage', {}
+
+ should "obtain defaults if no key is stored", ->
+ assert.isFalse Settings.has 'scrollStepSize'
+ assert.equal Settings.get('scrollStepSize'), 60
+
+ should "store values", ->
+ Settings.set 'scrollStepSize', 20
+ assert.equal Settings.get('scrollStepSize'), 20
+
+ should "not store values equal to the default", ->
+ Settings.set 'scrollStepSize', 20
+ assert.isTrue Settings.has 'scrollStepSize'
+ Settings.set 'scrollStepSize', 60
+ assert.isFalse Settings.has 'scrollStepSize'
+
+ should "revert to defaults if no key is stored", ->
+ Settings.set 'scrollStepSize', 20
+ Settings.clear 'scrollStepSize'
+ assert.equal Settings.get('scrollStepSize'), 60