diff options
| author | Stephen Blott | 2014-10-22 07:03:18 +0100 |
|---|---|---|
| committer | Stephen Blott | 2014-10-22 07:03:18 +0100 |
| commit | e98f3f678237c1841d9626f17e560b6cb8327dc8 (patch) | |
| tree | 648a55af31c9daff4a2d2416d63f4325dfd12cc3 /tests/unit_tests | |
| parent | a2e7ed7cda8b691486dad582c900307944ec8863 (diff) | |
| parent | 50ea5ac670e736cebcb9bc1300401fe7aa3835fd (diff) | |
| download | vimium-e98f3f678237c1841d9626f17e560b6cb8327dc8.tar.bz2 | |
Merge pull request #1154 from smblott-github/passkeys-structured
Structured exclusion rules internally, and on the popup and options pages.
Diffstat (limited to 'tests/unit_tests')
| -rw-r--r-- | tests/unit_tests/exclusion_test.coffee | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/tests/unit_tests/exclusion_test.coffee b/tests/unit_tests/exclusion_test.coffee index 33dbccd3..a24c3b67 100644 --- a/tests/unit_tests/exclusion_test.coffee +++ b/tests/unit_tests/exclusion_test.coffee @@ -17,25 +17,29 @@ Utils.getCurrentVersion = -> '1.44' extend(global,require "../../background_scripts/sync.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://www.facebook.com/something' }) assert.isTrue rule.isEnabledForUrl - assert.equal rule.passKeys, 'jk' - assert.isTrue rule.matchingUrl + assert.isFalse rule.passKeys + addExclusionRule("http*://www.facebook.com/*","oO") + rule = isEnabledForUrl({ url: 'https://www.facebook.com/something' }) + assert.isTrue rule.isEnabledForUrl + assert.equal rule.passKeys, 'oO' should "be enabled", -> rule = isEnabledForUrl({ url: 'http://www.twitter.com/pages' }) @@ -45,27 +49,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' }) - assert.isTrue rule.isEnabledForUrl - addExcludedUrl("http://www.facebook.com/* jknp") - rule = isEnabledForUrl({ url: 'http://www.facebook.com/page' }) + rule = isEnabledForUrl({ url: 'http://mail.google.com/page' }) + assert.isFalse rule.isEnabledForUrl + assert.isFalse rule.passKeys + 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 |
