diff options
| author | Stephen Blott | 2015-06-20 06:15:45 +0100 |
|---|---|---|
| committer | Stephen Blott | 2015-06-20 07:00:24 +0100 |
| commit | 1e671e28fd1f348b17ee16351c1a0b03f9d15e4f (patch) | |
| tree | f8f8b21e2c57a1aac998383f2e52cda10c080ba8 /tests/unit_tests | |
| parent | 21a5405e9b12201ed96c7de93d94410a3d448979 (diff) | |
| download | vimium-1e671e28fd1f348b17ee16351c1a0b03f9d15e4f.tar.bz2 | |
Add test that every option has a default value.
This prevents issues like #1731 and is an (better) alternative to #1732.
Diffstat (limited to 'tests/unit_tests')
| -rw-r--r-- | tests/unit_tests/completion_test.coffee | 3 | ||||
| -rw-r--r-- | tests/unit_tests/settings_test.coffee | 8 | ||||
| -rw-r--r-- | tests/unit_tests/test_chrome_stubs.coffee | 5 |
3 files changed, 13 insertions, 3 deletions
diff --git a/tests/unit_tests/completion_test.coffee b/tests/unit_tests/completion_test.coffee index 4a0cf746..9ce0a466 100644 --- a/tests/unit_tests/completion_test.coffee +++ b/tests/unit_tests/completion_test.coffee @@ -4,9 +4,6 @@ extend(global, require "../../background_scripts/completion_engines.js") extend(global, require "../../background_scripts/completion.js") extend global, require "./test_chrome_stubs.js" -global.document = - createElement: -> {} - context "bookmark completer", setup -> @bookmark3 = { title: "bookmark3", url: "bookmark3.com" } diff --git a/tests/unit_tests/settings_test.coffee b/tests/unit_tests/settings_test.coffee index 08145190..47abe97f 100644 --- a/tests/unit_tests/settings_test.coffee +++ b/tests/unit_tests/settings_test.coffee @@ -7,6 +7,7 @@ Utils.isBackgroundPage = -> true Utils.isExtensionPage = -> true global.localStorage = {} extend(global,require "../../lib/settings.js") +extend(global,require "../../pages/options.js") context "settings", @@ -80,3 +81,10 @@ context "synced settings", should "sync a key which is not a known setting (without crashing)", -> chrome.storage.sync.set { notASetting: JSON.stringify("notAUsefullValue") } + +context "default valuess", + + should "have a default value for every option", -> + for own key of Options + assert.isTrue key of Settings.defaults + diff --git a/tests/unit_tests/test_chrome_stubs.coffee b/tests/unit_tests/test_chrome_stubs.coffee index fe2fc298..8a677990 100644 --- a/tests/unit_tests/test_chrome_stubs.coffee +++ b/tests/unit_tests/test_chrome_stubs.coffee @@ -8,6 +8,10 @@ exports.window = {} exports.localStorage = {} +global.document = + createElement: -> {} + addEventListener: -> + exports.chrome = runtime: getManifest: () -> @@ -21,6 +25,7 @@ exports.chrome = extension: getURL: (path) -> path + getBackgroundPage: -> {} tabs: onSelectionChanged: |
