diff options
| author | Stephen Blott | 2014-09-01 12:07:24 +0100 |
|---|---|---|
| committer | Stephen Blott | 2014-09-02 08:43:36 +0100 |
| commit | 41bdac83d2fd450569013dd5cfdb78239143ba24 (patch) | |
| tree | 58c06e564cb5641102fbc6583071e84e094818f7 /tests | |
| parent | 1685640ccabe265c9f182a0175d8ce823db35b4b (diff) | |
| download | vimium-41bdac83d2fd450569013dd5cfdb78239143ba24.tar.bz2 | |
Structured passkeys, internally and on the options and popup pages.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/unit_tests/exclusion_test.coffee | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/tests/unit_tests/exclusion_test.coffee b/tests/unit_tests/exclusion_test.coffee index 33dbccd3..7fb63df9 100644 --- a/tests/unit_tests/exclusion_test.coffee +++ b/tests/unit_tests/exclusion_test.coffee @@ -15,27 +15,28 @@ root.Marks = extend(global, require "../../lib/utils.js") Utils.getCurrentVersion = -> '1.44' extend(global,require "../../background_scripts/sync.js") +extend(global, require "../../lib/exclusion_rule.js") extend(global,require "../../background_scripts/settings.js") Sync.init() +extend(global, require "../../background_scripts/exclusions.js") extend(global, require "../../background_scripts/commands.js") extend(global, require "../../background_scripts/main.js") # These tests cover only the most basic aspects of excluded URLs and passKeys. # context "Excluded URLs and pass keys", - setup -> - Settings.set 'excludedUrls', 'http://mail.google.com/*\nhttp://www.facebook.com/* jk' + + # These tests have no setup, they use the default values from settings.coffee. should "be disabled for excluded sites", -> - rule = isEnabledForUrl({ url: 'http://mail.google.com/u/0/inbox' }) + rule = isEnabledForUrl({ url: 'http://www.google.com/calendar/page' }) assert.isFalse rule.isEnableForUrl - assert.isTrue rule.matchingUrl + assert.isFalse rule.passKeys should "be enabled, but with pass keys", -> - rule = isEnabledForUrl({ url: 'http://www.facebook.com/pages' }) + rule = isEnabledForUrl({ url: 'https://mail.google.com/mail/u/0/#inbox' }) assert.isTrue rule.isEnabledForUrl assert.equal rule.passKeys, 'jk' - assert.isTrue rule.matchingUrl should "be enabled", -> rule = isEnabledForUrl({ url: 'http://www.twitter.com/pages' }) @@ -45,27 +46,25 @@ context "Excluded URLs and pass keys", should "add a new excluded URL", -> rule = isEnabledForUrl({ url: 'http://www.example.com/page' }) assert.isTrue rule.isEnabledForUrl - addExcludedUrl("http://www.example.com*") + addExclusionRule("http://www.example.com*") rule = isEnabledForUrl({ url: 'http://www.example.com/page' }) assert.isFalse rule.isEnabledForUrl assert.isFalse rule.passKeys - assert.isTrue rule.matchingUrl should "add a new excluded URL with passkeys", -> - rule = isEnabledForUrl({ url: 'http://www.example.com/page' }) + rule = isEnabledForUrl({ url: 'http://www.anotherexample.com/page' }) assert.isTrue rule.isEnabledForUrl - addExcludedUrl("http://www.example.com/* jk") - rule = isEnabledForUrl({ url: 'http://www.example.com/page' }) + addExclusionRule("http://www.anotherexample.com/*","jk") + rule = isEnabledForUrl({ url: 'http://www.anotherexample.com/page' }) assert.isTrue rule.isEnabledForUrl assert.equal rule.passKeys, 'jk' - assert.isTrue rule.matchingUrl should "update an existing excluded URL with passkeys", -> - rule = isEnabledForUrl({ url: 'http://www.facebook.com/page' }) + rule = isEnabledForUrl({ url: 'http://mail.google.com/page' }) assert.isTrue rule.isEnabledForUrl - addExcludedUrl("http://www.facebook.com/* jknp") - rule = isEnabledForUrl({ url: 'http://www.facebook.com/page' }) + assert.equal rule.passKeys, 'jk' + addExclusionRule("http*://mail.google.com/*","jknp") + rule = isEnabledForUrl({ url: 'http://mail.google.com/page' }) assert.isTrue rule.isEnabledForUrl assert.equal rule.passKeys, 'jknp' - assert.isTrue rule.matchingUrl |
