|
|
@ -35,7 +35,7 @@ describe("options form page", () => { |
|
|
|
assert.strictEqual(settings.source, 'form') |
|
|
|
assert.strictEqual(settings.source, 'form') |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('add blacklist', async () => { |
|
|
|
it('add blacklist item', async () => { |
|
|
|
let page = await OptionPage.open(lanthan); |
|
|
|
let page = await OptionPage.open(lanthan); |
|
|
|
let forms = await page.switchToForm(); |
|
|
|
let forms = await page.switchToForm(); |
|
|
|
// Scroll is required to click a button on Firefox 60
|
|
|
|
// Scroll is required to click a button on Firefox 60
|
|
|
@ -64,6 +64,53 @@ describe("options form page", () => { |
|
|
|
assert.deepStrictEqual(settings.form.blacklist, ['yahoo.com']) |
|
|
|
assert.deepStrictEqual(settings.form.blacklist, ['yahoo.com']) |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('add a partial blacklist item', async () => { |
|
|
|
|
|
|
|
let page = await OptionPage.open(lanthan); |
|
|
|
|
|
|
|
let forms = await page.switchToForm(); |
|
|
|
|
|
|
|
// Scroll is required to click a button on Firefox 60
|
|
|
|
|
|
|
|
await page.scrollTo(0, 1000); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// assert default
|
|
|
|
|
|
|
|
let settings = (await browser.storage.local.get('settings')).settings; |
|
|
|
|
|
|
|
assert.deepStrictEqual(settings.form.blacklist, []); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// add blacklist items
|
|
|
|
|
|
|
|
await forms.addPartialBlacklist(); |
|
|
|
|
|
|
|
await forms.setPartialBlacklist(0, 'google.com', 'j,k,<C-U>'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings = (await browser.storage.local.get('settings')).settings; |
|
|
|
|
|
|
|
assert.deepStrictEqual(settings.form.blacklist, [ |
|
|
|
|
|
|
|
{ url: 'google.com', keys: ['j', 'k', '<C-U>'] }, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await forms.addPartialBlacklist(); |
|
|
|
|
|
|
|
await forms.setPartialBlacklist(1, 'yahoo.com', 'g,G'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings = (await browser.storage.local.get('settings')).settings; |
|
|
|
|
|
|
|
assert.deepStrictEqual(settings.form.blacklist, [ |
|
|
|
|
|
|
|
{ url: 'google.com', keys: ['j', 'k', '<C-U>'] }, |
|
|
|
|
|
|
|
{ url: 'yahoo.com', keys: ['g', 'G'] }, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await forms.addBlacklist(); |
|
|
|
|
|
|
|
await forms.setBlacklist(0, 'bing.com'); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
settings = (await browser.storage.local.get('settings')).settings; |
|
|
|
|
|
|
|
assert.deepStrictEqual(settings.form.blacklist, [ |
|
|
|
|
|
|
|
{ url: 'google.com', keys: ['j', 'k', '<C-U>'] }, |
|
|
|
|
|
|
|
{ url: 'yahoo.com', keys: ['g', 'G'] }, |
|
|
|
|
|
|
|
'bing.com', |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// delete first item
|
|
|
|
|
|
|
|
await forms.removePartialBlackList(0); |
|
|
|
|
|
|
|
settings = (await browser.storage.local.get('settings')).settings; |
|
|
|
|
|
|
|
assert.deepStrictEqual(settings.form.blacklist, [ |
|
|
|
|
|
|
|
{ url: 'yahoo.com', keys: ['g', 'G'] }, |
|
|
|
|
|
|
|
'bing.com', |
|
|
|
|
|
|
|
]) |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
it('add search engines', async () => { |
|
|
|
it('add search engines', async () => { |
|
|
|
let page = await OptionPage.open(lanthan); |
|
|
|
let page = await OptionPage.open(lanthan); |
|
|
|
let forms = await page.switchToForm(); |
|
|
|
let forms = await page.switchToForm(); |
|
|
|