From 18010b4e9c4352d58c48e25a4336af96b7b0603c Mon Sep 17 00:00:00 2001 From: "asamuzaK (Kazz)" Date: Sun, 29 Dec 2024 16:22:39 +0900 Subject: [PATCH] Use node:assert --- test/background-main.test.js | 227 ++++--- test/bookmark.test.js | 62 +- test/browser-tabs.test.js | 92 ++- test/color.test.js | 20 +- test/commander.test.js | 58 +- test/common-mjs.test.js | 72 +- test/common.test.js | 14 +- test/constant.test.js | 6 +- test/file-util.test.js | 21 +- test/localize.test.js | 8 +- test/main.test.js | 1189 ++++++++++++++++++---------------- test/menu-items.test.js | 20 +- test/menu.test.js | 38 +- test/options-main.test.js | 118 ++-- test/port.test.js | 74 +-- test/session.test.js | 115 ++-- test/tab-content.test.js | 150 +++-- test/tab-dnd.test.js | 863 ++++++++++++------------ test/tab-group.test.js | 463 +++++++------ test/theme.test.js | 428 +++++++----- test/util.test.js | 277 ++++---- 21 files changed, 2264 insertions(+), 2051 deletions(-) diff --git a/test/background-main.test.js b/test/background-main.test.js index 1a56f7f5..c8875ed2 100644 --- a/test/background-main.test.js +++ b/test/background-main.test.js @@ -4,9 +4,9 @@ /* eslint-disable import-x/order */ /* api */ -import sinon from 'sinon'; -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; +import sinon from 'sinon'; import { sleep } from '../src/mjs/common.js'; import { browser, createJsdom, mockPort } from './mocha/setup.js'; @@ -50,12 +50,8 @@ describe('background-main', () => { mjs.sidebar.clear(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('sidebar', () => { - assert.instanceOf(mjs.sidebar, Map, 'instance'); + assert.strictEqual(mjs.sidebar instanceof Map, true, 'instance'); }); describe('set sidebar state', () => { @@ -77,10 +73,10 @@ describe('background-main', () => { const stubIsOpen = browser.sidebarAction.isOpen.withArgs({ windowId: 3 }).resolves(true); await func(); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isFalse(stubWin.called, 'not called'); - assert.isTrue(stubIsOpen.calledOnce, 'called'); - assert.isTrue(mjs.sidebar.has(3), 'entry'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(stubWin.called, false, 'not called'); + assert.strictEqual(stubIsOpen.calledOnce, true, 'called'); + assert.strictEqual(mjs.sidebar.has(3), true, 'entry'); assert.deepEqual(mjs.sidebar.get(3), { incognito: false, isOpen: true, @@ -89,7 +85,7 @@ describe('background-main', () => { sessionValue: null, windowId: 3 }, 'value'); - assert.isFalse(mjs.sidebar.has(4), 'entry'); + assert.strictEqual(mjs.sidebar.has(4), false, 'entry'); }); it('should set values', async () => { @@ -108,10 +104,10 @@ describe('background-main', () => { const stubIsOpen = browser.sidebarAction.isOpen.withArgs({ windowId: 3 }).resolves(true); await func(browser.windows.WINDOW_ID_CURRENT); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isFalse(stubWin.called, 'not called'); - assert.isTrue(stubIsOpen.calledOnce, 'called'); - assert.isTrue(mjs.sidebar.has(3), 'entry'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(stubWin.called, false, 'not called'); + assert.strictEqual(stubIsOpen.calledOnce, true, 'called'); + assert.strictEqual(mjs.sidebar.has(3), true, 'entry'); assert.deepEqual(mjs.sidebar.get(3), { incognito: false, isOpen: true, @@ -120,7 +116,7 @@ describe('background-main', () => { sessionValue: null, windowId: 3 }, 'value'); - assert.isFalse(mjs.sidebar.has(4), 'entry'); + assert.strictEqual(mjs.sidebar.has(4), false, 'entry'); }); it('should set values', async () => { @@ -139,11 +135,11 @@ describe('background-main', () => { const stubIsOpen = browser.sidebarAction.isOpen.withArgs({ windowId: 4 }).resolves(true); await func(4); - assert.isFalse(stubCurrentWin.called, 'not called'); - assert.isTrue(stubWin.calledOnce, 'called'); - assert.isTrue(stubIsOpen.calledOnce, 'called'); - assert.isFalse(mjs.sidebar.has(3), 'entry'); - assert.isTrue(mjs.sidebar.has(4), 'entry'); + assert.strictEqual(stubCurrentWin.called, false, 'not called'); + assert.strictEqual(stubWin.calledOnce, true, 'called'); + assert.strictEqual(stubIsOpen.calledOnce, true, 'called'); + assert.strictEqual(mjs.sidebar.has(3), false, 'entry'); + assert.strictEqual(mjs.sidebar.has(4), true, 'entry'); assert.deepEqual(mjs.sidebar.get(4), { incognito: false, isOpen: true, @@ -186,10 +182,10 @@ describe('background-main', () => { windowId: 4 }); await func(4); - assert.isFalse(stubCurrentWin.called, 'not called'); - assert.isTrue(stubWin.calledOnce, 'called'); - assert.isTrue(stubIsOpen.calledOnce, 'called'); - assert.isTrue(mjs.sidebar.has(3), 'entry'); + assert.strictEqual(stubCurrentWin.called, false, 'not called'); + assert.strictEqual(stubWin.calledOnce, true, 'called'); + assert.strictEqual(stubIsOpen.calledOnce, true, 'called'); + assert.strictEqual(mjs.sidebar.has(3), true, 'entry'); assert.deepEqual(mjs.sidebar.get(3), { incognito: false, isOpen: true, @@ -198,7 +194,7 @@ describe('background-main', () => { sessionValue: null, windowId: 3 }, 'value'); - assert.isTrue(mjs.sidebar.has(4), 'entry'); + assert.strictEqual(mjs.sidebar.has(4), true, 'entry'); assert.deepEqual(mjs.sidebar.get(4), { incognito: false, isOpen: false, @@ -224,11 +220,11 @@ describe('background-main', () => { }); const stubIsOpen = browser.sidebarAction.isOpen.resolves(true); await func(browser.windows.WINDOW_ID_NONE); - assert.isFalse(stubCurrentWin.called, 'not called'); - assert.isFalse(stubWin.called, 'not called'); - assert.isFalse(stubIsOpen.called, 'not called'); - assert.isFalse(mjs.sidebar.has(3), 'entry'); - assert.isFalse(mjs.sidebar.has(4), 'entry'); + assert.strictEqual(stubCurrentWin.called, false, 'not called'); + assert.strictEqual(stubWin.called, false, 'not called'); + assert.strictEqual(stubIsOpen.called, false, 'not called'); + assert.strictEqual(mjs.sidebar.has(3), false, 'entry'); + assert.strictEqual(mjs.sidebar.has(4), false, 'entry'); }); it('should not set values', async () => { @@ -239,9 +235,9 @@ describe('background-main', () => { }); const stubIsOpen = browser.sidebarAction.isOpen.resolves(true); await func(); - assert.isTrue(stubCurrentWin.called, 'called'); - assert.isFalse(stubIsOpen.called, 'not called'); - assert.isFalse(mjs.sidebar.has(3), 'entry'); + assert.strictEqual(stubCurrentWin.called, true, 'called'); + assert.strictEqual(stubIsOpen.called, false, 'not called'); + assert.strictEqual(mjs.sidebar.has(3), false, 'entry'); }); }); @@ -251,13 +247,13 @@ describe('background-main', () => { it('should remove entry', async () => { mjs.sidebar.set(1, {}); const res = await func(1); - assert.isFalse(mjs.sidebar.has(1), 'entry'); - assert.isTrue(res, 'result'); + assert.strictEqual(mjs.sidebar.has(1), false, 'entry'); + assert.strictEqual(res, true, 'result'); }); it('should get false if entry does not exist', async () => { const res = await func(2); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); }); @@ -269,7 +265,7 @@ describe('background-main', () => { const res = await func(); assert.strictEqual(browser.sidebarAction.toggle.callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -278,7 +274,7 @@ describe('background-main', () => { it('should throw', async () => { await func().catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected String but got Undefined.', 'message'); }); @@ -286,7 +282,7 @@ describe('background-main', () => { it('should throw', async () => { await func('foo').catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected Number but got Undefined.', 'message'); }); @@ -294,7 +290,7 @@ describe('background-main', () => { it('should get false', async () => { const res = await func('foo', 1); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should get false', async () => { @@ -307,7 +303,7 @@ describe('background-main', () => { }); mjs.ports.set(portId, port); const res = await func('foo', 1); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should get false', async () => { @@ -320,7 +316,7 @@ describe('background-main', () => { }); mjs.ports.set(portId, port); const res = await func('foo', 1); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should call function', async () => { @@ -418,10 +414,10 @@ describe('background-main', () => { frag.appendChild(parent2); const domstr = new XMLSerializer().serializeToString(frag); const res = await func(domstr, 1); - assert.isTrue(stubWin.calledOnce, 'called'); - assert.isTrue(stubGetValue.calledOnce, 'called'); - assert.isTrue(stubSetValue.calledOnce, 'called'); - assert.isTrue(res, 'result'); + assert.strictEqual(stubWin.calledOnce, true, 'called'); + assert.strictEqual(stubGetValue.calledOnce, true, 'called'); + assert.strictEqual(stubSetValue.calledOnce, true, 'called'); + assert.strictEqual(res, true, 'result'); }); it('should call function', async () => { @@ -497,10 +493,10 @@ describe('background-main', () => { await sleep(100); arr.push(func(domstr2, 1)); const res = await Promise.all(arr); - assert.isTrue(stubWin.calledThrice, 'called'); - assert.isTrue(stubGetValue.calledTwice, 'called'); - assert.isTrue(stubSetValue.calledTwice, 'called'); - assert.isTrue(mjs.sidebar.has(1), 'map'); + assert.strictEqual(stubWin.calledThrice, true, 'called'); + assert.strictEqual(stubGetValue.calledTwice, true, 'called'); + assert.strictEqual(stubSetValue.calledTwice, true, 'called'); + assert.strictEqual(mjs.sidebar.has(1), true, 'map'); assert.deepEqual(res, [true, false], 'result'); }); @@ -580,10 +576,10 @@ describe('background-main', () => { mjs.sidebar.set(1, currentValue); arr.push(func(domstr2, 1)); const res = await Promise.all(arr); - assert.isTrue(stubWin.calledThrice, 'called'); - assert.isTrue(stubGetValue.calledTwice, 'called'); - assert.isTrue(stubSetValue.calledTwice, 'called'); - assert.isFalse(mjs.sidebar.has(1), 'map'); + assert.strictEqual(stubWin.calledThrice, true, 'called'); + assert.strictEqual(stubGetValue.calledTwice, true, 'called'); + assert.strictEqual(stubSetValue.calledTwice, true, 'called'); + assert.strictEqual(mjs.sidebar.has(1), false, 'map'); assert.deepEqual(res, [true, false], 'result'); }); }); @@ -657,9 +653,9 @@ describe('background-main', () => { [SESSION_SAVE]: {} }; const res = await func(msg); - assert.isFalse(stubWin.called, 'not called'); - assert.isFalse(stubGetValue.called, 'not called'); - assert.isFalse(stubSetValue.called, 'not called'); + assert.strictEqual(stubWin.called, false, 'not called'); + assert.strictEqual(stubGetValue.called, false, 'not called'); + assert.strictEqual(stubSetValue.called, false, 'not called'); assert.deepEqual(res, [], 'result'); }); @@ -763,9 +759,9 @@ describe('background-main', () => { } }; const res = await func(msg); - assert.isFalse(stubWin.called, 'not called'); - assert.isFalse(stubGetValue.called, 'not called'); - assert.isFalse(stubSetValue.called, 'not called'); + assert.strictEqual(stubWin.called, false, 'not called'); + assert.strictEqual(stubGetValue.called, false, 'not called'); + assert.strictEqual(stubSetValue.called, false, 'not called'); assert.deepEqual(res, [], 'result'); }); @@ -870,9 +866,9 @@ describe('background-main', () => { } }; const res = await func(msg); - assert.isTrue(stubWin.calledOnce, 'called'); - assert.isTrue(stubGetValue.calledOnce, 'called'); - assert.isTrue(stubSetValue.calledOnce, 'called'); + assert.strictEqual(stubWin.calledOnce, true, 'called'); + assert.strictEqual(stubGetValue.calledOnce, true, 'called'); + assert.strictEqual(stubSetValue.calledOnce, true, 'called'); assert.deepEqual(res, [true], 'result'); }); @@ -891,9 +887,9 @@ describe('background-main', () => { } }; const res = await func(msg); - assert.isTrue(stubWin.calledOnce, 'called'); - assert.isTrue(stubIsOpen.calledOnce, 'called'); - assert.isTrue(mjs.sidebar.has(1), 'entry'); + assert.strictEqual(stubWin.calledOnce, true, 'called'); + assert.strictEqual(stubIsOpen.calledOnce, true, 'called'); + assert.strictEqual(mjs.sidebar.has(1), true, 'entry'); assert.deepEqual(mjs.sidebar.get(1), { incognito: false, isOpen: true, @@ -1022,9 +1018,9 @@ describe('background-main', () => { } }; const res = await func(msg); - assert.isTrue(stubWin.calledOnce, 'called'); - assert.isTrue(stubGetValue.calledOnce, 'called'); - assert.isTrue(stubSetValue.calledOnce, 'called'); + assert.strictEqual(stubWin.calledOnce, true, 'called'); + assert.strictEqual(stubGetValue.calledOnce, true, 'called'); + assert.strictEqual(stubSetValue.calledOnce, true, 'called'); assert.deepEqual(res, [true], 'result'); }); @@ -1043,9 +1039,9 @@ describe('background-main', () => { } }; const res = await func(msg); - assert.isTrue(stubWin.calledOnce, 'called'); - assert.isTrue(stubIsOpen.calledOnce, 'called'); - assert.isTrue(mjs.sidebar.has(1), 'entry'); + assert.strictEqual(stubWin.calledOnce, true, 'called'); + assert.strictEqual(stubIsOpen.calledOnce, true, 'called'); + assert.strictEqual(mjs.sidebar.has(1), true, 'entry'); assert.deepEqual(mjs.sidebar.get(1), { incognito: false, isOpen: true, @@ -1072,11 +1068,11 @@ describe('background-main', () => { await func(); const { called: errCalled } = stubErr; stubErr.restore(); - assert.isFalse(errCalled, 'not called error'); + assert.strictEqual(errCalled, false, 'not called error'); assert.strictEqual(mjs.ports.size, 1, 'port size'); - assert.isTrue(mjs.ports.has(portId), 'port'); + assert.strictEqual(mjs.ports.has(portId), true, 'port'); assert.strictEqual(mjs.sidebar.size, 1, 'sidebar size'); - assert.isTrue(mjs.sidebar.has(1), 'sidebar'); + assert.strictEqual(mjs.sidebar.has(1), true, 'sidebar'); }); it('should log error, should not remove ports, sidebar', async () => { @@ -1092,11 +1088,11 @@ describe('background-main', () => { }); const { calledOnce: errCalled } = stubErr; stubErr.restore(); - assert.isTrue(errCalled, 'called error'); + assert.strictEqual(errCalled, true, 'called error'); assert.strictEqual(mjs.ports.size, 1, 'port size'); - assert.isTrue(mjs.ports.has(portId), 'port'); + assert.strictEqual(mjs.ports.has(portId), true, 'port'); assert.strictEqual(mjs.sidebar.size, 1, 'sidebar size'); - assert.isTrue(mjs.sidebar.has(1), 'sidebar'); + assert.strictEqual(mjs.sidebar.has(1), true, 'sidebar'); }); it('should not remove ports, sidebar', async () => { @@ -1112,11 +1108,11 @@ describe('background-main', () => { }); const { called: errCalled } = stubErr; stubErr.restore(); - assert.isFalse(errCalled, 'not called error'); + assert.strictEqual(errCalled, false, 'not called error'); assert.strictEqual(mjs.ports.size, 1, 'port size'); - assert.isTrue(mjs.ports.has(portId), 'port'); + assert.strictEqual(mjs.ports.has(portId), true, 'port'); assert.strictEqual(mjs.sidebar.size, 1, 'sidebar size'); - assert.isTrue(mjs.sidebar.has(1), 'sidebar'); + assert.strictEqual(mjs.sidebar.has(1), true, 'sidebar'); }); it('should remove ports', async () => { @@ -1132,10 +1128,10 @@ describe('background-main', () => { }); const { called: errCalled } = stubErr; stubErr.restore(); - assert.isFalse(errCalled, 'not called error'); + assert.strictEqual(errCalled, false, 'not called error'); assert.strictEqual(mjs.ports.size, 0, 'port size'); assert.strictEqual(mjs.sidebar.size, 1, 'sidebar size'); - assert.isTrue(mjs.sidebar.has(2), 'sidebar'); + assert.strictEqual(mjs.sidebar.has(2), true, 'sidebar'); }); it('should remove ports, sidebar', async () => { @@ -1153,7 +1149,7 @@ describe('background-main', () => { }); const { called: errCalled } = stubErr; stubErr.restore(); - assert.isFalse(errCalled, 'not called error'); + assert.strictEqual(errCalled, false, 'not called error'); assert.strictEqual(mjs.ports.size, 0, 'port size'); assert.strictEqual(mjs.sidebar.size, 0, 'sidebar size'); }); @@ -1174,7 +1170,7 @@ describe('background-main', () => { }); const { called: errCalled } = stubErr; stubErr.restore(); - assert.isFalse(errCalled, 'not called error'); + assert.strictEqual(errCalled, false, 'not called error'); assert.strictEqual(mjs.ports.size, 0, 'port size'); assert.strictEqual(mjs.sidebar.size, 0, 'sidebar size'); }); @@ -1280,10 +1276,10 @@ describe('background-main', () => { }); const { called: errCalled } = stubErr; stubErr.restore(); - assert.isFalse(errCalled, 'not called error'); - assert.isTrue(stubWin.calledOnce, 'called'); - assert.isTrue(stubGetValue.calledOnce, 'called'); - assert.isTrue(stubSetValue.calledOnce, 'called'); + assert.strictEqual(errCalled, false, 'not called error'); + assert.strictEqual(stubWin.calledOnce, true, 'called'); + assert.strictEqual(stubGetValue.calledOnce, true, 'called'); + assert.strictEqual(stubSetValue.calledOnce, true, 'called'); assert.strictEqual(mjs.ports.size, 0, 'ports size'); assert.strictEqual(mjs.sidebar.size, 0, 'sidebar size'); }); @@ -1295,11 +1291,11 @@ describe('background-main', () => { it('should throw', async () => { const stubErr = sinon.stub(console, 'error'); await func(null).catch(e => { - assert.instanceOf(e, Error, 'error'); + assert.strictEqual(e instanceof Error, true, 'error'); }); const { calledOnce } = stubErr; stubErr.restore(); - assert.isTrue(calledOnce, 'called'); + assert.strictEqual(calledOnce, true, 'called'); }); it('should call function', async () => { @@ -1403,13 +1399,13 @@ describe('background-main', () => { }); const { called: errCalled } = stubErr; stubErr.restore(); - assert.isFalse(errCalled, 'not called error'); - assert.isTrue(stubWin.calledOnce, 'called'); - assert.isTrue(stubGetValue.calledOnce, 'called'); - assert.isTrue(stubSetValue.calledOnce, 'called'); + assert.strictEqual(errCalled, false, 'not called error'); + assert.strictEqual(stubWin.calledOnce, true, 'called'); + assert.strictEqual(stubGetValue.calledOnce, true, 'called'); + assert.strictEqual(stubSetValue.calledOnce, true, 'called'); assert.strictEqual(mjs.ports.size, 0, 'ports size'); assert.strictEqual(mjs.sidebar.size, 0, 'sidebar size'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -1446,13 +1442,13 @@ describe('background-main', () => { const remove = browser.menus.removeAll.resolves(undefined); const create = browser.menus.create; await func(port); - assert.isFalse(stubWin.called, 'called win'); + assert.strictEqual(stubWin.called, false, 'called win'); assert.strictEqual(mjs.ports.size, 0, 'ports size'); - assert.isFalse(mjs.ports.has(portId), 'ports'); + assert.strictEqual(mjs.ports.has(portId), false, 'ports'); assert.strictEqual(mjs.sidebar.size, 0, 'sidebar size'); - assert.isFalse(mjs.sidebar.has(1), 'sidebar'); - assert.isFalse(remove.called, 'remove'); - assert.isFalse(create.called, 'create'); + assert.strictEqual(mjs.sidebar.has(1), false, 'sidebar'); + assert.strictEqual(remove.called, false, 'remove'); + assert.strictEqual(create.called, false, 'create'); }); it('should add port', async () => { @@ -1469,13 +1465,13 @@ describe('background-main', () => { const remove = browser.menus.removeAll.resolves(undefined); const create = browser.menus.create; await func(port); - assert.isTrue(stubWin.calledOnce, 'called win'); + assert.strictEqual(stubWin.calledOnce, true, 'called win'); assert.strictEqual(mjs.ports.size, 1, 'ports size'); - assert.isTrue(mjs.ports.has(portId), 'ports'); + assert.strictEqual(mjs.ports.has(portId), true, 'ports'); assert.strictEqual(mjs.sidebar.size, 1, 'sidebar size'); - assert.isTrue(mjs.sidebar.has(1), 'sidebar'); - assert.isTrue(remove.calledOnce, 'remove'); - assert.isTrue(create.called, 'create'); + assert.strictEqual(mjs.sidebar.has(1), true, 'sidebar'); + assert.strictEqual(remove.calledOnce, true, 'remove'); + assert.strictEqual(create.called, true, 'create'); }); }); @@ -1484,7 +1480,7 @@ describe('background-main', () => { it('should throw', async () => { await func().catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected String but got Undefined.', 'message'); }); @@ -1492,7 +1488,7 @@ describe('background-main', () => { it('should get null', async () => { const res = await func('foo'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1511,17 +1507,18 @@ describe('background-main', () => { windowId: 1 }); const res = await func(TOGGLE_STATE); - assert.isTrue(browser.sidebarAction.toggle.calledOnce, 'called'); - assert.isTrue(stubWin.calledOnce, 'called'); - assert.isTrue(stubIsOpen.calledOnce, 'called'); - assert.isTrue(mjs.sidebar.has(1), 'entry'); + assert.strictEqual(browser.sidebarAction.toggle.calledOnce, true, + 'called'); + assert.strictEqual(stubWin.calledOnce, true, 'called'); + assert.strictEqual(stubIsOpen.calledOnce, true, 'called'); + assert.strictEqual(mjs.sidebar.has(1), true, 'entry'); assert.deepEqual(mjs.sidebar.get(1), { incognito: false, isOpen: true, sessionId: undefined, windowId: 1 }, 'value'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); }); diff --git a/test/bookmark.test.js b/test/bookmark.test.js index 07779396..66bab574 100644 --- a/test/bookmark.test.js +++ b/test/bookmark.test.js @@ -4,9 +4,9 @@ /* eslint-disable import-x/order */ /* api */ -import sinon from 'sinon'; -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; +import sinon from 'sinon'; import { browser, createJsdom } from './mocha/setup.js'; /* test */ @@ -44,10 +44,6 @@ describe('bookmark', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('create folder map', () => { const func = mjs.createFolderMap; beforeEach(() => { @@ -96,7 +92,7 @@ describe('bookmark', () => { type: 'folder' }; await func(tree); - assert.isTrue(folderMap.has('foo'), 'key'); + assert.strictEqual(folderMap.has('foo'), true, 'key'); }); it('should get map', async () => { @@ -129,16 +125,16 @@ describe('bookmark', () => { }; await func(tree); assert.strictEqual(folderMap.size, 3, 'size'); - assert.isTrue(folderMap.has('foo'), 'key'); + assert.strictEqual(folderMap.has('foo'), true, 'key'); assert.deepEqual(Array.from(folderMap.get('foo').children), [ 'bar', 'baz' ], 'set'); - assert.isTrue(folderMap.has('bar'), 'key'); + assert.strictEqual(folderMap.has('bar'), true, 'key'); assert.deepEqual(Array.from(folderMap.get('bar').children), [], 'set'); - assert.isTrue(folderMap.has('baz'), 'key'); - assert.isFalse(folderMap.has('qux'), 'key'); - assert.isFalse(folderMap.has('quux'), 'key'); + assert.strictEqual(folderMap.has('baz'), true, 'key'); + assert.strictEqual(folderMap.has('qux'), false, 'key'); + assert.strictEqual(folderMap.has('quux'), false, 'key'); }); it('should get map', async () => { @@ -171,18 +167,18 @@ describe('bookmark', () => { }; await func(tree, true); assert.strictEqual(folderMap.size, 4, 'size'); - assert.isTrue(folderMap.has('foo'), 'key'); + assert.strictEqual(folderMap.has('foo'), true, 'key'); assert.deepEqual(Array.from(folderMap.get('foo').children), [ 'bar', 'baz' ], 'set'); - assert.isTrue(folderMap.has('bar'), 'key'); + assert.strictEqual(folderMap.has('bar'), true, 'key'); assert.deepEqual(Array.from(folderMap.get('bar').children), [ 'quux' ], 'set'); - assert.isTrue(folderMap.has('baz'), 'key'); - assert.isFalse(folderMap.has('qux'), 'key'); - assert.isTrue(folderMap.has('quux'), 'key'); + assert.strictEqual(folderMap.has('baz'), true, 'key'); + assert.strictEqual(folderMap.has('qux'), false, 'key'); + assert.strictEqual(folderMap.has('quux'), true, 'key'); }); }); @@ -225,18 +221,18 @@ describe('bookmark', () => { type: 'folder' }]); const res = await func(); - assert.instanceOf(res, Map, 'map'); + assert.strictEqual(res instanceof Map, true, 'map'); assert.strictEqual(res.size, 3, 'size'); - assert.isTrue(res.has('foo'), 'key'); + assert.strictEqual(res.has('foo'), true, 'key'); assert.deepEqual(Array.from(res.get('foo').children), [ 'bar', 'baz' ], 'set'); - assert.isTrue(res.has('bar'), 'key'); + assert.strictEqual(res.has('bar'), true, 'key'); assert.deepEqual(Array.from(res.get('bar').children), [], 'set'); - assert.isTrue(res.has('baz'), 'key'); - assert.isFalse(res.has('qux'), 'key'); - assert.isFalse(res.has('quux'), 'key'); + assert.strictEqual(res.has('baz'), true, 'key'); + assert.strictEqual(res.has('qux'), false, 'key'); + assert.strictEqual(res.has('quux'), false, 'key'); }); it('should get map', async () => { @@ -267,18 +263,18 @@ describe('bookmark', () => { type: 'folder' }]); const res = await func(true); - assert.instanceOf(res, Map, 'map'); + assert.strictEqual(res instanceof Map, true, 'map'); assert.strictEqual(res.size, 4, 'size'); - assert.isTrue(res.has('foo'), 'key'); + assert.strictEqual(res.has('foo'), true, 'key'); assert.deepEqual(Array.from(res.get('foo').children), [ 'bar', 'baz' ], 'set'); - assert.isTrue(res.has('bar'), 'key'); + assert.strictEqual(res.has('bar'), true, 'key'); assert.deepEqual(Array.from(res.get('bar').children), ['quux'], 'set'); - assert.isTrue(res.has('baz'), 'key'); - assert.isFalse(res.has('qux'), 'key'); - assert.isTrue(res.has('quux'), 'key'); + assert.strictEqual(res.has('baz'), true, 'key'); + assert.strictEqual(res.has('qux'), false, 'key'); + assert.strictEqual(res.has('quux'), true, 'key'); }); }); @@ -296,7 +292,7 @@ describe('bookmark', () => { it('should get null', async () => { browser.storage.local.get.withArgs(BOOKMARK_LOCATION).resolves(undefined); const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -306,7 +302,7 @@ describe('bookmark', () => { } }); const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -324,7 +320,7 @@ describe('bookmark', () => { const res = await func(); stub.restore(); assert.strictEqual(msg, 'error', 'log'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -337,7 +333,7 @@ describe('bookmark', () => { foo: 'bar' }]); const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get result', async () => { diff --git a/test/browser-tabs.test.js b/test/browser-tabs.test.js index fe197879..15d4449b 100644 --- a/test/browser-tabs.test.js +++ b/test/browser-tabs.test.js @@ -4,7 +4,7 @@ /* eslint-disable import-x/order */ /* api */ -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; import { browser, createJsdom } from './mocha/setup.js'; @@ -44,10 +44,6 @@ describe('browser-tabs', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('close tabs', () => { const func = mjs.closeTabs; @@ -69,7 +65,7 @@ describe('browser-tabs', () => { const i = browser.tabs.remove.callCount; const res = await func([]); assert.strictEqual(browser.tabs.remove.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -97,7 +93,7 @@ describe('browser-tabs', () => { const res = await func(Array.from(items)); assert.strictEqual(browser.tabs.remove.withArgs([1, 2]).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -122,7 +118,7 @@ describe('browser-tabs', () => { const i = browser.tabs.remove.callCount; const res = await func([]); assert.strictEqual(browser.tabs.remove.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -149,7 +145,7 @@ describe('browser-tabs', () => { const res = await func([1, 2]); assert.strictEqual(browser.tabs.remove.withArgs([1, 2]).callCount, i + 1, 'called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -176,7 +172,7 @@ describe('browser-tabs', () => { const res = await func([1, 2], elm3); assert.strictEqual(browser.tabs.remove.withArgs([1, 2]).callCount, i + 1, 'called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); }); @@ -201,7 +197,7 @@ describe('browser-tabs', () => { const i = browser.tabs.remove.callCount; const res = await func([]); assert.strictEqual(browser.tabs.remove.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -214,7 +210,7 @@ describe('browser-tabs', () => { body.appendChild(elm); const res = await func([elm]); assert.strictEqual(browser.tabs.remove.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -242,7 +238,7 @@ describe('browser-tabs', () => { const res = await func(Array.from(items)); assert.strictEqual(browser.tabs.remove.withArgs([3, 4]).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -269,7 +265,7 @@ describe('browser-tabs', () => { const res = await func([elm2]); assert.strictEqual(browser.tabs.remove.withArgs([3, 4]).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -296,7 +292,7 @@ describe('browser-tabs', () => { const res = await func([elm2]); assert.strictEqual(browser.tabs.remove.withArgs([3, 4]).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -307,14 +303,14 @@ describe('browser-tabs', () => { const i = browser.tabs.remove.callCount; const res = await func(); assert.strictEqual(browser.tabs.remove.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function if argument is not element', async () => { const i = browser.tabs.remove.callCount; const res = await func('foo'); assert.strictEqual(browser.tabs.remove.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -339,7 +335,7 @@ describe('browser-tabs', () => { const res = await func(elm2); assert.strictEqual(browser.tabs.remove.withArgs([3, 4]).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -365,7 +361,7 @@ describe('browser-tabs', () => { const res = await func(elm2); assert.strictEqual(browser.tabs.remove.withArgs([3, 4]).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -393,7 +389,7 @@ describe('browser-tabs', () => { const res = await func(elm2); assert.strictEqual(browser.tabs.remove.withArgs([4]).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -404,14 +400,14 @@ describe('browser-tabs', () => { const i = browser.tabs.remove.callCount; const res = await func(); assert.strictEqual(browser.tabs.remove.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function if argument is not element', async () => { const i = browser.tabs.remove.callCount; const res = await func('foo'); assert.strictEqual(browser.tabs.remove.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function if given argument is pinned', async () => { @@ -436,7 +432,7 @@ describe('browser-tabs', () => { body.appendChild(elm4); const res = await func(elm); assert.strictEqual(browser.tabs.remove.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -461,7 +457,7 @@ describe('browser-tabs', () => { const res = await func(elm3); assert.strictEqual(browser.tabs.remove.withArgs([1, 2]).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -487,7 +483,7 @@ describe('browser-tabs', () => { const res = await func(elm4); assert.strictEqual(browser.tabs.remove.withArgs([2, 3]).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -512,7 +508,7 @@ describe('browser-tabs', () => { const i = browser.tabs.create.callCount; const res = await func([{}]); assert.strictEqual(browser.tabs.create.callCount, i, 'not called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -524,7 +520,7 @@ describe('browser-tabs', () => { const res = await func([{ foo: 'bar' }, { foo: 'baz' }]); assert.strictEqual(createFunc.callCount, 2, 'called'); assert.deepEqual(order, ['bar', 'baz'], 'order'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -536,7 +532,7 @@ describe('browser-tabs', () => { const res = await func([{ foo: 'bar' }, { foo: 'baz' }], true); assert.strictEqual(createFunc.callCount, 2, 'called'); assert.deepEqual(order, ['baz', 'bar'], 'order'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -575,7 +571,7 @@ describe('browser-tabs', () => { const i = browser.tabs.get.callCount; const res = await func(['foo'], 'bar'); assert.strictEqual(browser.tabs.get.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -631,7 +627,7 @@ describe('browser-tabs', () => { index: 1, openerTabId: 1 }).callCount, l + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -687,7 +683,7 @@ describe('browser-tabs', () => { index: 1, openerTabId: 1 }).callCount, l + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -741,7 +737,7 @@ describe('browser-tabs', () => { index: 2, openerTabId: 2 }).callCount, l + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -923,7 +919,7 @@ describe('browser-tabs', () => { windowId: browser.windows.WINDOW_ID_CURRENT, tabs: [0] }).callCount, j + 1, 'called'); - assert.isObject(res, 'result'); + assert.strictEqual(typeof res, 'object', 'result'); }); it('should call function', async () => { @@ -974,7 +970,7 @@ describe('browser-tabs', () => { windowId: 1, tabs: [0, 2] }).callCount, j + 1, 'called'); - assert.isObject(res, 'result'); + assert.strictEqual(typeof res, 'object', 'result'); }); it('should call function', async () => { @@ -1025,7 +1021,7 @@ describe('browser-tabs', () => { windowId: 1, tabs: [2, 0] }).callCount, j + 1, 'called'); - assert.isObject(res, 'result'); + assert.strictEqual(typeof res, 'object', 'result'); }); it('should call function', async () => { @@ -1074,7 +1070,7 @@ describe('browser-tabs', () => { windowId: browser.windows.WINDOW_ID_CURRENT, tabs: [0, 2] }).callCount, j + 1, 'called'); - assert.isObject(res, 'result'); + assert.strictEqual(typeof res, 'object', 'result'); }); it('should call function', async () => { @@ -1120,7 +1116,7 @@ describe('browser-tabs', () => { windowId: 1, tabs: [2, 0] }).callCount, j + 1, 'called'); - assert.isObject(res, 'result'); + assert.strictEqual(typeof res, 'object', 'result'); }); }); @@ -1145,7 +1141,7 @@ describe('browser-tabs', () => { const i = browser.tabs.move.callCount; const res = await func([{}]); assert.strictEqual(browser.tabs.move.callCount, i, 'not called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should throw if index is not contained', async () => { @@ -1186,7 +1182,7 @@ describe('browser-tabs', () => { index: 0, windowId: 1 }).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -1199,7 +1195,7 @@ describe('browser-tabs', () => { index: 0, windowId: browser.windows.WINDOW_ID_CURRENT }).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -1212,7 +1208,7 @@ describe('browser-tabs', () => { await func([{ index: 0, tabId: 1 }, { index: 1, tabId: 2 }], 1); assert.strictEqual(moveFunc.callCount, 2, 'called'); assert.deepEqual(order, [1, 2], 'order'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -1225,7 +1221,7 @@ describe('browser-tabs', () => { await func([{ index: 0, tabId: 1 }, { index: 1, tabId: 2 }], 1, true); assert.strictEqual(moveFunc.callCount, 2, 'called'); assert.deepEqual(order, [2, 1], 'order'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -2364,14 +2360,14 @@ describe('browser-tabs', () => { const i = browser.tabs.move.callCount; const res = await func([]); assert.strictEqual(browser.tabs.move.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function if element is not contained', async () => { const i = browser.tabs.move.callCount; const res = await func(['foo']); assert.strictEqual(browser.tabs.move.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function if element is not tab', async () => { @@ -2381,7 +2377,7 @@ describe('browser-tabs', () => { body.appendChild(elm); const res = await func([elm]); assert.strictEqual(browser.tabs.move.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should create window but not call move if only 1 tab', async () => { @@ -2407,7 +2403,7 @@ describe('browser-tabs', () => { type: 'normal' }).callCount, i + 1, 'called'); assert.strictEqual(browser.tabs.move.callCount, j, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should create window and call move', async () => { @@ -2485,7 +2481,7 @@ describe('browser-tabs', () => { windowId: 1, index: -1 }).callCount, j, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); }); @@ -2787,7 +2783,7 @@ describe('browser-tabs', () => { it('should throw', async () => { await func().catch(e => { - assert.instanceOf(e, TypeError); + assert.strictEqual(e instanceof TypeError, true); assert.strictEqual(e.message, 'Expected String but got Undefined.'); }); }); diff --git a/test/color.test.js b/test/color.test.js index 144e1173..1b11ee99 100644 --- a/test/color.test.js +++ b/test/color.test.js @@ -3,9 +3,9 @@ */ /* api */ -import { assert } from 'chai'; -import { describe, it } from 'mocha'; +import { strict as assert } from 'node:assert'; import { resolve } from '@asamuzakjp/css-color'; +import { describe, it } from 'mocha'; /* test */ import * as mjs from '../src/mjs/color.js'; @@ -21,37 +21,37 @@ describe('color', () => { it('should get value', () => { const res = func([]); - assert.deepEqual(res, '#00000000', 'result'); + assert.strictEqual(res, '#00000000', 'result'); }); it('should get value', () => { const res = func([255, 0, 128]); - assert.deepEqual(res, '#ff0080', 'result'); + assert.strictEqual(res, '#ff0080', 'result'); }); it('should get value', () => { const res = func([255, 0, 128, 1]); - assert.deepEqual(res, '#ff0080', 'result'); + assert.strictEqual(res, '#ff0080', 'result'); }); it('should get value', () => { const res = func([0, 0, 0, 1]); - assert.deepEqual(res, '#000000', 'result'); + assert.strictEqual(res, '#000000', 'result'); }); it('should get value', () => { const res = func([255, 255, 255, 1]); - assert.deepEqual(res, '#ffffff', 'result'); + assert.strictEqual(res, '#ffffff', 'result'); }); it('should get value', () => { const res = func([1, 35, 69, 0.40392]); - assert.deepEqual(res, '#01234567', 'result'); + assert.strictEqual(res, '#01234567', 'result'); }); it('should get value', () => { const res = func([137, 171, 205, 0.93725]); - assert.deepEqual(res, '#89abcdef', 'result'); + assert.strictEqual(res, '#89abcdef', 'result'); }); }); @@ -65,7 +65,7 @@ describe('color', () => { it('should get null', () => { const res = func('transparent'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', () => { diff --git a/test/commander.test.js b/test/commander.test.js index 067b412b..b5f6a556 100644 --- a/test/commander.test.js +++ b/test/commander.test.js @@ -1,10 +1,10 @@ /* api */ +import { strict as assert } from 'node:assert'; import fs, { promises as fsPromise } from 'node:fs'; import path from 'node:path'; import process from 'node:process'; -import sinon from 'sinon'; -import { assert } from 'chai'; import { afterEach, beforeEach, describe, it } from 'mocha'; +import sinon from 'sinon'; import { MockAgent, getGlobalDispatcher, setGlobalDispatcher } from 'undici'; /* test */ @@ -34,7 +34,7 @@ describe('save theme manifest file', () => { it('should throw', async () => { await saveThemeManifest().catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected String but got Undefined.'); }); }); @@ -44,7 +44,7 @@ describe('save theme manifest file', () => { mockAgent.get(url.origin).intercept({ path: url.pathname, method: 'GET' }) .reply(404); await saveThemeManifest('foo').catch(e => { - assert.instanceOf(e, Error, 'error'); + assert.strictEqual(e instanceof Error, true, 'error'); assert.strictEqual(e.message, `Network response was not ok. status: 404 url: ${url}`); }); @@ -305,21 +305,21 @@ describe('update manifests', () => { stubWrite.restore(); assert.strictEqual(traceCallCount, i + 1, 'trace'); assert.strictEqual(writeCallCount, j, 'write'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); describe('save library package info', () => { it('should throw', async () => { await saveLibraryPackage().catch(e => { - assert.instanceOf(e, TypeError); + assert.strictEqual(e instanceof TypeError, true); assert.strictEqual(e.message, 'Expected Array but got Undefined.'); }); }); it('should throw', async () => { await saveLibraryPackage([]).catch(e => { - assert.instanceOf(e, Error); + assert.strictEqual(e instanceof Error, true); }); }); @@ -327,7 +327,7 @@ describe('save library package info', () => { await saveLibraryPackage([ 'foo' ]).catch(e => { - assert.instanceOf(e, Error); + assert.strictEqual(e instanceof Error, true); }); }); @@ -338,7 +338,7 @@ describe('save library package info', () => { name: 'foo' } ]).catch(e => { - assert.instanceOf(e, Error); + assert.strictEqual(e instanceof Error, true); }); }); @@ -359,7 +359,7 @@ describe('save library package info', () => { ]).catch(e => { const filePath = path.resolve(DIR_CWD, PATH_MODULE, 'tldts-experimental', 'foo.txt'); - assert.instanceOf(e, Error); + assert.strictEqual(e instanceof Error, true); assert.strictEqual(e.message, `${filePath} is not a file.`); }); }); @@ -384,7 +384,7 @@ describe('save library package info', () => { } ]).catch(e => { const filePath = path.resolve(DIR_CWD, PATH_LIB, 'tldts', 'foo'); - assert.instanceOf(e, Error); + assert.strictEqual(e instanceof Error, true); assert.strictEqual(e.message, `${filePath} is not a file.`); }); }); @@ -423,8 +423,8 @@ describe('save library package info', () => { const { calledOnce: writeCalled } = stubWrite; stubInfo.restore(); stubWrite.restore(); - assert.isTrue(writeCalled, 'called'); - assert.isFalse(infoCalled, 'not called'); + assert.strictEqual(writeCalled, true, 'called'); + assert.strictEqual(infoCalled, false, 'not called'); assert.strictEqual(res, filePath, 'result'); }); @@ -462,8 +462,8 @@ describe('save library package info', () => { const { calledOnce: infoCalled } = stubInfo; stubWrite.restore(); stubInfo.restore(); - assert.isTrue(writeCalled, 'called'); - assert.isTrue(infoCalled, 'called'); + assert.strictEqual(writeCalled, true, 'called'); + assert.strictEqual(infoCalled, true, 'called'); assert.strictEqual(res, filePath, 'result'); }); @@ -501,8 +501,8 @@ describe('save library package info', () => { const { calledOnce: writeCalled } = stubWrite; stubInfo.restore(); stubWrite.restore(); - assert.isTrue(writeCalled, 'called'); - assert.isFalse(infoCalled, 'not called'); + assert.strictEqual(writeCalled, true, 'called'); + assert.strictEqual(infoCalled, false, 'not called'); assert.strictEqual(res, filePath, 'result'); }); @@ -540,8 +540,8 @@ describe('save library package info', () => { const { calledOnce: infoCalled } = stubInfo; stubWrite.restore(); stubInfo.restore(); - assert.isTrue(writeCalled, 'called'); - assert.isTrue(infoCalled, 'called'); + assert.strictEqual(writeCalled, true, 'called'); + assert.strictEqual(infoCalled, true, 'called'); assert.strictEqual(res, filePath, 'result'); }); @@ -581,8 +581,8 @@ describe('save library package info', () => { const { calledOnce: writeCalled } = stubWrite; stubInfo.restore(); stubWrite.restore(); - assert.isTrue(writeCalled, 'called'); - assert.isFalse(infoCalled, 'not called'); + assert.strictEqual(writeCalled, true, 'called'); + assert.strictEqual(infoCalled, false, 'not called'); assert.strictEqual(res, filePath, 'result'); }); @@ -622,8 +622,8 @@ describe('save library package info', () => { const { calledOnce: infoCalled } = stubInfo; stubWrite.restore(); stubInfo.restore(); - assert.isTrue(writeCalled, 'called'); - assert.isTrue(infoCalled, 'called'); + assert.strictEqual(writeCalled, true, 'called'); + assert.strictEqual(infoCalled, true, 'called'); assert.strictEqual(res, filePath, 'result'); }); }); @@ -738,7 +738,7 @@ describe('include libraries', () => { stubWrite.restore(); assert.strictEqual(traceCallCount, i + 1, 'trace'); assert.strictEqual(writeCallCount, j, 'write'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -749,7 +749,7 @@ describe('clean directory', () => { cleanDirectory({ dir }); const { called: rmCalled } = stubRm; stubRm.restore(); - assert.isFalse(rmCalled, 'not called'); + assert.strictEqual(rmCalled, false, 'not called'); }); it('should call funtion', () => { @@ -761,8 +761,8 @@ describe('clean directory', () => { const { called: infoCalled } = stubInfo; stubRm.restore(); stubInfo.restore(); - assert.isTrue(rmCalled, 'called'); - assert.isFalse(infoCalled, 'not called'); + assert.strictEqual(rmCalled, true, 'called'); + assert.strictEqual(infoCalled, false, 'not called'); }); it('should call funtion', () => { @@ -774,8 +774,8 @@ describe('clean directory', () => { const { calledOnce: infoCalled } = stubInfo; stubRm.restore(); stubInfo.restore(); - assert.isTrue(rmCalled, 'called'); - assert.isTrue(infoCalled, 'not called'); + assert.strictEqual(rmCalled, true, 'called'); + assert.strictEqual(infoCalled, true, 'not called'); }); }); diff --git a/test/common-mjs.test.js b/test/common-mjs.test.js index 9b1c63b1..15bd7fe8 100644 --- a/test/common-mjs.test.js +++ b/test/common-mjs.test.js @@ -3,9 +3,9 @@ */ /* api */ -import sinon from 'sinon'; -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; +import sinon from 'sinon'; import { createJsdom } from './mocha/setup.js'; /* test */ @@ -57,8 +57,8 @@ describe('common', () => { const { calledOnce } = stub; stub.restore(); assert.strictEqual(msg, 'error'); - assert.isTrue(calledOnce); - assert.isFalse(res); + assert.strictEqual(calledOnce, true); + assert.strictEqual(res, false); }); it('should log error message', () => { @@ -71,8 +71,8 @@ describe('common', () => { const { calledOnce } = stub; stub.restore(); assert.strictEqual(msg, 'error'); - assert.isTrue(calledOnce); - assert.isFalse(res); + assert.strictEqual(calledOnce, true); + assert.strictEqual(res, false); }); }); @@ -83,7 +83,7 @@ describe('common', () => { const stub = sinon.stub(console, 'error'); const i = stub.callCount; const e = new Error('error'); - assert.throws(() => func(e), 'error'); + assert.throws(() => func(e), Error, 'error'); assert.strictEqual(stub.callCount, i + 1, 'called'); stub.restore(); }); @@ -98,11 +98,11 @@ describe('common', () => { msg = m; }); const res = func(); - const { calledOnce } = stub; + const { called } = stub; stub.restore(); - assert.isUndefined(msg); - assert.isFalse(calledOnce); - assert.isFalse(res); + assert.strictEqual(msg, undefined); + assert.strictEqual(called, false); + assert.strictEqual(res, false); }); it('should log warn message', () => { @@ -114,8 +114,8 @@ describe('common', () => { const { calledOnce } = stub; stub.restore(); assert.strictEqual(msg, 'foo'); - assert.isTrue(calledOnce); - assert.isFalse(res); + assert.strictEqual(calledOnce, true); + assert.strictEqual(res, false); }); }); @@ -128,11 +128,11 @@ describe('common', () => { msg = m; }); const res = func(); - const { calledOnce } = stub; + const { called } = stub; stub.restore(); - assert.isUndefined(msg); - assert.isFalse(calledOnce); - assert.isUndefined(res); + assert.strictEqual(msg, undefined); + assert.strictEqual(called, false); + assert.strictEqual(res, undefined); }); it('should log message', () => { @@ -144,7 +144,7 @@ describe('common', () => { const { calledOnce } = stub; stub.restore(); assert.strictEqual(msg, 'foo'); - assert.isTrue(calledOnce); + assert.strictEqual(calledOnce, true); assert.strictEqual(res, msg); }); }); @@ -194,14 +194,14 @@ describe('common', () => { it('should get false', () => { const items = [[], ['foo'], {}, { foo: 'bar' }, undefined, null, 1, true]; for (const item of items) { - assert.isFalse(func(item)); + assert.strictEqual(func(item), false); } }); it('should get true', () => { const items = ['', 'foo']; for (const item of items) { - assert.isTrue(func(item)); + assert.strictEqual(func(item), true); } }); }); @@ -212,7 +212,7 @@ describe('common', () => { it('should get false', () => { const items = [{}, [], ['foo'], '', 'foo', undefined, null, 1, true]; for (const item of items) { - assert.isFalse(func(item)); + assert.strictEqual(func(item), false); } }); @@ -220,7 +220,7 @@ describe('common', () => { const item = { foo: 'bar' }; - assert.isTrue(func(item)); + assert.strictEqual(func(item), true); }); }); @@ -237,12 +237,12 @@ describe('common', () => { it('should get null if 1st argument is not integer', async () => { const res = await func('foo'); - assert.isNull(res); + assert.strictEqual(res, null); }); it('should get null if 1st argument is not positive integer', async () => { const res = await func(-1); - assert.isNull(res); + assert.strictEqual(res, null); }); it('should resolve', async () => { @@ -278,7 +278,7 @@ describe('common', () => { it('should get null', () => { const res = func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should set contenteditable and get element', () => { @@ -290,8 +290,8 @@ describe('common', () => { if (typeof p.isContentEditable !== 'boolean') { p.isContentEditable = isContentEditable(p); } - assert.isTrue(res.hasAttribute('contenteditable'), 'attr'); - assert.isTrue(res.isContentEditable, 'editable'); + assert.strictEqual(res.hasAttribute('contenteditable'), true, 'attr'); + assert.strictEqual(res.isContentEditable, true, 'editable'); assert.strictEqual(res.id, 'foo', 'result'); }); @@ -304,8 +304,8 @@ describe('common', () => { if (typeof p.isContentEditable !== 'boolean') { p.isContentEditable = isContentEditable(p); } - assert.isTrue(res.hasAttribute('contenteditable'), 'attr'); - assert.isTrue(res.isContentEditable, 'editable'); + assert.strictEqual(res.hasAttribute('contenteditable'), true, 'attr'); + assert.strictEqual(res.isContentEditable, true, 'editable'); assert.strictEqual(res.id, 'foo', 'result'); }); @@ -319,9 +319,9 @@ describe('common', () => { if (typeof p.isContentEditable !== 'boolean') { p.isContentEditable = isContentEditable(p); } - assert.isTrue(res.hasAttribute('contenteditable'), 'attr'); - assert.isTrue(res.isContentEditable, 'editable'); - assert.isTrue(spy.calledOnce, 'called'); + assert.strictEqual(res.hasAttribute('contenteditable'), true, 'attr'); + assert.strictEqual(res.isContentEditable, true, 'editable'); + assert.strictEqual(spy.calledOnce, true, 'called'); assert.strictEqual(res.id, 'foo', 'result'); }); }); @@ -342,7 +342,7 @@ describe('common', () => { it('should get null', () => { const res = func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should remove contenteditable and get element', () => { @@ -355,8 +355,8 @@ describe('common', () => { if (typeof p.isContentEditable !== 'boolean') { p.isContentEditable = isContentEditable(p); } - assert.isFalse(res.hasAttribute('contenteditable'), 'attr'); - assert.isFalse(res.isContentEditable, 'editable'); + assert.strictEqual(res.hasAttribute('contenteditable'), false, 'attr'); + assert.strictEqual(res.isContentEditable, false, 'editable'); assert.strictEqual(res.id, 'foo', 'result'); }); }); @@ -377,7 +377,7 @@ describe('common', () => { it('should get undefined', async () => { const res = await func(); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should set dataset and get element', async () => { diff --git a/test/common.test.js b/test/common.test.js index b1c5f6e4..5e053cdd 100644 --- a/test/common.test.js +++ b/test/common.test.js @@ -1,7 +1,7 @@ /* api */ -import sinon from 'sinon'; -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { describe, it } from 'mocha'; +import sinon from 'sinon'; /* test */ import { @@ -58,9 +58,9 @@ describe('logErr', () => { const res = logErr(new Error(msg)); const { calledOnce } = consoleError; consoleError.restore(); - assert.isTrue(calledOnce); + assert.strictEqual(calledOnce, true); assert.strictEqual(errMsg, msg); - assert.isFalse(res); + assert.strictEqual(res, false); }); }); @@ -74,7 +74,7 @@ describe('logMsg', () => { const res = logMsg(msg); const { calledOnce } = consoleLog; consoleLog.restore(); - assert.isTrue(calledOnce); + assert.strictEqual(calledOnce, true); assert.strictEqual(logMessage, msg); assert.strictEqual(res, msg); }); @@ -90,9 +90,9 @@ describe('logWarn', () => { const res = logWarn(msg); const { calledOnce } = consoleWarn; consoleWarn.restore(); - assert.isTrue(calledOnce); + assert.strictEqual(calledOnce, true); assert.strictEqual(warnMsg, msg); - assert.isFalse(res); + assert.strictEqual(res, false); }); }); diff --git a/test/constant.test.js b/test/constant.test.js index 3321bba0..41aeb605 100644 --- a/test/constant.test.js +++ b/test/constant.test.js @@ -3,7 +3,7 @@ */ /* api */ -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { describe, it } from 'mocha'; /* test */ @@ -13,8 +13,8 @@ describe('constants', () => { const items = Object.entries(mjs); for (const [key, value] of items) { it('should get string', () => { - assert.isString(key); - assert.isString(value); + assert.strictEqual(typeof key, 'string'); + assert.strictEqual(typeof value, 'string'); }); } }); diff --git a/test/file-util.test.js b/test/file-util.test.js index 8c9a5b82..9a79c86e 100644 --- a/test/file-util.test.js +++ b/test/file-util.test.js @@ -1,8 +1,8 @@ /* api */ +import { strict as assert } from 'node:assert'; import fs, { promises as fsPromise } from 'node:fs'; import os from 'node:os'; import path from 'node:path'; -import { assert } from 'chai'; import { afterEach, beforeEach, describe, it } from 'mocha'; import { MockAgent, getGlobalDispatcher, setGlobalDispatcher } from 'undici'; @@ -18,16 +18,17 @@ const TMPDIR = process.env.TMP || process.env.TMPDIR || process.env.TEMP || describe('getStat', () => { it('should be an object', () => { const p = path.resolve('test', 'file', 'test.txt'); - assert.property(getStat(p), 'mode'); + assert.strictEqual(typeof getStat(p), 'object', 'mode'); + assert.notDeepEqual(getStat(p), null, 'mode'); }); it('should get null if given argument is not string', () => { - assert.isNull(getStat()); + assert.strictEqual(getStat(), null); }); it('should get null if file does not exist', () => { const p = path.resolve('test', 'file', 'foo.txt'); - assert.isNull(getStat(p)); + assert.strictEqual(getStat(p), null); }); }); @@ -46,20 +47,20 @@ describe('isDir', () => { describe('isFile', () => { it('should get true if file exists', () => { const p = path.resolve('test', 'file', 'test.txt'); - assert.isTrue(isFile(p)); + assert.strictEqual(isFile(p), true); }); it('should get false if file does not exist', () => { const p = path.resolve('test', 'file', 'foo.txt'); - assert.isFalse(isFile(p)); + assert.strictEqual(isFile(p), false); }); }); describe('removeDir', () => { it('should throw', () => { const foo = path.resolve('foo'); - assert.isFalse(isDir(foo)); - assert.throws(() => removeDir(foo), `No such directory: ${foo}`); + assert.strictEqual(isDir(foo), false); + assert.throws(() => removeDir(foo), Error, `No such directory: ${foo}`); }); it("should remove dir and it's files", async () => { @@ -148,7 +149,7 @@ describe('fetch text', () => { it('should throw', async () => { await fetchText().catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected String but got Undefined.'); }); }); @@ -157,7 +158,7 @@ describe('fetch text', () => { const base = 'https://example.com'; mockAgent.get(base).intercept({ path: '/', method: 'GET' }).reply(404); await fetchText(base).catch(e => { - assert.instanceOf(e, Error, 'error'); + assert.strictEqual(e instanceof Error, true, 'error'); assert.strictEqual(e.message, `Network response was not ok. status: 404 url: ${base}`); }); diff --git a/test/localize.test.js b/test/localize.test.js index 6c313121..e5b34e8a 100644 --- a/test/localize.test.js +++ b/test/localize.test.js @@ -4,7 +4,7 @@ /* eslint-disable import-x/order */ /* api */ -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; import { browser, createJsdom } from './mocha/setup.js'; @@ -34,10 +34,6 @@ describe('localize', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('localize attribute value', () => { const func = mjs.localizeAttr; const globalKeys = ['Node', 'NodeList']; @@ -131,7 +127,7 @@ describe('localize', () => { browser.i18n.getMessage.withArgs(EXT_LOCALE).returns(''); await func(); const root = document.documentElement; - assert.isNull(root.getAttribute('lang'), 'lang'); + assert.strictEqual(root.getAttribute('lang'), null, 'lang'); }); it('should set value', async () => { diff --git a/test/main.test.js b/test/main.test.js index 26660537..7984f83a 100644 --- a/test/main.test.js +++ b/test/main.test.js @@ -4,9 +4,9 @@ /* eslint-disable camelcase, import-x/order, regexp/no-super-linear-backtracking */ /* api */ -import sinon from 'sinon'; -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; +import sinon from 'sinon'; import { browser, createJsdom, mockPort } from './mocha/setup.js'; /* test */ @@ -202,10 +202,6 @@ describe('main', () => { mjs.sidebar.windowId = null; }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('set user options', () => { const func = mjs.setUserOpts; beforeEach(() => { @@ -223,8 +219,8 @@ describe('main', () => { }); assert.deepEqual(res, mjs.userOpts, 'result'); assert.strictEqual(res.size, 1, 'size'); - assert.isTrue(res.has('foo'), 'key'); - assert.isTrue(res.get('foo'), 'value'); + assert.strictEqual(res.has('foo'), true, 'key'); + assert.strictEqual(res.get('foo'), true, 'value'); }); it('should set user option', async () => { @@ -235,17 +231,17 @@ describe('main', () => { }); assert.deepEqual(res, mjs.userOpts, 'result'); assert.strictEqual(res.size, 1, 'size'); - assert.isFalse(res.has(TABS_CLOSE_MDLCLICK_PREVENT), 'key'); - assert.isTrue(res.has(TABS_CLOSE_MDLCLICK), 'key'); - assert.isFalse(res.get(TABS_CLOSE_MDLCLICK), 'value'); + assert.strictEqual(res.has(TABS_CLOSE_MDLCLICK_PREVENT), false, 'key'); + assert.strictEqual(res.has(TABS_CLOSE_MDLCLICK), true, 'key'); + assert.strictEqual(res.get(TABS_CLOSE_MDLCLICK), false, 'value'); }); it('should call function', async () => { const res = await func(); assert.deepEqual(res, mjs.userOpts, 'result'); assert.strictEqual(res.size, 2, 'size'); - assert.isTrue(res.has(TABS_CLOSE_MDLCLICK), 'default option'); - assert.isTrue(res.has(TAB_GROUP_ENABLE), 'default option'); + assert.strictEqual(res.has(TABS_CLOSE_MDLCLICK), true, 'default option'); + assert.strictEqual(res.has(TAB_GROUP_ENABLE), true, 'default option'); }); it('should call function', async () => { @@ -269,17 +265,17 @@ describe('main', () => { const res = await func(); assert.deepEqual(res, mjs.userOpts, 'result'); assert.strictEqual(res.size, 5, 'size'); - assert.isTrue(res.has(BROWSER_SETTINGS_READ), 'key'); - assert.isTrue(res.get(BROWSER_SETTINGS_READ), 'value'); - assert.isTrue(res.has(CUSTOM_ZOOM), 'key'); + assert.strictEqual(res.has(BROWSER_SETTINGS_READ), true, 'key'); + assert.strictEqual(res.get(BROWSER_SETTINGS_READ), true, 'value'); + assert.strictEqual(res.has(CUSTOM_ZOOM), true, 'key'); assert.strictEqual(res.get(CUSTOM_ZOOM), '1.5', 'value'); - assert.isTrue(res.has(PINNED_HEIGHT), 'key'); + assert.strictEqual(res.has(PINNED_HEIGHT), true, 'key'); assert.strictEqual(res.get(PINNED_HEIGHT), 100, 'value'); - assert.isTrue(res.has(TABS_CLOSE_MDLCLICK), 'key'); - assert.isFalse(res.get(TABS_CLOSE_MDLCLICK), 'value'); - assert.isTrue(res.has(TAB_GROUP_ENABLE), 'key'); - assert.isFalse(res.get(TAB_GROUP_ENABLE), 'value'); - assert.isFalse(res.has(FONT_ACTIVE), 'key'); + assert.strictEqual(res.has(TABS_CLOSE_MDLCLICK), true, 'key'); + assert.strictEqual(res.get(TABS_CLOSE_MDLCLICK), false, 'value'); + assert.strictEqual(res.has(TAB_GROUP_ENABLE), true, 'key'); + assert.strictEqual(res.get(TAB_GROUP_ENABLE), false, 'value'); + assert.strictEqual(res.has(FONT_ACTIVE), false, 'key'); }); it('should call function', async () => { @@ -294,10 +290,10 @@ describe('main', () => { const res = await func(); assert.deepEqual(res, mjs.userOpts, 'result'); assert.strictEqual(res.size, 4, 'size'); - assert.isTrue(res.has(THEME_CUSTOM_DARK), 'key'); - assert.isObject(res.get(THEME_CUSTOM_DARK), 'value'); - assert.isTrue(res.has(THEME_CUSTOM_LIGHT), 'key'); - assert.isObject(res.get(THEME_CUSTOM_LIGHT), 'value'); + assert.strictEqual(res.has(THEME_CUSTOM_DARK), true, 'key'); + assert.strictEqual(typeof res.get(THEME_CUSTOM_DARK), 'object', 'value'); + assert.strictEqual(res.has(THEME_CUSTOM_LIGHT), true, 'key'); + assert.strictEqual(typeof res.get(THEME_CUSTOM_LIGHT), 'object', 'value'); }); it('should call function', async () => { @@ -314,7 +310,7 @@ describe('main', () => { const res = await func(); assert.deepEqual(res, mjs.userOpts, 'result'); assert.strictEqual(res.size, 3, 'size'); - assert.isTrue(res.has(FONT_ACTIVE), 'key'); + assert.strictEqual(res.has(FONT_ACTIVE), true, 'key'); assert.strictEqual(res.get(FONT_ACTIVE), 'bold', 'value'); }); @@ -332,7 +328,7 @@ describe('main', () => { const res = await func(); assert.deepEqual(res, mjs.userOpts, 'result'); assert.strictEqual(res.size, 3, 'size'); - assert.isTrue(res.has(FONT_ACTIVE), 'key'); + assert.strictEqual(res.has(FONT_ACTIVE), true, 'key'); assert.strictEqual(res.get(FONT_ACTIVE), 'normal', 'value'); }); }); @@ -359,8 +355,8 @@ describe('main', () => { await func(); assert.strictEqual(getCurrent.callCount, i + 1, 'getCurrent called'); assert.strictEqual(getOs.callCount, j + 1, 'getOs called'); - assert.isFalse(sidebar.incognito, 'incognito'); - assert.isFalse(sidebar.isMac, 'isMac'); + assert.strictEqual(sidebar.incognito, false, 'incognito'); + assert.strictEqual(sidebar.isMac, false, 'isMac'); assert.strictEqual(sidebar.windowId, 1, 'windowId'); }); @@ -382,8 +378,8 @@ describe('main', () => { await func(); assert.strictEqual(getCurrent.callCount, i + 1, 'getCurrent called'); assert.strictEqual(getOs.callCount, j + 1, 'getOs called'); - assert.isTrue(sidebar.incognito, 'incognito'); - assert.isTrue(sidebar.isMac, 'isMac'); + assert.strictEqual(sidebar.incognito, true, 'incognito'); + assert.strictEqual(sidebar.isMac, true, 'isMac'); assert.strictEqual(sidebar.windowId, 1, 'windowId'); }); }); @@ -418,7 +414,7 @@ describe('main', () => { it('should set null', async () => { const { sidebar } = mjs; await func('foo'); - assert.isNull(sidebar.context, 'result'); + assert.strictEqual(sidebar.context, null, 'result'); }); }); @@ -449,7 +445,7 @@ describe('main', () => { const query = browser.contextualIdentities.query.withArgs({}); query.rejects('error'); await func().catch(e => { - assert.instanceOf(e, Error, 'error'); + assert.strictEqual(e instanceof Error, true, 'error'); }); }); }); @@ -460,7 +456,7 @@ describe('main', () => { it('should set null', async () => { const { sidebar } = mjs; await func({}); - assert.isNull(sidebar.lastClosedTab, 'result'); + assert.strictEqual(sidebar.lastClosedTab, null, 'result'); }); it('should set null', async () => { @@ -468,7 +464,7 @@ describe('main', () => { await func({ id: 2 }); - assert.isNull(sidebar.lastClosedTab, 'result'); + assert.strictEqual(sidebar.lastClosedTab, null, 'result'); }); it('should set value', async () => { @@ -506,7 +502,7 @@ describe('main', () => { getRecentlyClosed.resolves([{}]); const res = await func(); assert.strictEqual(getRecentlyClosed.callCount, i + 1, 'called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); }); @@ -518,7 +514,7 @@ describe('main', () => { const i = restore.callCount; const res = await func(); assert.strictEqual(restore.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -540,13 +536,13 @@ describe('main', () => { it('should set null', async () => { const { sidebar } = mjs; await func('foo'); - assert.isNull(sidebar.pinnedTabsWaitingToMove, 'result'); + assert.strictEqual(sidebar.pinnedTabsWaitingToMove, null, 'result'); }); it('should set null', async () => { const { sidebar } = mjs; await func([]); - assert.isNull(sidebar.pinnedTabsWaitingToMove, 'result'); + assert.strictEqual(sidebar.pinnedTabsWaitingToMove, null, 'result'); }); it('should set value', async () => { @@ -563,13 +559,13 @@ describe('main', () => { it('should set null', async () => { const { sidebar } = mjs; await func('foo'); - assert.isNull(sidebar.tabsWaitingToMove, 'result'); + assert.strictEqual(sidebar.tabsWaitingToMove, null, 'result'); }); it('should set null', async () => { const { sidebar } = mjs; await func([]); - assert.isNull(sidebar.tabsWaitingToMove, 'result'); + assert.strictEqual(sidebar.tabsWaitingToMove, null, 'result'); }); it('should set value', async () => { @@ -596,7 +592,7 @@ describe('main', () => { head.appendChild(elm); const res = await func(); assert.strictEqual(elm.textContent, '', 'content'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should not apply user style', async () => { @@ -607,7 +603,7 @@ describe('main', () => { mjs.userOpts.set(USER_CSS_USE, true); const res = await func(); assert.strictEqual(elm.textContent, '', 'content'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should not apply user style', async () => { @@ -623,7 +619,7 @@ describe('main', () => { }); const res = await func(); assert.strictEqual(elm.textContent, '', 'content'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should apply user style', async () => { @@ -639,7 +635,7 @@ describe('main', () => { }); const res = await func(); assert.strictEqual(elm.textContent, 'body { color: red; }', 'content'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -654,13 +650,13 @@ describe('main', () => { it('should get null', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { mjs.userOpts.set(THEME_CUSTOM, true); const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get array', async () => { @@ -712,7 +708,7 @@ describe('main', () => { it('should get empty array', async () => { const res = await func([{}]); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not set styles', async () => { @@ -727,7 +723,7 @@ describe('main', () => { assert.strictEqual(elm.style.height, '', 'height'); assert.strictEqual(elm.style.resize, '', 'resize'); assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should set height: auto, resize: none', async () => { @@ -742,7 +738,7 @@ describe('main', () => { assert.strictEqual(elm.style.height, 'auto', 'height'); assert.strictEqual(elm.style.resize, 'none', 'resize'); assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should set height: auto, resize: none', async () => { @@ -759,7 +755,7 @@ describe('main', () => { assert.strictEqual(elm.style.height, 'auto', 'height'); assert.strictEqual(elm.style.resize, 'none', 'resize'); assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should set height: auto, resize: none', async () => { @@ -777,7 +773,7 @@ describe('main', () => { assert.strictEqual(elm.style.height, 'auto', 'height'); assert.strictEqual(elm.style.resize, 'none', 'resize'); assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should set height: auto, resize: block', async () => { @@ -794,7 +790,7 @@ describe('main', () => { assert.strictEqual(elm.style.height, 'auto', 'height'); assert.strictEqual(elm.style.resize, 'block', 'resize'); assert.strictEqual(browser.storage.local.set.callCount, i, 'called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should set height: 200px, resize: block', async () => { @@ -811,7 +807,7 @@ describe('main', () => { assert.strictEqual(elm.style.height, '200px', 'height'); assert.strictEqual(elm.style.resize, 'block', 'resize'); assert.strictEqual(browser.storage.local.set.callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should set height: 100px, resize: block', async () => { @@ -829,7 +825,7 @@ describe('main', () => { assert.strictEqual(elm.style.height, '100px', 'height'); assert.strictEqual(elm.style.resize, 'block', 'resize'); assert.strictEqual(browser.storage.local.set.callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should throw', async () => { @@ -844,12 +840,12 @@ describe('main', () => { await func([{ target: elm }]).catch(e => { - assert.instanceOf(e, Error, 'error'); + assert.strictEqual(e instanceof Error, true, 'error'); assert.strictEqual(e.message, 'error', 'message'); }); const { calledOnce: errCalled } = stubErr; stubErr.restore(); - assert.isTrue(errCalled, 'called'); + assert.strictEqual(errCalled, true, 'called'); assert.strictEqual(elm.style.height, '200px', 'height'); assert.strictEqual(elm.style.resize, 'block', 'resize'); }); @@ -881,11 +877,11 @@ describe('main', () => { } }; const res = await func(evt); - assert.isTrue(getData.notCalled, 'not called'); - assert.isTrue(setData.notCalled, 'not called'); + assert.strictEqual(getData.called, false, 'not called'); + assert.strictEqual(setData.called, false, 'not called'); assert.strictEqual(evt.dataTransfer.effectAllowed, 'uninitialized', 'effect'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -913,11 +909,11 @@ describe('main', () => { type: 'foo' }; const res = await func(evt); - assert.isTrue(getData.notCalled, 'not called'); - assert.isTrue(setData.notCalled, 'not called'); + assert.strictEqual(getData.called, false, 'not called'); + assert.strictEqual(setData.called, false, 'not called'); assert.strictEqual(evt.dataTransfer.effectAllowed, 'uninitialized', 'effect'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -950,7 +946,7 @@ describe('main', () => { index: 0 }); const res = await func(evt); - assert.isTrue(getData.notCalled, 'not called'); + assert.strictEqual(getData.called, false, 'not called'); assert.strictEqual(setData.callCount, 1, 'called'); assert.strictEqual(evt.dataTransfer.effectAllowed, 'copyMove', 'effect'); assert.deepEqual(res, [undefined], 'result'); @@ -987,9 +983,9 @@ describe('main', () => { type: 'dragover' }; const res = await func(evt); - assert.isTrue(getData.calledOnce, 'called'); - assert.isTrue(setData.notCalled, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(getData.calledOnce, true, 'called'); + assert.strictEqual(setData.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1025,9 +1021,9 @@ describe('main', () => { type: 'drop' }; const res = await func(evt); - assert.isTrue(getData.calledOnce, 'called'); - assert.isTrue(setData.notCalled, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(getData.calledOnce, true, 'called'); + assert.strictEqual(setData.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); }); @@ -1055,7 +1051,7 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(create.callCount, i, 'not called create'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -1080,7 +1076,7 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(create.callCount, i, 'not called create'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -1105,7 +1101,7 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(create.callCount, i, 'not called create'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1232,7 +1228,7 @@ describe('main', () => { create.resolves({}); const res = await func(evt); assert.strictEqual(create.callCount, i, 'not called create'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -1281,7 +1277,7 @@ describe('main', () => { const res = await func(); assert.strictEqual(update.callCount, i, 'not called update'); assert.strictEqual(getTab.callCount, j, 'not called get'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -1299,10 +1295,10 @@ describe('main', () => { const res = await func(elm); const { calledOnce: errCalled } = stubErr; stubErr.restore(); - assert.isTrue(errCalled, 'called error'); + assert.strictEqual(errCalled, true, 'called error'); assert.strictEqual(update.callCount, i, 'not called update'); assert.strictEqual(getTab.callCount, j + 1, 'called get'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1360,7 +1356,7 @@ describe('main', () => { const res = await func(elm); assert.strictEqual(update.callCount, i, 'not called update'); assert.strictEqual(getTab.callCount, j + 1, 'called get'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -1380,7 +1376,7 @@ describe('main', () => { const res = await func(elm); assert.strictEqual(update.callCount, i, 'not called update'); assert.strictEqual(getTab.callCount, j + 1, 'called get'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); }); @@ -1495,7 +1491,7 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(remove.callCount, i, 'not called remove'); - assert.isFalse(preventDefault.called, 'event not prevented'); + assert.strictEqual(preventDefault.called, false, 'event not prevented'); assert.deepEqual(res, [], 'result'); }); @@ -1517,7 +1513,7 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(remove.callCount, i, 'not called remove'); - assert.isFalse(preventDefault.called, 'event not prevented'); + assert.strictEqual(preventDefault.called, false, 'event not prevented'); assert.deepEqual(res, [], 'result'); }); @@ -1541,7 +1537,7 @@ describe('main', () => { const res = await func(evt); assert.strictEqual(remove.callCount, i, 'not called remove'); assert.strictEqual(remove.callCount, j, 'not called update'); - assert.isFalse(preventDefault.called, 'event not prevented'); + assert.strictEqual(preventDefault.called, false, 'event not prevented'); assert.deepEqual(res, [], 'result'); }); @@ -1896,8 +1892,8 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(remove.callCount, i + 1, 'called remove'); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); assert.deepEqual(res, [undefined], 'result'); }); @@ -1923,8 +1919,8 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(remove.callCount, i + 1, 'called remove'); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); assert.deepEqual(res, [undefined], 'result'); }); @@ -1950,8 +1946,8 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(remove.callCount, i + 1, 'called remove'); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); assert.deepEqual(res, [undefined], 'result'); }); @@ -1977,8 +1973,8 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(remove.callCount, i, 'not called remove'); - assert.isFalse(preventDefault.called, 'event not prevented'); - assert.isFalse(stopPropagation.called, 'event not stopped'); + assert.strictEqual(preventDefault.called, false, 'event not prevented'); + assert.strictEqual(stopPropagation.called, false, 'event not stopped'); assert.deepEqual(res, [], 'result'); }); @@ -2012,8 +2008,8 @@ describe('main', () => { assert.strictEqual(remove.callCount, i + 1, 'called remove'); assert.strictEqual(getTab.callCount, j, 'not called get'); assert.strictEqual(update.callCount, k, 'not called remove'); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); assert.deepEqual(res, [undefined], 'result'); }); @@ -2046,8 +2042,8 @@ describe('main', () => { assert.strictEqual(remove.callCount, i, 'not called remove'); assert.strictEqual(getTab.callCount, j, 'not called get'); assert.strictEqual(update.callCount, k + 1, 'called update'); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); assert.deepEqual(res, [{}], 'result'); }); @@ -2080,8 +2076,8 @@ describe('main', () => { assert.strictEqual(remove.callCount, i, 'not called remove'); assert.strictEqual(getTab.callCount, j, 'not called get'); assert.strictEqual(update.callCount, k, 'not called update'); - assert.isFalse(preventDefault.called, 'event not prevented'); - assert.isFalse(stopPropagation.calledOnce, 'event not stopped'); + assert.strictEqual(preventDefault.called, false, 'event not prevented'); + assert.strictEqual(stopPropagation.called, false, 'event not stopped'); assert.deepEqual(res, [], 'result'); }); }); @@ -2095,7 +2091,7 @@ describe('main', () => { body.appendChild(elm); const spy = sinon.spy(elm, 'addEventListener'); await func(elm); - assert.isFalse(spy.called, 'called'); + assert.strictEqual(spy.called, false, 'called'); elm.addEventListener.restore(); }); @@ -2106,7 +2102,7 @@ describe('main', () => { body.appendChild(elm); const spy = sinon.spy(elm, 'addEventListener'); await func(elm); - assert.isTrue(spy.called, 'called'); + assert.strictEqual(spy.called, true, 'called'); elm.addEventListener.restore(); }); }); @@ -2121,8 +2117,8 @@ describe('main', () => { const spy = sinon.spy(elm, 'addEventListener'); const spy2 = sinon.spy(elm, 'removeEventListener'); await func(elm, true); - assert.isFalse(spy.called, 'called'); - assert.isFalse(spy2.called, 'called'); + assert.strictEqual(spy.called, false, 'called'); + assert.strictEqual(spy2.called, false, 'called'); elm.addEventListener.restore(); elm.removeEventListener.restore(); }); @@ -2135,8 +2131,8 @@ describe('main', () => { const spy = sinon.spy(elm, 'addEventListener'); const spy2 = sinon.spy(elm, 'removeEventListener'); await func(elm, true); - assert.isTrue(spy.called, 'called'); - assert.isFalse(spy2.called, 'called'); + assert.strictEqual(spy.called, true, 'called'); + assert.strictEqual(spy2.called, false, 'called'); elm.addEventListener.restore(); elm.removeEventListener.restore(); }); @@ -2149,8 +2145,8 @@ describe('main', () => { const spy = sinon.spy(elm, 'addEventListener'); const spy2 = sinon.spy(elm, 'removeEventListener'); await func(elm, false); - assert.isFalse(spy.called, 'called'); - assert.isTrue(spy2.called, 'called'); + assert.strictEqual(spy.called, false, 'called'); + assert.strictEqual(spy2.called, true, 'called'); elm.addEventListener.restore(); elm.removeEventListener.restore(); }); @@ -2196,8 +2192,8 @@ describe('main', () => { const spy = sinon.spy(span, 'addEventListener'); const spy2 = sinon.spy(span2, 'addEventListener'); const res = await func(true); - assert.isTrue(spy.called, 'called'); - assert.isTrue(spy2.called, 'called'); + assert.strictEqual(spy.called, true, 'called'); + assert.strictEqual(spy2.called, true, 'called'); assert.deepEqual(res, [undefined, undefined], 'result'); span.addEventListener.restore(); span2.addEventListener.restore(); @@ -2220,8 +2216,8 @@ describe('main', () => { const spy = sinon.spy(span, 'removeEventListener'); const spy2 = sinon.spy(span2, 'removeEventListener'); const res = await func(false); - assert.isTrue(spy.called, 'called'); - assert.isTrue(spy2.called, 'called'); + assert.strictEqual(spy.called, true, 'called'); + assert.strictEqual(spy2.called, true, 'called'); assert.deepEqual(res, [undefined, undefined], 'result'); span.removeEventListener.restore(); span2.removeEventListener.restore(); @@ -2244,8 +2240,8 @@ describe('main', () => { const spy = sinon.spy(span, 'removeEventListener'); const spy2 = sinon.spy(span2, 'removeEventListener'); const res = await func(null); - assert.isTrue(spy.called, 'called'); - assert.isTrue(spy2.called, 'called'); + assert.strictEqual(spy.called, true, 'called'); + assert.strictEqual(spy2.called, true, 'called'); assert.deepEqual(res, [undefined, undefined], 'result'); span.removeEventListener.restore(); span2.removeEventListener.restore(); @@ -2270,7 +2266,7 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(browser.tabs.warmup.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); } }); @@ -2287,7 +2283,7 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(browser.tabs.warmup.callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); } }); @@ -2305,7 +2301,7 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(browser.tabs.warmup.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); } }); }); @@ -2430,15 +2426,20 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(info); assert.strictEqual(browser.tabs.get.callCount, i, 'not called'); - assert.isFalse(parent.classList.contains(ACTIVE), 'add class'); - assert.isFalse(heading.classList.contains(ACTIVE), 'add class'); - assert.isFalse(elm.classList.contains(ACTIVE), 'add class'); - assert.isFalse(elm.classList.contains(HIGHLIGHTED), 'add class'); - assert.isTrue(parent2.classList.contains(ACTIVE), 'remove class'); - assert.isFalse(heading2.classList.contains(ACTIVE), 'remove class'); - assert.isTrue(elm2.classList.contains(ACTIVE), 'remove class'); - assert.isTrue(elm2.classList.contains(HIGHLIGHTED), 'remove class'); - assert.isNull(res, 'result'); + assert.strictEqual(parent.classList.contains(ACTIVE), false, 'add class'); + assert.strictEqual(heading.classList.contains(ACTIVE), false, + 'add class'); + assert.strictEqual(elm.classList.contains(ACTIVE), false, 'add class'); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), false, + 'add class'); + assert.strictEqual(parent2.classList.contains(ACTIVE), true, + 'remove class'); + assert.strictEqual(heading2.classList.contains(ACTIVE), false, + 'remove class'); + assert.strictEqual(elm2.classList.contains(ACTIVE), true, 'remove class'); + assert.strictEqual(elm2.classList.contains(HIGHLIGHTED), true, + 'remove class'); + assert.strictEqual(res, null, 'result'); }); it('should not set class', async () => { @@ -2474,15 +2475,20 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(info); assert.strictEqual(browser.tabs.get.callCount, i, 'not called'); - assert.isFalse(parent.classList.contains(ACTIVE), 'add class'); - assert.isFalse(heading.classList.contains(ACTIVE), 'add class'); - assert.isFalse(elm.classList.contains(ACTIVE), 'add class'); - assert.isFalse(elm.classList.contains(HIGHLIGHTED), 'add class'); - assert.isTrue(parent2.classList.contains(ACTIVE), 'remove class'); - assert.isFalse(heading2.classList.contains(ACTIVE), 'remove class'); - assert.isTrue(elm2.classList.contains(ACTIVE), 'remove class'); - assert.isTrue(elm2.classList.contains(HIGHLIGHTED), 'remove class'); - assert.isNull(res, 'result'); + assert.strictEqual(parent.classList.contains(ACTIVE), false, 'add class'); + assert.strictEqual(heading.classList.contains(ACTIVE), false, + 'add class'); + assert.strictEqual(elm.classList.contains(ACTIVE), false, 'add class'); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), false, + 'add class'); + assert.strictEqual(parent2.classList.contains(ACTIVE), true, + 'remove class'); + assert.strictEqual(heading2.classList.contains(ACTIVE), false, + 'remove class'); + assert.strictEqual(elm2.classList.contains(ACTIVE), true, 'remove class'); + assert.strictEqual(elm2.classList.contains(HIGHLIGHTED), true, + 'remove class'); + assert.strictEqual(res, null, 'result'); }); it('should not set class', async () => { @@ -2518,15 +2524,20 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(info); assert.strictEqual(browser.tabs.get.callCount, i, 'not called'); - assert.isFalse(parent.classList.contains(ACTIVE), 'add class'); - assert.isFalse(heading.classList.contains(ACTIVE), 'add class'); - assert.isFalse(elm.classList.contains(ACTIVE), 'add class'); - assert.isFalse(elm.classList.contains(HIGHLIGHTED), 'add class'); - assert.isTrue(parent2.classList.contains(ACTIVE), 'remove class'); - assert.isFalse(heading2.classList.contains(ACTIVE), 'remove class'); - assert.isTrue(elm2.classList.contains(ACTIVE), 'remove class'); - assert.isTrue(elm2.classList.contains(HIGHLIGHTED), 'remove class'); - assert.isNull(res, 'result'); + assert.strictEqual(parent.classList.contains(ACTIVE), false, 'add class'); + assert.strictEqual(heading.classList.contains(ACTIVE), false, + 'add class'); + assert.strictEqual(elm.classList.contains(ACTIVE), false, 'add class'); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), false, + 'add class'); + assert.strictEqual(parent2.classList.contains(ACTIVE), true, + 'remove class'); + assert.strictEqual(heading2.classList.contains(ACTIVE), false, + 'remove class'); + assert.strictEqual(elm2.classList.contains(ACTIVE), true, 'remove class'); + assert.strictEqual(elm2.classList.contains(HIGHLIGHTED), true, + 'remove class'); + assert.strictEqual(res, null, 'result'); }); it('should not set class', async () => { @@ -2562,15 +2573,20 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(info); assert.strictEqual(browser.tabs.get.callCount, i, 'not called'); - assert.isFalse(parent.classList.contains(ACTIVE), 'add class'); - assert.isFalse(heading.classList.contains(ACTIVE), 'add class'); - assert.isFalse(elm.classList.contains(ACTIVE), 'add class'); - assert.isFalse(elm.classList.contains(HIGHLIGHTED), 'add class'); - assert.isTrue(parent2.classList.contains(ACTIVE), 'remove class'); - assert.isFalse(heading2.classList.contains(ACTIVE), 'remove class'); - assert.isTrue(elm2.classList.contains(ACTIVE), 'remove class'); - assert.isTrue(elm2.classList.contains(HIGHLIGHTED), 'remove class'); - assert.isNull(res, 'result'); + assert.strictEqual(parent.classList.contains(ACTIVE), false, 'add class'); + assert.strictEqual(heading.classList.contains(ACTIVE), false, + 'add class'); + assert.strictEqual(elm.classList.contains(ACTIVE), false, 'add class'); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), false, + 'add class'); + assert.strictEqual(parent2.classList.contains(ACTIVE), true, + 'remove class'); + assert.strictEqual(heading2.classList.contains(ACTIVE), false, + 'remove class'); + assert.strictEqual(elm2.classList.contains(ACTIVE), true, 'remove class'); + assert.strictEqual(elm2.classList.contains(HIGHLIGHTED), true, + 'remove class'); + assert.strictEqual(res, null, 'result'); }); it('should set class', async () => { @@ -2609,15 +2625,21 @@ describe('main', () => { const res = await func(info); assert.strictEqual(browser.tabs.get.callCount, i + 1, 'called'); assert.strictEqual(elm.dataset.tab, '{}', 'dataset'); - assert.isTrue(parent.classList.contains(ACTIVE), 'add class'); - assert.isFalse(heading.classList.contains(ACTIVE), 'add class'); - assert.isTrue(elm.classList.contains(ACTIVE), 'add class'); - assert.isTrue(elm.classList.contains(HIGHLIGHTED), 'add class'); - assert.isFalse(parent2.classList.contains(ACTIVE), 'remove class'); - assert.isFalse(heading2.classList.contains(ACTIVE), 'remove class'); - assert.isFalse(elm2.classList.contains(ACTIVE), 'remove class'); - assert.isFalse(elm2.classList.contains(HIGHLIGHTED), 'remove class'); - assert.isUndefined(res, 'result'); + assert.strictEqual(parent.classList.contains(ACTIVE), true, 'add class'); + assert.strictEqual(heading.classList.contains(ACTIVE), false, + 'add class'); + assert.strictEqual(elm.classList.contains(ACTIVE), true, 'add class'); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), true, + 'add class'); + assert.strictEqual(parent2.classList.contains(ACTIVE), false, + 'remove class'); + assert.strictEqual(heading2.classList.contains(ACTIVE), false, + 'remove class'); + assert.strictEqual(elm2.classList.contains(ACTIVE), false, + 'remove class'); + assert.strictEqual(elm2.classList.contains(HIGHLIGHTED), false, + 'remove class'); + assert.strictEqual(res, undefined, 'result'); }); it('should set class', async () => { @@ -2657,15 +2679,20 @@ describe('main', () => { const res = await func(info); assert.strictEqual(browser.tabs.get.callCount, i + 1, 'called'); assert.strictEqual(elm.dataset.tab, '{}', 'dataset'); - assert.isTrue(parent.classList.contains(ACTIVE), 'add class'); - assert.isTrue(heading.classList.contains(ACTIVE), 'add class'); - assert.isTrue(elm.classList.contains(ACTIVE), 'add class'); - assert.isTrue(elm.classList.contains(HIGHLIGHTED), 'add class'); - assert.isFalse(parent2.classList.contains(ACTIVE), 'remove class'); - assert.isFalse(heading2.classList.contains(ACTIVE), 'remove class'); - assert.isFalse(elm2.classList.contains(ACTIVE), 'remove class'); - assert.isFalse(elm2.classList.contains(HIGHLIGHTED), 'remove class'); - assert.isUndefined(res, 'result'); + assert.strictEqual(parent.classList.contains(ACTIVE), true, 'add class'); + assert.strictEqual(heading.classList.contains(ACTIVE), true, 'add class'); + assert.strictEqual(elm.classList.contains(ACTIVE), true, 'add class'); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), true, + 'add class'); + assert.strictEqual(parent2.classList.contains(ACTIVE), false, + 'remove class'); + assert.strictEqual(heading2.classList.contains(ACTIVE), false, + 'remove class'); + assert.strictEqual(elm2.classList.contains(ACTIVE), false, + 'remove class'); + assert.strictEqual(elm2.classList.contains(HIGHLIGHTED), false, + 'remove class'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -2812,7 +2839,7 @@ describe('main', () => { const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); assert.strictEqual(browser.i18n.getMessage.callCount, i, 'not called'); - assert.isNotOk(elm, 'not created'); + assert.strictEqual(elm, null, 'not created'); assert.deepEqual(res, [], 'result'); }); @@ -2841,8 +2868,8 @@ describe('main', () => { CLASS_TAB_CONTEXT, CLASS_TAB_TOGGLE_ICON, CLASS_TAB_CONTENT, CLASS_TAB_TITLE, CLASS_TAB_AUDIO, CLASS_TAB_CLOSE, CLASS_TAB_CLOSE_ICON ]; - assert.isOk(elm, 'created'); - assert.isTrue(elm.hasAttribute('hidden'), 'hidden'); + assert.notDeepEqual(elm, null, 'created'); + assert.strictEqual(elm.hasAttribute('hidden'), true, 'hidden'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); for (const tabItem of tabItems) { const item = elm.querySelector(`.${tabItem}`); @@ -2861,11 +2888,12 @@ describe('main', () => { assert.strictEqual(item.textContent, 'foo', `item ${tabItem}`); break; case CLASS_TAB_AUDIO: - assert.isFalse(item.classList.contains(AUDIBLE), `item ${tabItem}`); + assert.strictEqual(item.classList.contains(AUDIBLE), false, + `item ${tabItem}`); break; case CLASS_TAB_CLOSE: assert.strictEqual(item.title, `${TAB_CLOSE}_tooltip`, - `item ${tabItem}`); + `item ${tabItem}`); break; case CLASS_TAB_CLOSE_ICON: assert.strictEqual(item.alt, TAB_CLOSE, `item ${tabItem}`); @@ -2905,15 +2933,15 @@ describe('main', () => { CLASS_TAB_CONTEXT, CLASS_TAB_TOGGLE_ICON, CLASS_TAB_CONTENT, CLASS_TAB_TITLE, CLASS_TAB_AUDIO, CLASS_TAB_CLOSE, CLASS_TAB_CLOSE_ICON ]; - assert.isOk(elm, 'created'); - assert.isFalse(elm.hasAttribute('hidden'), 'hidden'); + assert.notDeepEqual(elm, null, 'created'); + assert.strictEqual(elm.hasAttribute('hidden'), false, 'hidden'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); for (const tabItem of tabItems) { const item = elm.querySelector(`.${tabItem}`); switch (tabItem) { case CLASS_TAB_CONTEXT: assert.strictEqual(item.title, `${TAB_GROUP_COLLAPSE}_tooltip`, - `item ${tabItem}`); + `item ${tabItem}`); break; case CLASS_TAB_TOGGLE_ICON: assert.strictEqual(item.alt, TAB_GROUP_COLLAPSE, `item ${tabItem}`); @@ -2925,11 +2953,12 @@ describe('main', () => { assert.strictEqual(item.textContent, 'foo', `item ${tabItem}`); break; case CLASS_TAB_AUDIO: - assert.isFalse(item.classList.contains(AUDIBLE), `item ${tabItem}`); + assert.strictEqual(item.classList.contains(AUDIBLE), false, + `item ${tabItem}`); break; case CLASS_TAB_CLOSE: assert.strictEqual(item.title, `${TAB_CLOSE}_tooltip`, - `item ${tabItem}`); + `item ${tabItem}`); break; case CLASS_TAB_CLOSE_ICON: assert.strictEqual(item.alt, TAB_CLOSE, `item ${tabItem}`); @@ -2966,11 +2995,11 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.classList.contains(ACTIVE), 'class'); + assert.strictEqual(elm.classList.contains(ACTIVE), true, 'class'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined @@ -2997,7 +3026,7 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 6, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); @@ -3027,7 +3056,7 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 6, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); @@ -3058,7 +3087,7 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); @@ -3093,8 +3122,8 @@ describe('main', () => { const { calledOnce: errCalled } = stubErr; stubErr.restore(); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isTrue(errCalled, 'called error'); - assert.isOk(elm, 'created'); + assert.strictEqual(errCalled, true, 'called error'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); @@ -3129,7 +3158,7 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); @@ -3165,7 +3194,7 @@ describe('main', () => { }); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); @@ -3197,15 +3226,16 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.classList.contains(PINNED), 'pinned'); - assert.isTrue(elm.draggable, 'draggable'); - assert.isTrue(elm.parentNode === pinned, 'parent'); - assert.isTrue(elm === pinned.firstElementChild, 'position'); - assert.isFalse(pinned.classList.contains(CLASS_TAB_GROUP), 'group'); + assert.strictEqual(elm.classList.contains(PINNED), true, 'pinned'); + assert.strictEqual(elm.draggable, true, 'draggable'); + assert.deepEqual(elm.parentNode, pinned, 'parent'); + assert.deepEqual(elm, pinned.firstElementChild, 'position'); + assert.strictEqual(pinned.classList.contains(CLASS_TAB_GROUP), false, + 'group'); assert.strictEqual(pinned.childElementCount, 1, 'count'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -3239,15 +3269,16 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.classList.contains(PINNED), 'pinned'); - assert.isTrue(elm.draggable, 'draggable'); - assert.isTrue(elm.parentNode === pinned, 'parent'); - assert.isTrue(elm === pinned.firstElementChild, 'position'); - assert.isTrue(pinned.classList.contains(CLASS_TAB_GROUP), 'group'); + assert.strictEqual(elm.classList.contains(PINNED), true, 'pinned'); + assert.strictEqual(elm.draggable, true, 'draggable'); + assert.deepEqual(elm.parentNode, pinned, 'parent'); + assert.deepEqual(elm, pinned.firstElementChild, 'position'); + assert.strictEqual(pinned.classList.contains(CLASS_TAB_GROUP), true, + 'group'); assert.strictEqual(pinned.childElementCount, 2, 'count'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -3282,15 +3313,16 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.classList.contains(PINNED), 'pinned'); - assert.isTrue(elm.draggable, 'draggable'); - assert.isTrue(elm.parentNode === pinned, 'parent'); - assert.isTrue(elm === pinned.firstElementChild, 'position'); - assert.isTrue(pinned.classList.contains(CLASS_TAB_GROUP), 'group'); + assert.strictEqual(elm.classList.contains(PINNED), true, 'pinned'); + assert.strictEqual(elm.draggable, true, 'draggable'); + assert.deepEqual(elm.parentNode, pinned, 'parent'); + assert.deepEqual(elm, pinned.firstElementChild, 'position'); + assert.strictEqual(pinned.classList.contains(CLASS_TAB_GROUP), true, + 'group'); assert.strictEqual(pinned.childElementCount, 2, 'count'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -3324,15 +3356,16 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.classList.contains(PINNED), 'pinned'); - assert.isTrue(elm.draggable, 'draggable'); - assert.isTrue(elm.parentNode === pinned, 'parent'); - assert.isTrue(elm === pinned.lastElementChild, 'position'); - assert.isTrue(pinned.classList.contains(CLASS_TAB_GROUP), 'group'); + assert.strictEqual(elm.classList.contains(PINNED), true, 'pinned'); + assert.strictEqual(elm.draggable, true, 'draggable'); + assert.deepEqual(elm.parentNode, pinned, 'parent'); + assert.deepEqual(elm, pinned.lastElementChild, 'position'); + assert.strictEqual(pinned.classList.contains(CLASS_TAB_GROUP), true, + 'group'); assert.strictEqual(pinned.childElementCount, 2, 'count'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -3371,16 +3404,17 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.classList.contains(PINNED), 'pinned'); - assert.isTrue(elm.draggable, 'draggable'); - assert.isTrue(elm.parentNode === pinned, 'parent'); - assert.isTrue(elm.previousElementSibling === child, 'position'); - assert.isTrue(elm.nextElementSibling === child2, 'position'); - assert.isTrue(pinned.classList.contains(CLASS_TAB_GROUP), 'group'); + assert.strictEqual(elm.classList.contains(PINNED), true, 'pinned'); + assert.strictEqual(elm.draggable, true, 'draggable'); + assert.deepEqual(elm.parentNode, pinned, 'parent'); + assert.deepEqual(elm.previousElementSibling, child, 'position'); + assert.deepEqual(elm.nextElementSibling, child2, 'position'); + assert.strictEqual(pinned.classList.contains(CLASS_TAB_GROUP), true, + 'group'); assert.strictEqual(pinned.childElementCount, 3, 'count'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -3419,16 +3453,17 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.classList.contains(PINNED), 'pinned'); - assert.isTrue(elm.draggable, 'draggable'); - assert.isTrue(elm.parentNode === pinned, 'parent'); - assert.isTrue(elm.previousElementSibling === child2, 'position'); - assert.isTrue(pinned.lastElementChild === elm, 'position'); - assert.isTrue(pinned.classList.contains(CLASS_TAB_GROUP), 'group'); + assert.strictEqual(elm.classList.contains(PINNED), true, 'pinned'); + assert.strictEqual(elm.draggable, true, 'draggable'); + assert.deepEqual(elm.parentNode, pinned, 'parent'); + assert.deepEqual(elm.previousElementSibling, child2, 'position'); + assert.deepEqual(pinned.lastElementChild, elm, 'position'); + assert.strictEqual(pinned.classList.contains(CLASS_TAB_GROUP), true, + 'group'); assert.strictEqual(pinned.childElementCount, 3, 'count'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -3471,15 +3506,16 @@ describe('main', () => { mjs.sidebar.windowId = 1; const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.classList.contains(PINNED), 'pinned'); - assert.isTrue(elm.draggable, 'draggable'); - assert.isTrue(elm.parentNode === pinned, 'parent'); - assert.isTrue(elm === pinned.lastElementChild, 'position'); - assert.isTrue(pinned.classList.contains(CLASS_TAB_GROUP), 'group'); + assert.strictEqual(elm.classList.contains(PINNED), true, 'pinned'); + assert.strictEqual(elm.draggable, true, 'draggable'); + assert.deepEqual(elm.parentNode, pinned, 'parent'); + assert.deepEqual(elm, pinned.lastElementChild, 'position'); + assert.strictEqual(pinned.classList.contains(CLASS_TAB_GROUP), true, + 'group'); assert.strictEqual(pinned.childElementCount, 2, 'count'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -3517,11 +3553,12 @@ describe('main', () => { emulate: true }); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isFalse(elm.parentNode.hasAttribute('hidden'), 'hidden attr'); + assert.strictEqual(elm.parentNode.hasAttribute('hidden'), false, + 'hidden attr'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined @@ -3558,11 +3595,12 @@ describe('main', () => { attached: true }); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isFalse(elm.parentNode.hasAttribute('hidden'), 'hidden attr'); + assert.strictEqual(elm.parentNode.hasAttribute('hidden'), false, + 'hidden attr'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined @@ -3613,12 +3651,12 @@ describe('main', () => { attached: true }); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 6, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.parentNode === parent, 'parent'); - assert.isFalse(parent.classList.contains(CLASS_TAB_COLLAPSED), + assert.deepEqual(elm.parentNode, parent, 'parent'); + assert.strictEqual(parent.classList.contains(CLASS_TAB_COLLAPSED), false, 'not collapsed'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -3670,12 +3708,12 @@ describe('main', () => { }); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.parentNode !== parent, 'parent'); - assert.isTrue(elm.parentNode !== parent2, 'parent'); + assert.strictEqual(elm.parentNode === parent, false, 'parent'); + assert.strictEqual(elm.parentNode === parent2, false, 'parent'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined @@ -3725,12 +3763,12 @@ describe('main', () => { }); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 6, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.parentNode === parent, 'parent'); - assert.isFalse(parent.classList.contains(CLASS_TAB_COLLAPSED), + assert.deepEqual(elm.parentNode, parent, 'parent'); + assert.strictEqual(parent.classList.contains(CLASS_TAB_COLLAPSED), false, 'not collapsed'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -3781,12 +3819,12 @@ describe('main', () => { }); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.parentNode.nextElementSibling === parent, 'parent'); - assert.isTrue(parent.classList.contains(CLASS_TAB_COLLAPSED), + assert.deepEqual(elm.parentNode.nextElementSibling, parent, 'parent'); + assert.strictEqual(parent.classList.contains(CLASS_TAB_COLLAPSED), true, 'collapsed'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -3883,12 +3921,12 @@ describe('main', () => { }).resolves([2]); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.parentNode === parent, 'parent'); - assert.isTrue(parent.classList.contains(CLASS_TAB_COLLAPSED), + assert.deepEqual(elm.parentNode, parent, 'parent'); + assert.strictEqual(parent.classList.contains(CLASS_TAB_COLLAPSED), true, 'collapsed'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -3944,11 +3982,11 @@ describe('main', () => { }); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.parentNode === parent, 'parent'); + assert.deepEqual(elm.parentNode, parent, 'parent'); assert.strictEqual(browser.tabs.move.callCount, j + 1, 'called move'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -4003,11 +4041,11 @@ describe('main', () => { }); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.parentNode === parent, 'parent'); + assert.deepEqual(elm.parentNode, parent, 'parent'); assert.strictEqual(browser.tabs.move.callCount, j, 'not called move'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -4062,12 +4100,12 @@ describe('main', () => { }); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 6, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.parentNode === parent, 'parent'); - assert.isFalse(parent.classList.contains(CLASS_TAB_COLLAPSED), + assert.deepEqual(elm.parentNode, parent, 'parent'); + assert.strictEqual(parent.classList.contains(CLASS_TAB_COLLAPSED), false, 'not collapsed'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -4122,12 +4160,12 @@ describe('main', () => { }); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 6, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.parentNode === parent, 'parent'); - assert.isFalse(parent.classList.contains(CLASS_TAB_COLLAPSED), + assert.deepEqual(elm.parentNode, parent, 'parent'); + assert.strictEqual(parent.classList.contains(CLASS_TAB_COLLAPSED), false, 'not collapsed'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -4177,12 +4215,12 @@ describe('main', () => { }); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 6, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.parentNode === parent, 'parent'); - assert.isFalse(parent.classList.contains(CLASS_TAB_COLLAPSED), + assert.deepEqual(elm.parentNode, parent, 'parent'); + assert.strictEqual(parent.classList.contains(CLASS_TAB_COLLAPSED), false, 'not collapsed'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -4236,12 +4274,12 @@ describe('main', () => { }); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 6, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isTrue(elm.parentNode === parent, 'parent'); - assert.isFalse(parent.classList.contains(CLASS_TAB_COLLAPSED), + assert.deepEqual(elm.parentNode, parent, 'parent'); + assert.strictEqual(parent.classList.contains(CLASS_TAB_COLLAPSED), false, 'not collapsed'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, @@ -4289,11 +4327,11 @@ describe('main', () => { }); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isFalse(elm.parentNode === parent, 'parent'); + assert.strictEqual(elm.parentNode === parent, false, 'parent'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined @@ -4344,11 +4382,11 @@ describe('main', () => { }); const res = await func(tabsTab); const elm = document.querySelector('[data-tab-id="1"]'); - assert.isOk(elm, 'created'); + assert.notDeepEqual(elm, null, 'created'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(elm.dataset.tabId, '1', 'id'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tab'); - assert.isFalse(elm.parentNode === parent, 'parent'); + assert.strictEqual(elm.parentNode === parent, false, 'parent'); assert.deepEqual(res, [ undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined @@ -4482,7 +4520,7 @@ describe('main', () => { }); const res = await func(browser.tabs.TAB_ID_NONE, info); assert.strictEqual(browser.tabs.get.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -4498,7 +4536,7 @@ describe('main', () => { }); const res = await func(1, info); assert.strictEqual(browser.tabs.get.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -4564,7 +4602,7 @@ describe('main', () => { body.appendChild(elm); mjs.sidebar.windowId = 1; await func(1, info); - assert.isNull(elm.parentNode, 'removed'); + assert.strictEqual(elm.parentNode, null, 'removed'); }); }); @@ -4631,8 +4669,9 @@ describe('main', () => { windowId: 1 }); assert.strictEqual(browser.tabs.get.callCount, i + 2, 'called'); - assert.isTrue(elm.classList.contains(HIGHLIGHTED), 'class'); - assert.isFalse(elm2.classList.contains(HIGHLIGHTED), 'remove class'); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), true, 'class'); + assert.strictEqual(elm2.classList.contains(HIGHLIGHTED), false, + 'remove class'); assert.deepEqual(res, [ [ [undefined, undefined] @@ -4684,9 +4723,11 @@ describe('main', () => { windowId: 1 }); assert.strictEqual(browser.tabs.get.callCount, i + 3, 'called'); - assert.isTrue(elm.classList.contains(HIGHLIGHTED), 'class'); - assert.isFalse(elm2.classList.contains(HIGHLIGHTED), 'remove class'); - assert.isTrue(elm3.classList.contains(HIGHLIGHTED), 'add class'); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), true, 'class'); + assert.strictEqual(elm2.classList.contains(HIGHLIGHTED), false, + 'remove class'); + assert.strictEqual(elm3.classList.contains(HIGHLIGHTED), true, + 'add class'); assert.deepEqual(res, [ [ [undefined, undefined], @@ -4733,9 +4774,9 @@ describe('main', () => { windowId: 1 }); assert.strictEqual(browser.tabs.get.callCount, i + 2, 'called'); - assert.isTrue(elm.classList.contains(HIGHLIGHTED), 'class'); - assert.isTrue(elm2.classList.contains(HIGHLIGHTED), 'class'); - assert.isFalse(elm3.classList.contains(HIGHLIGHTED), 'class'); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), true, 'class'); + assert.strictEqual(elm2.classList.contains(HIGHLIGHTED), true, 'class'); + assert.strictEqual(elm3.classList.contains(HIGHLIGHTED), false, 'class'); assert.deepEqual(res, [ [ [undefined, undefined], @@ -4819,7 +4860,7 @@ describe('main', () => { fromIndex: 0, toIndex: 1 }); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null if tab not found', async () => { @@ -4829,7 +4870,7 @@ describe('main', () => { toIndex: 1, windowId: 1 }); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -4848,9 +4889,9 @@ describe('main', () => { toIndex: 0, windowId: 1 }); - assert.isFalse(stubCurrentWin.called, 'not called'); - assert.isFalse(port.postMessage.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(stubCurrentWin.called, false, 'not called'); + assert.strictEqual(port.postMessage.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should remove value', async () => { @@ -4891,8 +4932,8 @@ describe('main', () => { index: 0, pinned: false }), 'tabsTab'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -4935,9 +4976,9 @@ describe('main', () => { pinned: false, url: 'https://example.com' }), 'tabsTab'); - assert.isFalse(stubCurrentWin.called, 'not called'); - assert.isFalse(port.postMessage.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(stubCurrentWin.called, false, 'not called'); + assert.strictEqual(port.postMessage.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should not move', async () => { @@ -4978,9 +5019,9 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['1', '2'], 'not move'); - assert.isFalse(stubCurrentWin.called, 'not called'); - assert.isFalse(port.postMessage.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(stubCurrentWin.called, false, 'not called'); + assert.strictEqual(port.postMessage.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should set value', async () => { @@ -5027,15 +5068,15 @@ describe('main', () => { }); const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); - assert.deepEqual(mjs.sidebar.tabsWaitingToMove, [undefined, { + assert.deepEqual(mjs.sidebar.tabsWaitingToMove, [, { index: 1, tabId: 1, toIndex: 2 }], 'wait'); assert.deepEqual(items, ['1', '2', '3'], 'not move'); - assert.isFalse(stubCurrentWin.called, 'not called'); - assert.isFalse(port.postMessage.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(stubCurrentWin.called, false, 'not called'); + assert.strictEqual(port.postMessage.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should set value', async () => { @@ -5077,15 +5118,15 @@ describe('main', () => { }); const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); - assert.deepEqual(mjs.sidebar.pinnedTabsWaitingToMove, [undefined, { + assert.deepEqual(mjs.sidebar.pinnedTabsWaitingToMove, [, { index: 1, tabId: 1, toIndex: 2 }], 'wait'); assert.deepEqual(items, ['1', '2', '3'], 'not move'); - assert.isFalse(stubCurrentWin.called, 'not called'); - assert.isFalse(port.postMessage.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(stubCurrentWin.called, false, 'not called'); + assert.strictEqual(port.postMessage.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); // pinned @@ -5139,8 +5180,8 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['1', '3', '2'], 'move'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5194,8 +5235,8 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['1', '3', '2'], 'move'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5254,9 +5295,9 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['3', '1', '2'], 'move'); - assert.isNull(mjs.sidebar.tabsWaitingToMove, 'wait'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(mjs.sidebar.tabsWaitingToMove, null, 'wait'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5317,10 +5358,10 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['1', '3', '2'], 'move'); - assert.isTrue(elm.parentNode === elm3.parentNode, 'group'); + assert.deepEqual(elm.parentNode, elm3.parentNode, 'group'); assert.strictEqual(elm3.dataset.group, '', 'value'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5380,10 +5421,10 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['2', '1', '3'], 'move'); - assert.isTrue(elm.parentNode === elm2.parentNode, 'group'); + assert.deepEqual(elm.parentNode, elm2.parentNode, 'group'); assert.strictEqual(elm.dataset.group, '', 'value'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5458,12 +5499,12 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['2', '1', '4', '3'], 'move'); - assert.isTrue(elm.parentNode === elm2.parentNode, 'group'); - assert.isTrue(elm4.parentNode === elm2.parentNode, 'group'); + assert.deepEqual(elm.parentNode, elm2.parentNode, 'group'); + assert.deepEqual(elm4.parentNode, elm2.parentNode, 'group'); assert.strictEqual(elm4.dataset.group, '', 'value'); - assert.isNull(mjs.sidebar.tabsWaitingToMove, 'wait'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(mjs.sidebar.tabsWaitingToMove, null, 'wait'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5524,9 +5565,9 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['1', '3', '2'], 'move'); - assert.isTrue(elm.parentNode === elm3.parentNode, 'parent'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.deepEqual(elm.parentNode, elm3.parentNode, 'parent'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5586,9 +5627,9 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['2', '1', '3'], 'move'); - assert.isTrue(elm.parentNode === elm2.parentNode, 'parent'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.deepEqual(elm.parentNode, elm2.parentNode, 'parent'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5663,11 +5704,11 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['2', '1', '4', '3'], 'move'); - assert.isTrue(elm.parentNode === elm2.parentNode, 'parent'); - assert.isTrue(elm4.parentNode === elm2.parentNode, 'parent'); - assert.isNull(mjs.sidebar.tabsWaitingToMove, 'wait'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.deepEqual(elm.parentNode, elm2.parentNode, 'parent'); + assert.deepEqual(elm4.parentNode, elm2.parentNode, 'parent'); + assert.strictEqual(mjs.sidebar.tabsWaitingToMove, null, 'wait'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5740,10 +5781,10 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['1', '2', '4', '3'], 'move'); - assert.isTrue(elm4.parentNode !== elm2.parentNode, 'parent'); - assert.isTrue(elm4.parentNode !== elm3.parentNode, 'parent'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(elm4.parentNode === elm2.parentNode, false, 'parent'); + assert.strictEqual(elm4.parentNode === elm3.parentNode, false, 'parent'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5816,10 +5857,10 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['2', '3', '1', '4'], 'move'); - assert.isTrue(elm.parentNode !== elm3.parentNode, 'parent'); - assert.isTrue(elm.parentNode !== elm4.parentNode, 'parent'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(elm.parentNode === elm3.parentNode, false, 'parent'); + assert.strictEqual(elm.parentNode === elm4.parentNode, false, 'parent'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5897,12 +5938,12 @@ describe('main', () => { const items = Array.from(body.querySelectorAll(`.${TAB}`)) .map(obj => obj.dataset.tabId); assert.deepEqual(items, ['2', '1', '4', '3'], 'move'); - assert.isTrue(elm.parentNode !== elm2.parentNode, 'parent'); - assert.isTrue(elm.parentNode !== elm4.parentNode, 'parent'); - assert.isTrue(elm4.parentNode !== elm3.parentNode, 'parent'); - assert.isNull(mjs.sidebar.tabsWaitingToMove, 'wait'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(elm.parentNode === elm2.parentNode, false, 'parent'); + assert.strictEqual(elm.parentNode === elm4.parentNode, false, 'parent'); + assert.strictEqual(elm4.parentNode === elm3.parentNode, false, 'parent'); + assert.strictEqual(mjs.sidebar.tabsWaitingToMove, null, 'wait'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, {}, 'result'); }); }); @@ -5937,7 +5978,7 @@ describe('main', () => { isWindowClosing: false, windowId: 2 }); - assert.isTrue(elm.parentNode === body, 'not removed'); + assert.deepEqual(elm.parentNode, body, 'not removed'); }); it('should not remove', async () => { @@ -5950,7 +5991,7 @@ describe('main', () => { isWindowClosing: true, windowId: 1 }); - assert.isTrue(elm.parentNode === body, 'not removed'); + assert.deepEqual(elm.parentNode, body, 'not removed'); }); it('should not remove', async () => { @@ -5963,7 +6004,7 @@ describe('main', () => { isWindowClosing: false, windowId: 1 }); - assert.isTrue(elm.parentNode === body, 'not removed'); + assert.deepEqual(elm.parentNode, body, 'not removed'); }); it('should not remove', async () => { @@ -5976,7 +6017,7 @@ describe('main', () => { isWindowClosing: false, windowId: 1 }); - assert.isFalse(elm.parentNode === body, 'removed'); + assert.strictEqual(elm.parentNode === body, false, 'removed'); assert.strictEqual(body.childElementCount, 0, 'child count'); }); }); @@ -6167,10 +6208,10 @@ describe('main', () => { bottom: 200 }); const res = await func(1, info, tabsTab); - assert.isFalse(elm.classList.contains(DISCARDED), 'class'); + assert.strictEqual(elm.classList.contains(DISCARDED), false, 'class'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tabsTab'); - assert.isFalse(stubWin.called, 'not called'); - assert.isFalse(port.postMessage.called, 'not called'); + assert.strictEqual(stubWin.called, false, 'not called'); + assert.strictEqual(port.postMessage.called, false, 'not called'); assert.deepEqual(res, [], 'result'); }); @@ -6206,11 +6247,11 @@ describe('main', () => { }; mjs.sidebar.windowId = 1; const res = await func(1, info, tabsTab); - assert.isTrue(elm.hasAttribute('hidden'), 'hidden'); - assert.isTrue(elm.classList.contains(DISCARDED), 'class'); + assert.strictEqual(elm.hasAttribute('hidden'), true, 'hidden'); + assert.strictEqual(elm.classList.contains(DISCARDED), true, 'class'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tabsTab'); - assert.isFalse(stubWin.called, 'not called'); - assert.isFalse(port.postMessage.called, 'not called'); + assert.strictEqual(stubWin.called, false, 'not called'); + assert.strictEqual(port.postMessage.called, false, 'not called'); assert.deepEqual(res, [], 'result'); }); @@ -6247,11 +6288,11 @@ describe('main', () => { elm.setAttribute('hidden', 'hidden'); mjs.sidebar.windowId = 1; const res = await func(1, info, tabsTab); - assert.isFalse(elm.hasAttribute('hidden'), 'hidden'); - assert.isFalse(elm.classList.contains(DISCARDED), 'class'); + assert.strictEqual(elm.hasAttribute('hidden'), false, 'hidden'); + assert.strictEqual(elm.classList.contains(DISCARDED), false, 'class'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tabsTab'); - assert.isFalse(stubWin.called, 'not called'); - assert.isFalse(port.postMessage.called, 'not called'); + assert.strictEqual(stubWin.called, false, 'not called'); + assert.strictEqual(port.postMessage.called, false, 'not called'); assert.deepEqual(res, [], 'result'); }); @@ -6287,10 +6328,10 @@ describe('main', () => { }); mjs.sidebar.windowId = 1; const res = await func(1, info, tabsTab); - assert.isTrue(elm.classList.contains(DISCARDED), 'class'); + assert.strictEqual(elm.classList.contains(DISCARDED), true, 'class'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tabsTab'); - assert.isFalse(stubWin.called, 'not called'); - assert.isFalse(port.postMessage.called, 'not called'); + assert.strictEqual(stubWin.called, false, 'not called'); + assert.strictEqual(port.postMessage.called, false, 'not called'); assert.deepEqual(res, [], 'result'); }); @@ -6327,10 +6368,10 @@ describe('main', () => { elm.classList.add(DISCARDED); mjs.sidebar.windowId = 1; const res = await func(1, info, tabsTab); - assert.isFalse(elm.classList.contains(DISCARDED), 'class'); + assert.strictEqual(elm.classList.contains(DISCARDED), false, 'class'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tabsTab'); - assert.isFalse(stubWin.called, 'not called'); - assert.isFalse(port.postMessage.called, 'not called'); + assert.strictEqual(stubWin.called, false, 'not called'); + assert.strictEqual(port.postMessage.called, false, 'not called'); assert.deepEqual(res, [], 'result'); }); @@ -6362,8 +6403,8 @@ describe('main', () => { }; mjs.sidebar.windowId = 1; const res = await func(1, info, tabsTab); - assert.isTrue(stubWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(stubWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, [{}], 'result'); }); @@ -6395,8 +6436,8 @@ describe('main', () => { }; mjs.sidebar.windowId = 1; const res = await func(1, info, tabsTab); - assert.isFalse(stubWin.called, 'not called'); - assert.isFalse(port.postMessage.called, 'not called'); + assert.strictEqual(stubWin.called, false, 'not called'); + assert.strictEqual(port.postMessage.called, false, 'not called'); assert.deepEqual(res, [], 'result'); }); @@ -6441,11 +6482,11 @@ describe('main', () => { bottom: 200 }); const res = await func(1, info, tabsTab); - assert.isFalse(elm.classList.contains(ACTIVE), 'class'); + assert.strictEqual(elm.classList.contains(ACTIVE), false, 'class'); assert.strictEqual(browser.tabs.query.callCount, i, 'not called'); assert.strictEqual(browser.windows.getCurrent.callCount, j, 'not called'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tabsTab'); - assert.isFalse(port.postMessage.called, 'not called'); + assert.strictEqual(port.postMessage.called, false, 'not called'); assert.deepEqual(res, [], 'result'); }); @@ -6497,11 +6538,11 @@ describe('main', () => { }); elm.dataset.tab = JSON.stringify(tabsTab); const res = await func(1, info, tabsTab); - assert.isTrue(elm.classList.contains(ACTIVE), 'class'); + assert.strictEqual(elm.classList.contains(ACTIVE), true, 'class'); assert.strictEqual(browser.tabs.query.callCount, i + 2, 'called'); assert.strictEqual(browser.windows.getCurrent.callCount, j + 1, 'called'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tabsTab'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, [undefined, {}], 'result'); }); @@ -6559,11 +6600,11 @@ describe('main', () => { elm.parentNode.appendChild(tab); elm.parentNode.classList.add(CLASS_TAB_GROUP); const res = await func(1, info, tabsTab); - assert.isTrue(elm.classList.contains(ACTIVE), 'class'); + assert.strictEqual(elm.classList.contains(ACTIVE), true, 'class'); assert.strictEqual(browser.tabs.query.callCount, i + 2, 'called'); assert.strictEqual(browser.windows.getCurrent.callCount, j + 2, 'called'); assert.deepEqual(JSON.parse(elm.dataset.tab), tabsTab, 'tabsTab'); - assert.isTrue(port.postMessage.calledTwice, 'called'); + assert.strictEqual(port.postMessage.callCount, 2, 'called'); assert.deepEqual(res, [{}, undefined, {}], 'result'); }); @@ -6601,10 +6642,10 @@ describe('main', () => { }); const pinned = document.getElementById(PINNED); const res = await func(1, info, tabsTab); - assert.isTrue(elm.classList.contains(PINNED), 'class'); - assert.isTrue(elm.parentNode === pinned, 'parent'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(elm.classList.contains(PINNED), true, 'class'); + assert.deepEqual(elm.parentNode, pinned, 'parent'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, [undefined, {}], 'result'); }); @@ -6649,10 +6690,10 @@ describe('main', () => { }); const pinned = document.getElementById(PINNED); const res = await func(1, info, tabsTab); - assert.isFalse(elm.classList.contains(PINNED), 'class'); - assert.isTrue(elm.parentNode === pinned.nextElementSibling, 'parent'); - assert.isTrue(stubCurrentWin.calledOnce, 'called'); - assert.isTrue(port.postMessage.calledOnce, 'called'); + assert.strictEqual(elm.classList.contains(PINNED), false, 'class'); + assert.deepEqual(elm.parentNode, pinned.nextElementSibling, 'parent'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called'); assert.deepEqual(res, [{}], 'result'); }); @@ -6684,7 +6725,7 @@ describe('main', () => { }); const audio = elm.querySelector('.tab-audio'); const res = await func(1, info, tabsTab); - assert.isTrue(audio.classList.contains(AUDIBLE), 'audible'); + assert.strictEqual(audio.classList.contains(AUDIBLE), true, 'audible'); assert.deepEqual(res, [undefined, undefined], 'result'); }); @@ -6716,7 +6757,7 @@ describe('main', () => { }); const audio = elm.querySelector('.tab-audio'); const res = await func(1, info, tabsTab); - assert.isFalse(audio.classList.contains(AUDIBLE), 'audible'); + assert.strictEqual(audio.classList.contains(AUDIBLE), false, 'audible'); assert.deepEqual(res, [undefined, undefined], 'result'); }); }); @@ -8797,7 +8838,7 @@ describe('main', () => { assert.strictEqual(browser.tabs.get.callCount, i + 1, 'called tabs get'); assert.strictEqual(browser.windows.getCurrent.callCount, j + 2, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, [{}], 'result'); }); @@ -8886,7 +8927,7 @@ describe('main', () => { assert.strictEqual(browser.tabs.move.callCount, j + 2, 'called move'); assert.strictEqual(browser.windows.getCurrent.callCount, k + 2, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, [{}], 'result'); }); @@ -8975,7 +9016,7 @@ describe('main', () => { assert.strictEqual(browser.tabs.move.callCount, j + 2, 'called move'); assert.strictEqual(browser.windows.getCurrent.callCount, k + 2, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, [{}], 'result'); }); @@ -9248,7 +9289,7 @@ describe('main', () => { assert.strictEqual(browser.tabs.move.callCount, j + 2, 'called move'); assert.strictEqual(browser.windows.getCurrent.callCount, k + 2, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, [{}], 'result'); }); @@ -9323,7 +9364,7 @@ describe('main', () => { assert.strictEqual(browser.tabs.move.callCount, j + 1, 'called move'); assert.strictEqual(browser.windows.getCurrent.callCount, k + 2, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, [{}], 'result'); }); @@ -9398,7 +9439,7 @@ describe('main', () => { assert.strictEqual(browser.tabs.move.callCount, j + 1, 'called move'); assert.strictEqual(browser.windows.getCurrent.callCount, k + 2, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, [{}], 'result'); }); @@ -9426,7 +9467,7 @@ describe('main', () => { menuItemId: TAB_GROUP_LABEL_SHOW }; const res = await func(info); - assert.isTrue(heading.hidden, 'hidden'); + assert.strictEqual(heading.hidden, true, 'hidden'); assert.deepEqual(res, [[undefined]], 'result'); }); @@ -9455,7 +9496,7 @@ describe('main', () => { menuItemId: TAB_GROUP_LABEL_SHOW }; const res = await func(info); - assert.isFalse(heading.hidden, 'hidden'); + assert.strictEqual(heading.hidden, false, 'hidden'); assert.deepEqual(res, [[undefined, child]], 'result'); }); @@ -9535,7 +9576,7 @@ describe('main', () => { 'called get message'); assert.strictEqual(browser.windows.getCurrent.callCount, k + 2, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, [{}], 'result'); }); @@ -9617,7 +9658,7 @@ describe('main', () => { 'called get message'); assert.strictEqual(browser.windows.getCurrent.callCount, k + 2, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, [{}], 'result'); }); @@ -9699,7 +9740,7 @@ describe('main', () => { 'called get message'); assert.strictEqual(browser.windows.getCurrent.callCount, k + 2, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, [{}], 'result'); }); @@ -9780,7 +9821,7 @@ describe('main', () => { 'called get message'); assert.strictEqual(browser.windows.getCurrent.callCount, k + 2, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, [{}], 'result'); }); @@ -9869,7 +9910,7 @@ describe('main', () => { 'called get message'); assert.strictEqual(browser.windows.getCurrent.callCount, k + 2, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, [{}], 'result'); }); @@ -10117,7 +10158,7 @@ describe('main', () => { it('should throw', async () => { await func().catch(e => { - assert.instanceOf(e, TypeError, 'instance'); + assert.strictEqual(e instanceof TypeError, true, 'instance'); assert.strictEqual(e.message, 'Expected String but got Undefined.', 'message'); }); @@ -11547,7 +11588,7 @@ describe('main', () => { browser.tabs.query.resolves([]); browser.menus.update.resolves(undefined); const res = await func(elm); - assert.isNull(mjs.sidebar.duplicatedTabs, 'duped tabs'); + assert.strictEqual(mjs.sidebar.duplicatedTabs, null, 'duped tabs'); assert.strictEqual(browser.tabs.get.callCount, i + 1, 'called get'); assert.strictEqual(browser.menus.update.callCount, j + 49, 'called update'); @@ -12062,7 +12103,7 @@ describe('main', () => { assert.strictEqual(browser.storage.local.set.callCount, i + 1, 'called'); assert.strictEqual(browser.runtime.sendMessage.callCount, j + 1, 'called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -12086,7 +12127,7 @@ describe('main', () => { assert.strictEqual(browser.storage.local.set.callCount, i + 1, 'called'); assert.strictEqual(browser.runtime.sendMessage.callCount, j + 1, 'called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -12117,7 +12158,7 @@ describe('main', () => { assert.strictEqual(browser.runtime.sendMessage.callCount, j, 'not called'); assert.strictEqual(browser.theme.getCurrent.callCount, k, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -12148,7 +12189,7 @@ describe('main', () => { assert.strictEqual(browser.runtime.sendMessage.callCount, j, 'not called'); assert.strictEqual(browser.theme.getCurrent.callCount, k, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -12181,7 +12222,7 @@ describe('main', () => { assert.strictEqual(browser.runtime.sendMessage.callCount, j, 'not called'); assert.strictEqual(browser.theme.getCurrent.callCount, k + 1, 'called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -12214,7 +12255,7 @@ describe('main', () => { assert.strictEqual(browser.runtime.sendMessage.callCount, j, 'not called'); assert.strictEqual(browser.theme.getCurrent.callCount, k, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); }); @@ -12243,7 +12284,7 @@ describe('main', () => { const res = await func(); assert.strictEqual(browser.runtime.sendMessage.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -12262,7 +12303,7 @@ describe('main', () => { const res = await func(true); assert.strictEqual(browser.runtime.sendMessage.callCount, i + 1, 'called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -12282,7 +12323,7 @@ describe('main', () => { const res = await func(true); assert.strictEqual(browser.runtime.sendMessage.callCount, i + 1, 'called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); }); @@ -12769,7 +12810,7 @@ describe('main', () => { tabId: 1, context: 'tab' }).callCount, i, 'not called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -12792,7 +12833,7 @@ describe('main', () => { tabId: 1, context: 'tab' }).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -12817,7 +12858,7 @@ describe('main', () => { tabId: 1, context: 'tab' }).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -12847,9 +12888,9 @@ describe('main', () => { stopPropagation: sinon.stub() }; const res = func(evt); - assert.isTrue(evt.preventDefault.notCalled, 'not called'); - assert.isTrue(evt.stopPropagation.notCalled, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(evt.preventDefault.called, false, 'not called'); + assert.strictEqual(evt.stopPropagation.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should not prevent default', () => { @@ -12865,9 +12906,9 @@ describe('main', () => { stopPropagation: sinon.stub() }; const res = func(evt); - assert.isTrue(evt.preventDefault.notCalled, 'not called'); - assert.isTrue(evt.stopPropagation.notCalled, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(evt.preventDefault.called, false, 'not called'); + assert.strictEqual(evt.stopPropagation.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should not prevent default', async () => { @@ -12883,9 +12924,9 @@ describe('main', () => { stopPropagation: sinon.stub() }; const res = await func(evt); - assert.isTrue(evt.preventDefault.notCalled, 'not called'); - assert.isTrue(evt.stopPropagation.notCalled, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(evt.preventDefault.called, false, 'not called'); + assert.strictEqual(evt.stopPropagation.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should not prevent default', async () => { @@ -12902,9 +12943,9 @@ describe('main', () => { stopPropagation: sinon.stub() }; const res = await func(evt); - assert.isTrue(evt.preventDefault.notCalled, 'not called'); - assert.isTrue(evt.stopPropagation.notCalled, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(evt.preventDefault.called, false, 'not called'); + assert.strictEqual(evt.stopPropagation.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should prevent default and call function', async () => { @@ -12936,10 +12977,10 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(stubActivate.callCount, i + 1, 'called'); - assert.isTrue(evt.preventDefault.calledOnce, 'called'); - assert.isTrue(evt.stopPropagation.notCalled, 'not called'); - assert.isTrue(browser.tabs.query.calledOnce, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(evt.preventDefault.calledOnce, true, 'called'); + assert.strictEqual(evt.stopPropagation.called, false, 'not called'); + assert.strictEqual(browser.tabs.query.calledOnce, true, 'called'); + assert.strictEqual(res, undefined, 'result'); }); it('should prevent default and call function', async () => { @@ -12972,10 +13013,10 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(stubActivate.callCount, i + 1, 'called'); - assert.isTrue(evt.preventDefault.calledOnce, 'called'); - assert.isTrue(evt.stopPropagation.notCalled, 'not called'); - assert.isTrue(browser.tabs.query.calledOnce, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(evt.preventDefault.calledOnce, true, 'called'); + assert.strictEqual(evt.stopPropagation.called, false, 'not called'); + assert.strictEqual(browser.tabs.query.calledOnce, true, 'called'); + assert.strictEqual(res, undefined, 'result'); }); it('should prevent default and call function', async () => { @@ -13007,10 +13048,10 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(stubActivate.callCount, i + 1, 'called'); - assert.isTrue(evt.preventDefault.calledOnce, 'called'); - assert.isTrue(evt.stopPropagation.notCalled, 'not called'); - assert.isTrue(browser.tabs.query.calledOnce, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(evt.preventDefault.calledOnce, true, 'called'); + assert.strictEqual(evt.stopPropagation.called, false, 'not called'); + assert.strictEqual(browser.tabs.query.calledOnce, true, 'called'); + assert.strictEqual(res, undefined, 'result'); }); it('should prevent default and call function', async () => { @@ -13043,10 +13084,10 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(stubActivate.callCount, i + 1, 'called'); - assert.isTrue(evt.preventDefault.calledOnce, 'called'); - assert.isTrue(evt.stopPropagation.notCalled, 'not called'); - assert.isTrue(browser.tabs.query.calledOnce, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(evt.preventDefault.calledOnce, true, 'called'); + assert.strictEqual(evt.stopPropagation.called, false, 'not called'); + assert.strictEqual(browser.tabs.query.calledOnce, true, 'called'); + assert.strictEqual(res, undefined, 'result'); }); it('should not call function', async () => { @@ -13079,10 +13120,10 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(stubActivate.callCount, i, 'not called'); - assert.isTrue(evt.preventDefault.notCalled, 'not called'); - assert.isTrue(evt.stopPropagation.notCalled, 'not called'); - assert.isTrue(browser.tabs.query.notCalled, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(evt.preventDefault.called, false, 'not called'); + assert.strictEqual(evt.stopPropagation.called, false, 'not called'); + assert.strictEqual(browser.tabs.query.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -13115,10 +13156,10 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(stubActivate.callCount, i, 'not called'); - assert.isTrue(evt.preventDefault.notCalled, 'not called'); - assert.isTrue(evt.stopPropagation.notCalled, 'not called'); - assert.isTrue(browser.tabs.query.notCalled, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(evt.preventDefault.called, false, 'not called'); + assert.strictEqual(evt.stopPropagation.called, false, 'not called'); + assert.strictEqual(browser.tabs.query.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -13151,10 +13192,10 @@ describe('main', () => { }; const res = await func(evt); assert.strictEqual(stubActivate.callCount, i + 1, 'called'); - assert.isTrue(evt.preventDefault.calledOnce, 'called'); - assert.isTrue(evt.stopPropagation.calledOnce, 'called'); - assert.isTrue(browser.tabs.query.calledOnce, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(evt.preventDefault.calledOnce, true, 'called'); + assert.strictEqual(evt.stopPropagation.calledOnce, true, 'called'); + assert.strictEqual(browser.tabs.query.calledOnce, true, 'called'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -13334,7 +13375,7 @@ describe('main', () => { const res = await func(); assert.strictEqual(port.postMessage.callCount, i, 'not called'); assert.strictEqual(browser.windows.getCurrent.callCount, j, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -13355,7 +13396,7 @@ describe('main', () => { const res = await func(); assert.strictEqual(port.postMessage.callCount, i, 'not called'); assert.strictEqual(browser.windows.getCurrent.callCount, j + 1, 'called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -13376,7 +13417,7 @@ describe('main', () => { const res = await func(); assert.strictEqual(port.postMessage.callCount, i, 'not called'); assert.strictEqual(browser.windows.getCurrent.callCount, j + 1, 'called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -13397,7 +13438,7 @@ describe('main', () => { const res = await func(); assert.strictEqual(port.postMessage.callCount, i, 'not called'); assert.strictEqual(browser.windows.getCurrent.callCount, j + 1, 'called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -13510,14 +13551,14 @@ describe('main', () => { const body = document.querySelector('body'); const res = await func(THEME_UI_SCROLLBAR_NARROW, { checked: true }, true); - assert.isTrue(body.classList.contains(CLASS_NARROW), 'set'); + assert.strictEqual(body.classList.contains(CLASS_NARROW), true, 'set'); assert.deepEqual(res, [undefined], 'result'); }); it('should set variable', async () => { const body = document.querySelector('body'); const res = await func(THEME_UI_TAB_COMPACT, { checked: true }, true); - assert.isTrue(body.classList.contains(CLASS_COMPACT), 'set'); + assert.strictEqual(body.classList.contains(CLASS_COMPACT), true, 'set'); assert.deepEqual(res, [undefined], 'result'); }); @@ -13525,7 +13566,8 @@ describe('main', () => { const body = document.querySelector('body'); const res = await func(THEME_UI_TAB_GROUP_NARROW, { checked: true }, true); - assert.isTrue(body.classList.contains(CLASS_NARROW_TAB_GROUP), 'set'); + assert.strictEqual(body.classList.contains(CLASS_NARROW_TAB_GROUP), + true, 'set'); assert.deepEqual(res, [undefined], 'result'); }); @@ -13564,7 +13606,7 @@ describe('main', () => { const i = browser.storage.local.get.callCount; const res = await func(USER_CSS_USE, { checked: true }); assert.strictEqual(browser.storage.local.get.callCount, i, 'not called'); - assert.isTrue(mjs.userOpts.get(USER_CSS_USE), 'value'); + assert.strictEqual(mjs.userOpts.get(USER_CSS_USE), true, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); @@ -13578,7 +13620,7 @@ describe('main', () => { const i = browser.storage.local.get.callCount; const res = await func(USER_CSS_USE, { checked: false }, true); assert.strictEqual(browser.storage.local.get.callCount, i, 'not called'); - assert.isFalse(mjs.userOpts.get(USER_CSS_USE), 'value'); + assert.strictEqual(mjs.userOpts.get(USER_CSS_USE), false, 'value'); assert.deepEqual(res, [mjs.userOpts, undefined], 'result'); }); @@ -13591,7 +13633,7 @@ describe('main', () => { const i = browser.storage.local.get.callCount; const res = await func(USER_CSS_USE, { checked: true }, true); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isTrue(mjs.userOpts.get(USER_CSS_USE), 'value'); + assert.strictEqual(mjs.userOpts.get(USER_CSS_USE), true, 'value'); assert.deepEqual(res, [mjs.userOpts, undefined], 'result'); }); @@ -13604,7 +13646,7 @@ describe('main', () => { assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); assert.strictEqual(browser.runtime.sendMessage.callCount, j, 'not called'); - assert.isTrue(mjs.userOpts.get(FRAME_COLOR_USE), 'opts'); + assert.strictEqual(mjs.userOpts.get(FRAME_COLOR_USE), true, 'opts'); assert.deepEqual(res, [], 'result'); }); @@ -13635,7 +13677,7 @@ describe('main', () => { }).callCount, i + 1, 'called'); assert.strictEqual(browser.runtime.sendMessage.callCount, j + 1, 'called'); - assert.isTrue(mjs.userOpts.get(FRAME_COLOR_USE), 'opts'); + assert.strictEqual(mjs.userOpts.get(FRAME_COLOR_USE), true, 'opts'); assert.deepEqual(res, [null], 'result'); }); @@ -13656,7 +13698,7 @@ describe('main', () => { assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); assert.strictEqual(browser.runtime.sendMessage.callCount, j, 'not called'); - assert.isFalse(mjs.userOpts.get(THEME_AUTO), 'map'); + assert.strictEqual(mjs.userOpts.get(THEME_AUTO), false, 'map'); assert.deepEqual(res, [], 'result'); }); @@ -13677,7 +13719,7 @@ describe('main', () => { assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); assert.strictEqual(browser.runtime.sendMessage.callCount, j, 'not called'); - assert.isUndefined(mjs.userOpts.get(THEME_AUTO), 'map'); + assert.strictEqual(mjs.userOpts.get(THEME_AUTO), undefined, 'map'); assert.deepEqual(res, [], 'result'); }); @@ -13708,7 +13750,7 @@ describe('main', () => { }).callCount, i + 1, 'called'); assert.strictEqual(browser.runtime.sendMessage.callCount, j + 1, 'called'); - assert.isTrue(mjs.userOpts.get(THEME_AUTO), 'map'); + assert.strictEqual(mjs.userOpts.get(THEME_AUTO), true, 'map'); assert.deepEqual(res, [null], 'result'); }); @@ -13734,7 +13776,7 @@ describe('main', () => { assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); assert.strictEqual(browser.runtime.sendMessage.callCount, j, 'not called'); - assert.isFalse(mjs.userOpts.get(THEME_CUSTOM), 'map'); + assert.strictEqual(mjs.userOpts.get(THEME_CUSTOM), false, 'map'); assert.deepEqual(res, [], 'result'); }); @@ -13760,7 +13802,7 @@ describe('main', () => { assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); assert.strictEqual(browser.runtime.sendMessage.callCount, j, 'not called'); - assert.isUndefined(mjs.userOpts.get(THEME_CUSTOM), 'map'); + assert.strictEqual(mjs.userOpts.get(THEME_CUSTOM), undefined, 'map'); assert.deepEqual(res, [], 'result'); }); @@ -13791,7 +13833,7 @@ describe('main', () => { }).callCount, i + 1, 'called'); assert.strictEqual(browser.runtime.sendMessage.callCount, j + 1, 'called'); - assert.isUndefined(mjs.userOpts.get(THEME_AUTO), 'map'); + assert.strictEqual(mjs.userOpts.get(THEME_AUTO), undefined, 'map'); assert.deepEqual(res, [null], 'result'); }); @@ -13882,7 +13924,8 @@ describe('main', () => { const j = browser.storage.local.set.callCount; browser.browserSettings.closeTabsByDoubleClick.get.returns({}); const res = await func(BROWSER_SETTINGS_READ, { checked: false }); - assert.isFalse(mjs.userOpts.get(BROWSER_SETTINGS_READ), 'value'); + assert.strictEqual(mjs.userOpts.get(BROWSER_SETTINGS_READ), false, + 'value'); assert.strictEqual( browser.browserSettings.closeTabsByDoubleClick.get.callCount, i, 'not called' @@ -13896,7 +13939,8 @@ describe('main', () => { const j = browser.storage.local.set.callCount; browser.browserSettings.closeTabsByDoubleClick.get.returns({}); const res = await func(BROWSER_SETTINGS_READ, { checked: true }); - assert.isTrue(mjs.userOpts.get(BROWSER_SETTINGS_READ), 'value'); + assert.strictEqual(mjs.userOpts.get(BROWSER_SETTINGS_READ), true, + 'value'); assert.strictEqual( browser.browserSettings.closeTabsByDoubleClick.get.callCount, i, 'not called' @@ -13910,7 +13954,8 @@ describe('main', () => { const j = browser.storage.local.set.callCount; browser.browserSettings.closeTabsByDoubleClick.get.returns({}); const res = await func(BROWSER_SETTINGS_READ, { checked: true }, true); - assert.isTrue(mjs.userOpts.get(BROWSER_SETTINGS_READ), 'value'); + assert.strictEqual(mjs.userOpts.get(BROWSER_SETTINGS_READ), true, + 'value'); assert.strictEqual( browser.browserSettings.closeTabsByDoubleClick.get.callCount, i + 1, 'called' @@ -13933,7 +13978,7 @@ describe('main', () => { checked: false, value: 'bold' }, true); - assert.isFalse(mjs.userOpts.has(FONT_ACTIVE), 'value'); + assert.strictEqual(mjs.userOpts.has(FONT_ACTIVE), false, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); @@ -13960,7 +14005,7 @@ describe('main', () => { checked: false, value: 'normal' }, true); - assert.isFalse(mjs.userOpts.has(FONT_ACTIVE), 'value'); + assert.strictEqual(mjs.userOpts.has(FONT_ACTIVE), false, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); @@ -13981,63 +14026,63 @@ describe('main', () => { it('should set variable', async () => { const res = await func(TABS_CLOSE_DBLCLICK, { checked: true }); - assert.isTrue(mjs.userOpts.get(TABS_CLOSE_DBLCLICK), 'value'); + assert.strictEqual(mjs.userOpts.get(TABS_CLOSE_DBLCLICK), true, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { const res = await func(TABS_CLOSE_DBLCLICK, { checked: false }); - assert.isFalse(mjs.userOpts.get(TABS_CLOSE_DBLCLICK), 'value'); + assert.strictEqual(mjs.userOpts.get(TABS_CLOSE_DBLCLICK), false, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { const res = await func(TABS_CLOSE_DBLCLICK, { checked: true }, true); - assert.isTrue(mjs.userOpts.get(TABS_CLOSE_DBLCLICK), 'value'); + assert.strictEqual(mjs.userOpts.get(TABS_CLOSE_DBLCLICK), true, 'value'); assert.deepEqual(res, [mjs.userOpts, []], 'result'); }); it('should set variable', async () => { const res = await func(TABS_CLOSE_MDLCLICK_PREVENT, { checked: true }); - assert.isFalse(mjs.userOpts.get(TABS_CLOSE_MDLCLICK), 'value'); + assert.strictEqual(mjs.userOpts.get(TABS_CLOSE_MDLCLICK), false, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { const res = await func(TABS_CLOSE_MDLCLICK_PREVENT, { checked: false }); - assert.isTrue(mjs.userOpts.get(TABS_CLOSE_MDLCLICK), 'value'); + assert.strictEqual(mjs.userOpts.get(TABS_CLOSE_MDLCLICK), true, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { const res = await func(TABS_CLOSE_MDLCLICK_PREVENT, { checked: true }, true); - assert.isFalse(mjs.userOpts.get(TABS_CLOSE_MDLCLICK), 'value'); + assert.strictEqual(mjs.userOpts.get(TABS_CLOSE_MDLCLICK), false, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { const res = await func(TAB_GROUP_ENABLE, { checked: true }); - assert.isTrue(mjs.userOpts.get(TAB_GROUP_ENABLE), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_ENABLE), true, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { const res = await func(TAB_GROUP_ENABLE, { checked: false }); - assert.isFalse(mjs.userOpts.get(TAB_GROUP_ENABLE), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_ENABLE), false, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { const res = await func(TAB_GROUP_ENABLE, { checked: true }, true); - assert.isTrue(mjs.userOpts.get(TAB_GROUP_ENABLE), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_ENABLE), true, 'value'); assert.deepEqual(res, [mjs.userOpts, []], 'result'); }); it('should set variable', async () => { const res = await func(TAB_GROUP_EXPAND_COLLAPSE_OTHER, { checked: true }); - assert.isTrue(mjs.userOpts.get(TAB_GROUP_EXPAND_COLLAPSE_OTHER), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_EXPAND_COLLAPSE_OTHER), true, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); @@ -14045,15 +14090,16 @@ describe('main', () => { mjs.userOpts.set(TAB_GROUP_EXPAND_COLLAPSE_OTHER, true); const res = await func(TAB_GROUP_EXPAND_COLLAPSE_OTHER, { checked: false }); - assert.isFalse(mjs.userOpts.get(TAB_GROUP_EXPAND_COLLAPSE_OTHER), - 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_EXPAND_COLLAPSE_OTHER), + false, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { const res = await func(TAB_GROUP_EXPAND_COLLAPSE_OTHER, { checked: true }, true); - assert.isTrue(mjs.userOpts.get(TAB_GROUP_EXPAND_COLLAPSE_OTHER), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_EXPAND_COLLAPSE_OTHER), + true, 'value'); assert.deepEqual(res, [mjs.userOpts, []], 'result'); }); @@ -14064,8 +14110,10 @@ describe('main', () => { body.appendChild(elm); const res = await func(TAB_GROUP_EXPAND_EXCLUDE_PINNED, { checked: true }); - assert.isTrue(mjs.userOpts.get(TAB_GROUP_EXPAND_EXCLUDE_PINNED), 'value'); - assert.isFalse(elm.classList.contains(CLASS_COLLAPSE_AUTO)); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_EXPAND_EXCLUDE_PINNED), + true, 'value'); + assert.strictEqual(elm.classList.contains(CLASS_COLLAPSE_AUTO), false, + 'class'); assert.deepEqual(res, [mjs.userOpts, undefined], 'result'); }); @@ -14076,9 +14124,10 @@ describe('main', () => { body.appendChild(elm); const res = await func(TAB_GROUP_EXPAND_EXCLUDE_PINNED, { checked: false }); - assert.isFalse(mjs.userOpts.get(TAB_GROUP_EXPAND_EXCLUDE_PINNED), - 'value'); - assert.isTrue(elm.classList.contains(CLASS_COLLAPSE_AUTO)); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_EXPAND_EXCLUDE_PINNED), + false, 'value'); + assert.strictEqual(elm.classList.contains(CLASS_COLLAPSE_AUTO), true, + 'class'); assert.deepEqual(res, [mjs.userOpts, undefined], 'result'); }); @@ -14089,8 +14138,10 @@ describe('main', () => { body.appendChild(elm); const res = await func(TAB_GROUP_EXPAND_EXCLUDE_PINNED, { checked: true }, true); - assert.isTrue(mjs.userOpts.get(TAB_GROUP_EXPAND_EXCLUDE_PINNED), 'value'); - assert.isFalse(elm.classList.contains(CLASS_COLLAPSE_AUTO)); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_EXPAND_EXCLUDE_PINNED), + true, 'value'); + assert.strictEqual(elm.classList.contains(CLASS_COLLAPSE_AUTO), false, + 'class'); assert.deepEqual(res, [mjs.userOpts, undefined], 'result'); }); @@ -14101,67 +14152,72 @@ describe('main', () => { body.appendChild(elm); const res = await func(TAB_GROUP_EXPAND_EXCLUDE_PINNED, { checked: false }, true); - assert.isFalse(mjs.userOpts.get(TAB_GROUP_EXPAND_EXCLUDE_PINNED), - 'value'); - assert.isTrue(elm.classList.contains(CLASS_COLLAPSE_AUTO)); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_EXPAND_EXCLUDE_PINNED), + false, 'value'); + assert.strictEqual(elm.classList.contains(CLASS_COLLAPSE_AUTO), true, + 'class'); assert.deepEqual(res, [mjs.userOpts, undefined], 'result'); }); it('should set variable', async () => { const res = await func(TAB_GROUP_NEW_TAB_AT_END, { checked: true }); - assert.isTrue(mjs.userOpts.get(TAB_GROUP_NEW_TAB_AT_END), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_NEW_TAB_AT_END), true, + 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { mjs.userOpts.set(TAB_GROUP_NEW_TAB_AT_END, true); const res = await func(TAB_GROUP_NEW_TAB_AT_END, { checked: false }); - assert.isFalse(mjs.userOpts.get(TAB_GROUP_NEW_TAB_AT_END), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_NEW_TAB_AT_END), false, + 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { const res = await func(TAB_SWITCH_SCROLL, { checked: true }); - assert.isTrue(mjs.userOpts.get(TAB_SWITCH_SCROLL), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_SWITCH_SCROLL), true, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { mjs.userOpts.set(TAB_SWITCH_SCROLL, true); const res = await func(TAB_SWITCH_SCROLL, { checked: false }); - assert.isFalse(mjs.userOpts.get(TAB_SWITCH_SCROLL), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_SWITCH_SCROLL), false, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { const res = await func(TAB_SWITCH_SCROLL_ALWAYS, { checked: true }); - assert.isTrue(mjs.userOpts.get(TAB_SWITCH_SCROLL_ALWAYS), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_SWITCH_SCROLL_ALWAYS), true, + 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { mjs.userOpts.set(TAB_SWITCH_SCROLL_ALWAYS, true); const res = await func(TAB_SWITCH_SCROLL_ALWAYS, { checked: false }); - assert.isFalse(mjs.userOpts.get(TAB_SWITCH_SCROLL_ALWAYS), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_SWITCH_SCROLL_ALWAYS), false, + 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { const res = await func(SCROLL_DIR_INVERT, { checked: true }); - assert.isTrue(mjs.userOpts.get(SCROLL_DIR_INVERT), 'value'); + assert.strictEqual(mjs.userOpts.get(SCROLL_DIR_INVERT), true, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { mjs.userOpts.set(SCROLL_DIR_INVERT, true); const res = await func(SCROLL_DIR_INVERT, { checked: false }); - assert.isFalse(mjs.userOpts.get(SCROLL_DIR_INVERT), 'value'); + assert.strictEqual(mjs.userOpts.get(SCROLL_DIR_INVERT), false, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); it('should set variable', async () => { const res = await func(SCROLL_DIR_INVERT, { checked: true }, true); - assert.isTrue(mjs.userOpts.get(SCROLL_DIR_INVERT), 'value'); + assert.strictEqual(mjs.userOpts.get(SCROLL_DIR_INVERT), true, 'value'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); @@ -14174,8 +14230,10 @@ describe('main', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(NEW_TAB_SEPARATOR_SHOW, { checked: true }); - assert.isTrue(mjs.userOpts.get(NEW_TAB_SEPARATOR_SHOW), 'value'); - assert.isFalse(elm.classList.contains(CLASS_SEPARATOR_SHOW), 'class'); + assert.strictEqual(mjs.userOpts.get(NEW_TAB_SEPARATOR_SHOW), true, + 'value'); + assert.strictEqual(elm.classList.contains(CLASS_SEPARATOR_SHOW), false, + 'class'); assert.deepEqual(res, [mjs.userOpts], 'result'); }); @@ -14188,8 +14246,10 @@ describe('main', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(NEW_TAB_SEPARATOR_SHOW, { checked: true }, true); - assert.isTrue(mjs.userOpts.get(NEW_TAB_SEPARATOR_SHOW), 'value'); - assert.isTrue(elm.classList.contains(CLASS_SEPARATOR_SHOW), 'class'); + assert.strictEqual(mjs.userOpts.get(NEW_TAB_SEPARATOR_SHOW), true, + 'value'); + assert.strictEqual(elm.classList.contains(CLASS_SEPARATOR_SHOW), true, + 'class'); assert.deepEqual(res, [mjs.userOpts, undefined], 'result'); }); @@ -14202,8 +14262,10 @@ describe('main', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(NEW_TAB_SEPARATOR_SHOW, { checked: false }, true); - assert.isFalse(mjs.userOpts.get(NEW_TAB_SEPARATOR_SHOW), 'value'); - assert.isFalse(elm.classList.contains(CLASS_SEPARATOR_SHOW), 'class'); + assert.strictEqual(mjs.userOpts.get(NEW_TAB_SEPARATOR_SHOW), false, + 'value'); + assert.strictEqual(elm.classList.contains(CLASS_SEPARATOR_SHOW), false, + 'class'); assert.deepEqual(res, [mjs.userOpts, undefined], 'result'); }); }); @@ -14239,7 +14301,8 @@ describe('main', () => { } }); assert.strictEqual(mjs.userOpts.size, 1, 'size'); - assert.isTrue(mjs.userOpts.get(TAB_GROUP_NEW_TAB_AT_END), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_NEW_TAB_AT_END), true, + 'value'); assert.deepEqual(res, [[mjs.userOpts]], 'result'); }); @@ -14250,7 +14313,8 @@ describe('main', () => { } }, 'local'); assert.strictEqual(mjs.userOpts.size, 1, 'size'); - assert.isTrue(mjs.userOpts.get(TAB_GROUP_NEW_TAB_AT_END), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_NEW_TAB_AT_END), true, + 'value'); assert.deepEqual(res, [[mjs.userOpts]], 'result'); }); @@ -14263,7 +14327,8 @@ describe('main', () => { } }); assert.strictEqual(mjs.userOpts.size, 1, 'size'); - assert.isTrue(mjs.userOpts.get(TAB_GROUP_NEW_TAB_AT_END), 'value'); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_NEW_TAB_AT_END), true, + 'value'); assert.deepEqual(res, [[mjs.userOpts]], 'result'); }); @@ -14276,9 +14341,12 @@ describe('main', () => { } }, 'local', true); assert.strictEqual(mjs.userOpts.size, 3, 'size'); - assert.isTrue(mjs.userOpts.has(TABS_CLOSE_MDLCLICK), 'default option'); - assert.isTrue(mjs.userOpts.has(TAB_GROUP_ENABLE), 'default option'); - assert.isTrue(mjs.userOpts.get(TAB_GROUP_NEW_TAB_AT_END), 'value'); + assert.strictEqual(mjs.userOpts.has(TABS_CLOSE_MDLCLICK), true, + 'default option'); + assert.strictEqual(mjs.userOpts.has(TAB_GROUP_ENABLE), true, + 'default option'); + assert.strictEqual(mjs.userOpts.get(TAB_GROUP_NEW_TAB_AT_END), true, + 'value'); assert.deepEqual(res, [[mjs.userOpts]], 'result'); }); }); @@ -14312,9 +14380,9 @@ describe('main', () => { ]); await func(); assert.strictEqual(browser.tabs.query.callCount, i + 1, 'called'); - assert.isTrue(elm.classList.contains(HIGHLIGHTED), 'class'); - assert.isTrue(elm2.classList.contains(HIGHLIGHTED), 'class'); - assert.isFalse(elm3.classList.contains(HIGHLIGHTED), 'class'); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), true, 'class'); + assert.strictEqual(elm2.classList.contains(HIGHLIGHTED), true, 'class'); + assert.strictEqual(elm3.classList.contains(HIGHLIGHTED), false, 'class'); }); }); @@ -14894,8 +14962,9 @@ describe('main', () => { assert.strictEqual(browser.windows.getCurrent.callCount, j + 1, 'called windows get current'); assert.strictEqual(pinned.childElementCount, 4, 'pinned'); - assert.isFalse(pinned.classList.contains(CLASS_TAB_COLLAPSED), 'false'); - assert.isTrue(pinned.querySelector(`.${CLASS_HEADING}`).hidden, + assert.strictEqual(pinned.classList.contains(CLASS_TAB_COLLAPSED), + false, 'class'); + assert.strictEqual(pinned.querySelector(`.${CLASS_HEADING}`).hidden, true, 'heading'); assert.strictEqual(sect1.childElementCount, 1, 'empty section'); assert.strictEqual(sect2.childElementCount, 1, 'empty section'); @@ -15061,9 +15130,10 @@ describe('main', () => { assert.strictEqual(browser.windows.getCurrent.callCount, j + 1, 'called windows get current'); assert.strictEqual(pinned.childElementCount, 4, 'pinned'); - assert.isFalse(pinned.classList.contains(CLASS_TAB_COLLAPSED), 'false'); - assert.isFalse(pinned.querySelector(`.${CLASS_HEADING}`).hidden, - 'heading'); + assert.strictEqual(pinned.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(pinned.querySelector(`.${CLASS_HEADING}`).hidden, + false, 'heading'); assert.strictEqual(sect1.childElementCount, 1, 'empty section'); assert.strictEqual(sect2.childElementCount, 1, 'empty section'); assert.strictEqual(sect3.childElementCount, 1, 'empty section'); @@ -15228,8 +15298,9 @@ describe('main', () => { assert.strictEqual(browser.windows.getCurrent.callCount, j + 1, 'called windows get current'); assert.strictEqual(pinned.childElementCount, 4, 'pinned'); - assert.isTrue(pinned.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(pinned.querySelector(`.${CLASS_HEADING}`).hidden, + assert.strictEqual(pinned.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(pinned.querySelector(`.${CLASS_HEADING}`).hidden, true, 'heading'); assert.strictEqual(sect1.childElementCount, 1, 'empty section'); assert.strictEqual(sect2.childElementCount, 1, 'empty section'); @@ -15398,14 +15469,16 @@ describe('main', () => { assert.strictEqual(browser.windows.getCurrent.callCount, j + 1, 'called windows get current'); assert.strictEqual(sect1.childElementCount, 4, 'section'); - assert.isFalse(sect1.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(sect1.querySelector(`.${CLASS_HEADING}`).hidden, + assert.strictEqual(sect1.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(sect1.querySelector(`.${CLASS_HEADING}`).hidden, false, 'heading'); assert.strictEqual(sect2.childElementCount, 1, 'empty section'); assert.strictEqual(sect3.childElementCount, 1, 'empty section'); assert.strictEqual(sect4.childElementCount, 3, 'section'); - assert.isTrue(sect4.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(sect4.querySelector(`.${CLASS_HEADING}`).hidden, + assert.strictEqual(sect4.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(sect4.querySelector(`.${CLASS_HEADING}`).hidden, false, 'heading'); assert.strictEqual(sect5.childElementCount, 1, 'empty section'); assert.deepEqual(res, [undefined, undefined, undefined], 'result'); @@ -15563,14 +15636,16 @@ describe('main', () => { assert.strictEqual(browser.windows.getCurrent.callCount, j + 1, 'called windows get current'); assert.strictEqual(sect1.childElementCount, 3, 'section'); - assert.isFalse(sect1.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(sect1.querySelector(`.${CLASS_HEADING}`).hidden, + assert.strictEqual(sect1.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(sect1.querySelector(`.${CLASS_HEADING}`).hidden, false, 'heading'); assert.strictEqual(sect2.childElementCount, 1, 'empty section'); assert.strictEqual(sect3.childElementCount, 2, 'empty section'); assert.strictEqual(sect4.childElementCount, 3, 'section'); - assert.isTrue(sect4.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(sect4.querySelector(`.${CLASS_HEADING}`).hidden, + assert.strictEqual(sect4.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(sect4.querySelector(`.${CLASS_HEADING}`).hidden, false, 'heading'); assert.strictEqual(sect5.childElementCount, 1, 'empty section'); assert.deepEqual(res, [undefined, undefined], 'result'); @@ -15715,13 +15790,15 @@ describe('main', () => { assert.strictEqual(browser.windows.getCurrent.callCount, j + 1, 'called windows get current'); assert.strictEqual(sect1.childElementCount, 3, 'section'); - assert.isFalse(sect1.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(sect1.querySelector(`.${CLASS_HEADING}`).hidden, + assert.strictEqual(sect1.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(sect1.querySelector(`.${CLASS_HEADING}`).hidden, false, 'heading'); assert.strictEqual(sect2.childElementCount, 1, 'empty section'); assert.strictEqual(sect4.childElementCount, 3, 'section'); - assert.isTrue(sect4.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(sect4.querySelector(`.${CLASS_HEADING}`).hidden, + assert.strictEqual(sect4.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(sect4.querySelector(`.${CLASS_HEADING}`).hidden, false, 'heading'); assert.strictEqual(sect5.childElementCount, 1, 'empty section'); assert.deepEqual(res, [undefined, undefined], 'result'); @@ -15888,8 +15965,9 @@ describe('main', () => { assert.strictEqual(sect1.childElementCount, 2, 'section'); assert.strictEqual(sect3.childElementCount, 2, 'section'); assert.strictEqual(sect4.childElementCount, 3, 'section'); - assert.isTrue(sect4.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(sect4.querySelector(`.${CLASS_HEADING}`).hidden, + assert.strictEqual(sect4.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(sect4.querySelector(`.${CLASS_HEADING}`).hidden, false, 'heading'); assert.strictEqual(sect5.childElementCount, 1, 'empty section'); assert.strictEqual(sect2.childElementCount, 2, 'section'); @@ -16055,13 +16133,15 @@ describe('main', () => { assert.strictEqual(browser.windows.getCurrent.callCount, j + 1, 'called windows get current'); assert.strictEqual(sect4.childElementCount, 3, 'section'); - assert.isTrue(sect4.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(sect4.querySelector(`.${CLASS_HEADING}`).hidden, + assert.strictEqual(sect4.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(sect4.querySelector(`.${CLASS_HEADING}`).hidden, true, 'heading'); assert.strictEqual(sect5.childElementCount, 1, 'empty section'); assert.strictEqual(sect1.childElementCount, 4, 'section'); - assert.isFalse(sect1.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(sect1.querySelector(`.${CLASS_HEADING}`).hidden, + assert.strictEqual(sect1.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(sect1.querySelector(`.${CLASS_HEADING}`).hidden, false, 'heading'); assert.strictEqual(sect2.childElementCount, 1, 'empty section'); assert.strictEqual(sect3.childElementCount, 1, 'empty section'); @@ -16158,7 +16238,7 @@ describe('main', () => { it('should throw', async () => { await func().catch(e => { - assert.instanceOf(e, TypeError, 'instance'); + assert.strictEqual(e instanceof TypeError, true, 'instance'); assert.strictEqual(e.message, 'Expected Array but got Undefined.', 'message'); }); @@ -16355,7 +16435,8 @@ describe('main', () => { pinned.id = PINNED; body.appendChild(pinned); await func(); - assert.instanceOf(mjs.sidebar.pinnedObserver, ResizeObserver, 'observer'); + assert.strictEqual(mjs.sidebar.pinnedObserver instanceof ResizeObserver, + true, 'observer'); }); }); @@ -16447,9 +16528,9 @@ describe('main', () => { main.appendChild(newTab); body.appendChild(main); const res = await func(); - assert.isTrue(browser.sessions.getRecentlyClosed.called, + assert.strictEqual(browser.sessions.getRecentlyClosed.called, true, 'called session'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -16504,9 +16585,9 @@ describe('main', () => { main.appendChild(newTab); body.appendChild(main); const res = await func(); - assert.isTrue(browser.sessions.getRecentlyClosed.called, + assert.strictEqual(browser.sessions.getRecentlyClosed.called, true, 'called session'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); }); }); diff --git a/test/menu-items.test.js b/test/menu-items.test.js index 258da4a5..666c104c 100644 --- a/test/menu-items.test.js +++ b/test/menu-items.test.js @@ -4,7 +4,7 @@ /* eslint-disable import-x/order */ /* api */ -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; import { browser } from './mocha/setup.js'; @@ -38,10 +38,6 @@ describe('menu items', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('should get string and object', () => { const itemKeys = [ OPTIONS_OPEN, @@ -58,14 +54,14 @@ describe('menu items', () => { const items = Object.entries(menuItems); it('should get equal length', () => { - assert.isTrue(items.length === itemKeys.length, 'length'); + assert.strictEqual(items.length, itemKeys.length, 'length'); }); it('should get string and object', () => { for (const [key, value] of items) { - assert.isTrue(itemKeys.includes(key), `includes ${key}`); - assert.isString(key, 'key'); - assert.isObject(value, 'value'); + assert.strictEqual(itemKeys.includes(key), true, `includes ${key}`); + assert.strictEqual(typeof key, 'string', 'key'); + assert.strictEqual(typeof value, 'object', 'value'); } }); }); @@ -92,9 +88,9 @@ describe('menu items', () => { parentItemKeys.forEach(itemKey => { const items = Object.entries(menuItems[itemKey].subItems); for (const [key, value] of items) { - assert.isTrue(subItemKeys.includes(key), 'item'); - assert.isString(key, 'key'); - assert.isObject(value, 'value'); + assert.strictEqual(subItemKeys.includes(key), true, 'item'); + assert.strictEqual(typeof key, 'string', 'key'); + assert.strictEqual(typeof value, 'object', 'value'); } }); }); diff --git a/test/menu.test.js b/test/menu.test.js index 4fe2e366..bcd9ffc2 100644 --- a/test/menu.test.js +++ b/test/menu.test.js @@ -4,9 +4,9 @@ /* eslint-disable import-x/order */ /* api */ -import sinon from 'sinon'; -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; +import sinon from 'sinon'; import { browser, createJsdom } from './mocha/setup.js'; /* test */ @@ -34,10 +34,6 @@ describe('menu', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('update context menu', () => { const func = mjs.updateContextMenu; @@ -111,14 +107,14 @@ describe('menu', () => { it('should throw', async () => { browser.runtime.lastError = new Error('unknown error'); const i = browser.menus.update.callCount; - assert.throws(() => func(), 'unknown error', 'error'); + assert.throws(() => func(), Error, 'unknown error', 'error'); assert.strictEqual(browser.menus.update.callCount, i, 'not called'); }); it('should throw', async () => { browser.runtime.lastError = new Error('ID already exists: foo'); const i = browser.menus.update.callCount; - assert.throws(() => func(), 'ID already exists: foo', 'error'); + assert.throws(() => func(), Error, 'ID already exists: foo', 'error'); assert.strictEqual(browser.menus.update.callCount, i, 'not called'); }); @@ -126,7 +122,7 @@ describe('menu', () => { browser.runtime.lastError = new Error('ID already exists: foo'); mjs.menuItemMap.set('foo', null); const i = browser.menus.update.callCount; - assert.throws(() => func(), 'ID already exists: foo', 'error'); + assert.throws(() => func(), Error, 'ID already exists: foo', 'error'); assert.strictEqual(browser.menus.update.callCount, i, 'not called'); }); @@ -147,14 +143,14 @@ describe('menu', () => { const i = browser.menus.create.callCount; const res = await func(); assert.strictEqual(browser.menus.create.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function if argument is empty object', async () => { const i = browser.menus.create.callCount; const res = await func({}); assert.strictEqual(browser.menus.create.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function if object does not contain id', async () => { @@ -163,7 +159,7 @@ describe('menu', () => { foo: 'bar' }); assert.strictEqual(browser.menus.create.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function if id is not string', async () => { @@ -172,7 +168,7 @@ describe('menu', () => { id: [] }); assert.strictEqual(browser.menus.create.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -262,7 +258,7 @@ describe('menu', () => { const res = await func(); assert.strictEqual(browser.contextualIdentities.query.callCount, i + 1, 'called'); - assert.isTrue(res.length > 0, 'result'); + assert.strictEqual(res.length > 0, true, 'result'); }); it('should get array', async () => { @@ -271,7 +267,7 @@ describe('menu', () => { const res = await func(); assert.strictEqual(browser.contextualIdentities.query.callCount, i + 1, 'called'); - assert.isTrue(res.length > 0, 'result'); + assert.strictEqual(res.length > 0, true, 'result'); }); }); @@ -397,9 +393,9 @@ describe('menu', () => { const remove = browser.menus.removeAll.resolves(undefined); const create = browser.menus.create; const res = await func(); - assert.isTrue(remove.calledOnce, 'called'); - assert.isTrue(create.called, 'called'); - assert.isArray(res, 'result'); + assert.strictEqual(remove.calledOnce, true, 'called'); + assert.strictEqual(create.called, true, 'called'); + assert.strictEqual(Array.isArray(res), true, 'result'); }); }); @@ -416,7 +412,7 @@ describe('menu', () => { const res = await func(); assert.strictEqual(browser.menus.overrideContext.withArgs({}).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function with empty object argument', async () => { @@ -424,7 +420,7 @@ describe('menu', () => { const res = await func({}); assert.strictEqual(browser.menus.overrideContext.withArgs({}).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function with object argument', async () => { @@ -436,7 +432,7 @@ describe('menu', () => { const res = await func(opt); assert.strictEqual(browser.menus.overrideContext.withArgs(opt).callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); }); diff --git a/test/options-main.test.js b/test/options-main.test.js index 64044eac..39802e3b 100644 --- a/test/options-main.test.js +++ b/test/options-main.test.js @@ -4,9 +4,9 @@ /* eslint-disable import-x/order, regexp/no-super-linear-backtracking */ /* api */ -import sinon from 'sinon'; -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; +import sinon from 'sinon'; import { browser, createJsdom } from './mocha/setup.js'; /* test */ @@ -95,10 +95,6 @@ describe('options-main', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('send message', () => { const func = mjs.sendMsg; @@ -132,7 +128,7 @@ describe('options-main', () => { const res = await func(); assert.strictEqual(browser.runtime.sendMessage.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -140,7 +136,7 @@ describe('options-main', () => { const res = await func(true); assert.strictEqual(browser.runtime.sendMessage.callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -152,7 +148,7 @@ describe('options-main', () => { const res = await func(); assert.strictEqual(browser.runtime.sendMessage.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -160,7 +156,7 @@ describe('options-main', () => { const res = await func(true); assert.strictEqual(browser.runtime.sendMessage.callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -174,7 +170,7 @@ describe('options-main', () => { assert.strictEqual(elm.value, '1', 'value'); assert.strictEqual(browser.runtime.sendMessage.callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -186,7 +182,7 @@ describe('options-main', () => { const res = await func(); assert.strictEqual(browser.runtime.sendMessage.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -194,7 +190,7 @@ describe('options-main', () => { const res = await func(true); assert.strictEqual(browser.runtime.sendMessage.callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -249,7 +245,7 @@ describe('options-main', () => { it('should get null if argument not given', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get object', async () => { @@ -465,8 +461,8 @@ describe('options-main', () => { body.appendChild(elm); body.appendChild(elm2); await func(); - assert.isTrue(spy.notCalled, 'not called'); - assert.isTrue(spy2.notCalled, 'not called'); + assert.strictEqual(spy.called, false, 'not called'); + assert.strictEqual(spy2.called, false, 'not called'); elm.addEventListener.restore(); elm2.addEventListener.restore(); }); @@ -484,8 +480,8 @@ describe('options-main', () => { body.appendChild(elm); body.appendChild(elm2); await func(); - assert.isTrue(spy.called, 'not called'); - assert.isTrue(spy2.called, 'not called'); + assert.strictEqual(spy.called, true, 'called'); + assert.strictEqual(spy2.called, true, 'called'); elm.addEventListener.restore(); elm2.addEventListener.restore(); }); @@ -515,9 +511,9 @@ describe('options-main', () => { await func({ target: elm }); - assert.isTrue(elm2.hasAttribute('hidden'), 'set attr'); - assert.isTrue(elm3.hasAttribute('hidden'), 'set attr'); - assert.isFalse(elm4.hasAttribute('hidden'), 'set attr'); + assert.strictEqual(elm2.hasAttribute('hidden'), true, 'set attr'); + assert.strictEqual(elm3.hasAttribute('hidden'), true, 'set attr'); + assert.strictEqual(elm4.hasAttribute('hidden'), false, 'set attr'); }); it('should remove attribute', async () => { @@ -541,9 +537,9 @@ describe('options-main', () => { await func({ target: elm }); - assert.isFalse(elm2.hasAttribute('hidden'), 'set attr'); - assert.isFalse(elm3.hasAttribute('hidden'), 'set attr'); - assert.isTrue(elm4.hasAttribute('hidden'), 'set attr'); + assert.strictEqual(elm2.hasAttribute('hidden'), false, 'set attr'); + assert.strictEqual(elm3.hasAttribute('hidden'), false, 'set attr'); + assert.strictEqual(elm4.hasAttribute('hidden'), true, 'set attr'); }); }); @@ -562,7 +558,7 @@ describe('options-main', () => { body.appendChild(elm); body.appendChild(elm2); func(); - assert.isTrue(elm2.hasAttribute('hidden'), 'attr'); + assert.strictEqual(elm2.hasAttribute('hidden'), true, 'attr'); }); it('should remove attribute', () => { @@ -578,7 +574,7 @@ describe('options-main', () => { body.appendChild(elm); body.appendChild(elm2); func(); - assert.isFalse(elm2.hasAttribute('hidden'), 'attr'); + assert.strictEqual(elm2.hasAttribute('hidden'), false, 'attr'); }); it('should add attribute', () => { @@ -593,7 +589,7 @@ describe('options-main', () => { body.appendChild(elm); body.appendChild(elm2); func(); - assert.isTrue(elm2.hasAttribute('hidden'), 'attr'); + assert.strictEqual(elm2.hasAttribute('hidden'), true, 'attr'); }); }); @@ -796,7 +792,7 @@ describe('options-main', () => { const spy = sinon.spy(elm, 'addEventListener'); body.appendChild(elm); await func(); - assert.isTrue(spy.notCalled, 'not called'); + assert.strictEqual(spy.called, false, 'not called'); elm.addEventListener.restore(); }); @@ -807,7 +803,7 @@ describe('options-main', () => { elm.id = THEME_CUSTOM_INIT; body.appendChild(elm); await func(); - assert.isTrue(spy.calledOnce, 'called'); + assert.strictEqual(spy.calledOnce, true, 'called'); elm.addEventListener.restore(); }); }); @@ -826,11 +822,11 @@ describe('options-main', () => { preventDefault: fake, stopPropagation: fake2 }); - assert.isTrue(fake.calledOnce, 'preventDefault'); - assert.isTrue(fake2.calledOnce, 'stopPropagation'); + assert.strictEqual(fake.calledOnce, true, 'preventDefault'); + assert.strictEqual(fake2.calledOnce, true, 'stopPropagation'); assert.strictEqual(browser.runtime.sendMessage.callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -848,11 +844,11 @@ describe('options-main', () => { preventDefault: fake, stopPropagation: fake2 }); - assert.isTrue(fake.calledOnce, 'preventDefault'); - assert.isTrue(fake2.calledOnce, 'stopPropagation'); + assert.strictEqual(fake.calledOnce, true, 'preventDefault'); + assert.strictEqual(fake2.calledOnce, true, 'stopPropagation'); assert.strictEqual(browser.runtime.sendMessage.callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -865,7 +861,7 @@ describe('options-main', () => { const spy = sinon.spy(elm, 'addEventListener'); body.appendChild(elm); await func(); - assert.isTrue(spy.notCalled, 'not called'); + assert.strictEqual(spy.called, false, 'not called'); elm.addEventListener.restore(); }); @@ -876,7 +872,7 @@ describe('options-main', () => { elm.id = EXT_INIT; body.appendChild(elm); await func(); - assert.isTrue(spy.calledOnce, 'called'); + assert.strictEqual(spy.calledOnce, true, 'called'); elm.addEventListener.restore(); }); }); @@ -888,7 +884,7 @@ describe('options-main', () => { const i = browser.storage.local.set.callCount; const res = await func(); assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -899,7 +895,7 @@ describe('options-main', () => { body.appendChild(elm); const res = await func(); assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -914,7 +910,7 @@ describe('options-main', () => { body.appendChild(elm2); const res = await func(); assert.strictEqual(browser.storage.local.set.callCount, i + 1, 'called'); - assert.isTrue(elm2.hidden); + assert.strictEqual(elm2.hidden, true, 'hidden'); assert.deepEqual(res, [undefined], 'result'); }); @@ -931,8 +927,8 @@ describe('options-main', () => { body.appendChild(elm2); const res = await func(); assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); - assert.isFalse(elm2.hidden, 'hidden'); - assert.isNull(res, 'result'); + assert.strictEqual(elm2.hidden, false, 'hidden'); + assert.strictEqual(res, null, 'result'); }); it('should show warning', async () => { @@ -948,8 +944,8 @@ describe('options-main', () => { body.appendChild(elm2); const res = await func(); assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); - assert.isFalse(elm2.hidden, 'hidden'); - assert.isNull(res, 'result'); + assert.strictEqual(elm2.hidden, false, 'hidden'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -965,7 +961,7 @@ describe('options-main', () => { body.appendChild(elm2); const res = await func(); assert.strictEqual(browser.storage.local.set.callCount, i + 1, 'called'); - assert.isTrue(elm2.hidden); + assert.strictEqual(elm2.hidden, true); assert.strictEqual(elm.value, '', 'value'); assert.deepEqual(res, [undefined], 'result'); }); @@ -983,7 +979,7 @@ describe('options-main', () => { body.appendChild(elm2); const res = await func(); assert.strictEqual(browser.storage.local.set.callCount, i + 1, 'called'); - assert.isTrue(elm2.hidden); + assert.strictEqual(elm2.hidden, true); assert.strictEqual(elm.value, ' ', 'value'); assert.deepEqual(res, [undefined], 'result'); }); @@ -1001,7 +997,7 @@ describe('options-main', () => { body.appendChild(elm2); const res = await func(); assert.strictEqual(browser.storage.local.set.callCount, i + 1, 'called'); - assert.isTrue(elm2.hidden); + assert.strictEqual(elm2.hidden, true); assert.strictEqual(elm.value, 'body { color: red }', 'value'); assert.deepEqual(res, [undefined], 'result'); }); @@ -1019,7 +1015,7 @@ describe('options-main', () => { body.appendChild(elm2); const res = await func(); assert.strictEqual(browser.storage.local.set.callCount, i + 1, 'called'); - assert.isTrue(elm2.hidden); + assert.strictEqual(elm2.hidden, true); assert.strictEqual(elm.value, 'body { color: red; } a { background: white }', 'value'); assert.deepEqual(res, [undefined], 'result'); @@ -1035,7 +1031,7 @@ describe('options-main', () => { const spy = sinon.spy(elm, 'addEventListener'); body.appendChild(elm); await func(); - assert.isTrue(spy.notCalled, 'not called'); + assert.strictEqual(spy.called, false, 'not called'); elm.addEventListener.restore(); }); @@ -1046,7 +1042,7 @@ describe('options-main', () => { elm.id = USER_CSS_SAVE; body.appendChild(elm); await func(); - assert.isTrue(spy.calledOnce, 'called'); + assert.strictEqual(spy.calledOnce, true, 'called'); elm.addEventListener.restore(); }); }); @@ -1078,7 +1074,7 @@ describe('options-main', () => { const spy = sinon.spy(elm, 'addEventListener'); body.appendChild(elm); await func(); - assert.isTrue(spy.calledOnce, 'called'); + assert.strictEqual(spy.calledOnce, true, 'called'); elm.addEventListener.restore(); }); @@ -1089,7 +1085,7 @@ describe('options-main', () => { elm.id = USER_CSS_USE; body.appendChild(elm); await func(); - assert.isTrue(spy.calledTwice, 'called'); + assert.strictEqual(spy.callCount, 2, 'called'); elm.addEventListener.restore(); }); }); @@ -1191,9 +1187,9 @@ describe('options-main', () => { checked: true }); assert.strictEqual(elm.checked, true, 'checked'); - assert.isFalse(elm2.hasAttribute('hidden'), 'set attr'); - assert.isFalse(elm3.hasAttribute('hidden'), 'set attr'); - assert.isTrue(elm4.hasAttribute('hidden'), 'set attr'); + assert.strictEqual(elm2.hasAttribute('hidden'), false, 'set attr'); + assert.strictEqual(elm3.hasAttribute('hidden'), false, 'set attr'); + assert.strictEqual(elm4.hasAttribute('hidden'), true, 'set attr'); assert.deepEqual(res, [undefined], 'result'); }); @@ -1298,9 +1294,9 @@ describe('options-main', () => { id: BOOKMARK_LOCATION, value: 'qux' }); - assert.isFalse(child.hasAttribute('selected'), 'attr'); - assert.isFalse(child2.hasAttribute('selected'), 'attr'); - assert.isFalse(child3.hasAttribute('selected'), 'attr'); + assert.strictEqual(child.hasAttribute('selected'), false, 'attr'); + assert.strictEqual(child2.hasAttribute('selected'), false, 'attr'); + assert.strictEqual(child3.hasAttribute('selected'), false, 'attr'); assert.deepEqual(res, [], 'result'); }); @@ -1322,9 +1318,9 @@ describe('options-main', () => { id: BOOKMARK_LOCATION, value: 'bar' }); - assert.isFalse(child.hasAttribute('selected'), 'attr'); - assert.isTrue(child2.hasAttribute('selected'), 'attr'); - assert.isFalse(child3.hasAttribute('selected'), 'attr'); + assert.strictEqual(child.hasAttribute('selected'), false, 'attr'); + assert.strictEqual(child2.hasAttribute('selected'), true, 'attr'); + assert.strictEqual(child3.hasAttribute('selected'), false, 'attr'); assert.deepEqual(res, [], 'result'); }); diff --git a/test/port.test.js b/test/port.test.js index 665268a6..c4f5d773 100644 --- a/test/port.test.js +++ b/test/port.test.js @@ -4,9 +4,9 @@ /* eslint-disable import-x/order */ /* api */ -import sinon from 'sinon'; -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; +import sinon from 'sinon'; import { browser, mockPort } from './mocha/setup.js'; /* test */ @@ -25,12 +25,8 @@ describe('port', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('ports', () => { - assert.instanceOf(mjs.ports, Map, 'instance'); + assert.strictEqual(mjs.ports instanceof Map, true, 'instance'); }); describe('remove port', () => { @@ -44,21 +40,21 @@ describe('port', () => { it('should get false', async () => { const res = await func(); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should get false', async () => { mjs.ports.set('foo', {}); const res = await func('bar'); assert.strictEqual(mjs.ports.size, 1, 'size'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should get true', async () => { mjs.ports.set('foo', {}); const res = await func('foo'); assert.strictEqual(mjs.ports.size, 0, 'size'); - assert.isTrue(res, 'result'); + assert.strictEqual(res, true, 'result'); }); }); @@ -93,7 +89,7 @@ describe('port', () => { }); const { called: errCalled } = stubError; stubError.restore(); - assert.isFalse(errCalled, 'error called'); + assert.strictEqual(errCalled, false, 'error called'); assert.strictEqual(mjs.ports.size, 0, 'size'); assert.deepEqual(res, [true], 'result'); }); @@ -107,7 +103,7 @@ describe('port', () => { }); const { calledOnce: errCalled } = stubError; stubError.restore(); - assert.isTrue(errCalled, 'error called'); + assert.strictEqual(errCalled, true, 'error called'); assert.strictEqual(mjs.ports.size, 0, 'size'); assert.deepEqual(res, [true, false], 'result'); }); @@ -128,10 +124,10 @@ describe('port', () => { }); const stubConnect = browser.runtime.connect; const res = await func(); - assert.isTrue(stubCurrentWin.calledOnce, 'called current windows'); - assert.isFalse(stubConnect.called, 'not called connect'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(stubConnect.called, false, 'not called connect'); assert.strictEqual(mjs.ports.size, 0, 'size'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get port object', async () => { @@ -140,10 +136,9 @@ describe('port', () => { }); const stubConnect = browser.runtime.connect; const res = await func(); - assert.isTrue(stubCurrentWin.calledOnce, 'called current windows'); - assert.isTrue(stubConnect.calledOnce, 'called connect'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(stubConnect.calledOnce, true, 'called connect'); assert.strictEqual(mjs.ports.size, 1, 'size'); - assert.isObject(res, 'result'); assert.strictEqual(res.name, `${SIDEBAR}_1`, 'name'); }); @@ -153,10 +148,9 @@ describe('port', () => { }); const stubConnect = browser.runtime.connect; const res = await func(`${SIDEBAR}_1`); - assert.isTrue(stubCurrentWin.calledOnce, 'called current windows'); - assert.isTrue(stubConnect.calledOnce, 'called connect'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(stubConnect.calledOnce, true, 'called connect'); assert.strictEqual(mjs.ports.size, 1, 'size'); - assert.isObject(res, 'result'); assert.strictEqual(res.name, `${SIDEBAR}_1`, 'name'); }); @@ -169,10 +163,9 @@ describe('port', () => { name: `${SIDEBAR}_1` }); const res = await func(); - assert.isTrue(stubCurrentWin.calledOnce, 'called current windows'); - assert.isFalse(stubConnect.called, 'not called connect'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(stubConnect.called, false, 'not called connect'); assert.strictEqual(mjs.ports.size, 1, 'size'); - assert.isObject(res, 'result'); assert.strictEqual(res.name, `${SIDEBAR}_1`, 'name'); }); @@ -185,10 +178,9 @@ describe('port', () => { name: `${SIDEBAR}_1` }); const res = await func(`${SIDEBAR}_1`); - assert.isTrue(stubCurrentWin.calledOnce, 'called current windows'); - assert.isFalse(stubConnect.called, 'not called connect'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(stubConnect.called, false, 'not called connect'); assert.strictEqual(mjs.ports.size, 1, 'size'); - assert.isObject(res, 'result'); assert.strictEqual(res.name, `${SIDEBAR}_1`, 'name'); }); }); @@ -208,10 +200,10 @@ describe('port', () => { }); const stubConnect = browser.runtime.connect; const res = await func(); - assert.isFalse(stubCurrentWin.calledOnce, 'not called current windows'); - assert.isFalse(stubConnect.called, 'not called connect'); + assert.strictEqual(stubCurrentWin.called, false, 'not called window'); + assert.strictEqual(stubConnect.called, false, 'not called connect'); assert.strictEqual(mjs.ports.size, 0, 'size'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -220,10 +212,10 @@ describe('port', () => { }); const stubConnect = browser.runtime.connect; const res = await func(`${SIDEBAR}_1`, true); - assert.isTrue(stubCurrentWin.calledOnce, 'called current windows'); - assert.isFalse(stubConnect.called, 'not called connect'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(stubConnect.called, false, 'not called connect'); assert.strictEqual(mjs.ports.size, 0, 'size'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -232,10 +224,10 @@ describe('port', () => { }); const stubConnect = browser.runtime.connect; const res = await func(`${SIDEBAR}_1`); - assert.isFalse(stubCurrentWin.calledOnce, 'not called current windows'); - assert.isFalse(stubConnect.calledOnce, 'not called connect'); + assert.strictEqual(stubCurrentWin.called, false, 'not called window'); + assert.strictEqual(stubConnect.called, false, 'not called connect'); assert.strictEqual(mjs.ports.size, 0, 'size'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get port object', async () => { @@ -244,10 +236,9 @@ describe('port', () => { }); const stubConnect = browser.runtime.connect; const res = await func(`${SIDEBAR}_1`, true); - assert.isTrue(stubCurrentWin.calledOnce, 'called current windows'); - assert.isTrue(stubConnect.calledOnce, 'called connect'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(stubConnect.calledOnce, true, 'called connect'); assert.strictEqual(mjs.ports.size, 1, 'size'); - assert.isObject(res, 'result'); assert.strictEqual(res.name, `${SIDEBAR}_1`, 'name'); }); @@ -260,10 +251,9 @@ describe('port', () => { name: `${SIDEBAR}_1` }); const res = await func(`${SIDEBAR}_1`); - assert.isFalse(stubCurrentWin.calledOnce, 'not called current windows'); - assert.isFalse(stubConnect.called, 'not called connect'); + assert.strictEqual(stubCurrentWin.called, false, 'not called window'); + assert.strictEqual(stubConnect.called, false, 'not called connect'); assert.strictEqual(mjs.ports.size, 1, 'size'); - assert.isObject(res, 'result'); assert.strictEqual(res.name, `${SIDEBAR}_1`, 'name'); }); }); diff --git a/test/session.test.js b/test/session.test.js index 729af532..234e2161 100644 --- a/test/session.test.js +++ b/test/session.test.js @@ -4,7 +4,7 @@ /* eslint-disable import-x/order */ /* api */ -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; import { browser, createJsdom, mockPort } from './mocha/setup.js'; @@ -45,24 +45,20 @@ describe('session', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('get tab list from sessions', () => { const func = mjs.getSessionTabList; it('should throw if no argument given', async () => { await func().catch(e => { - assert.strictEqual(e.message, 'Expected String but got Undefined.', - 'throw'); + assert.strictEqual(e instanceof TypeError, true); + assert.strictEqual(e.message, 'Expected String but got Undefined.'); }); }); it('should throw if argument is not string', async () => { await func(1).catch(e => { - assert.strictEqual(e.message, 'Expected String but got Number.', - 'throw'); + assert.strictEqual(e instanceof TypeError, true); + assert.strictEqual(e.message, 'Expected String but got Number.'); }); }); @@ -78,7 +74,7 @@ describe('session', () => { 'called windows'); assert.strictEqual(browser.sessions.getWindowValue.callCount, j + 1, 'called sessions'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', async () => { @@ -129,14 +125,14 @@ describe('session', () => { it('should throw', async () => { await func().catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected String but got Undefined.'); }); }); it('should throw', async () => { await func('foo').catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected Number but got Undefined.'); }); }); @@ -148,10 +144,10 @@ describe('session', () => { }); const i = browser.sessions.setWindowValue.callCount; const res = await func('foo', 1); - assert.isTrue(stubWin.calledOnce, 'called window'); + assert.strictEqual(stubWin.calledOnce, true, 'called window'); assert.strictEqual(browser.sessions.setWindowValue.callCount, i, 'not called'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should not call function if mutex has window ID', async () => { @@ -162,10 +158,10 @@ describe('session', () => { mjs.mutex.add(1); const i = browser.sessions.setWindowValue.callCount; const res = await func('foo', 1); - assert.isTrue(stubWin.calledOnce, 'called window'); + assert.strictEqual(stubWin.calledOnce, true, 'called window'); assert.strictEqual(browser.sessions.setWindowValue.callCount, i, 'not called'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should throw', async () => { @@ -178,9 +174,9 @@ describe('session', () => { await func('foo', 1).catch(e => { assert.strictEqual(e.message, 'error', 'error'); }); - assert.isTrue(stubWin.calledOnce, 'called'); - assert.isTrue(stubGetValue.calledOnce, 'called'); - assert.isFalse(mjs.mutex.has(1), 'mutex'); + assert.strictEqual(stubWin.calledOnce, true, 'called'); + assert.strictEqual(stubGetValue.calledOnce, true, 'called'); + assert.strictEqual(mjs.mutex.has(1), false, 'mutex'); }); it('should call function', async () => { @@ -249,11 +245,11 @@ describe('session', () => { frag.appendChild(parent2); const domstr = new XMLSerializer().serializeToString(frag); const res = await func(domstr, 1); - assert.isTrue(stubWin.calledOnce, 'called window'); - assert.isTrue(stubGetValue.calledOnce, 'called get'); - assert.isTrue(stubSetValue.calledOnce, 'called set'); - assert.isFalse(mjs.mutex.has(1), 'mutex'); - assert.isTrue(res, 'result'); + assert.strictEqual(stubWin.calledOnce, true, 'called window'); + assert.strictEqual(stubGetValue.calledOnce, true, 'called get'); + assert.strictEqual(stubSetValue.calledOnce, true, 'called set'); + assert.strictEqual(mjs.mutex.has(1), false, 'mutex'); + assert.strictEqual(res, true, 'result'); }); it('should call function', async () => { @@ -325,10 +321,10 @@ describe('session', () => { func(domstr, 1), func(domstr, 1) ]); - assert.isTrue(stubWin.calledTwice, 'called window'); - assert.isTrue(stubGetValue.calledOnce, 'called get'); - assert.isTrue(stubSetValue.calledOnce, 'called set'); - assert.isFalse(mjs.mutex.has(1), 'mutex'); + assert.strictEqual(stubWin.callCount, 2, 'called window'); + assert.strictEqual(stubGetValue.calledOnce, true, 'called get'); + assert.strictEqual(stubSetValue.calledOnce, true, 'called set'); + assert.strictEqual(mjs.mutex.has(1), false, 'mutex'); assert.deepEqual(res, [true, false], 'result'); }); @@ -398,11 +394,11 @@ describe('session', () => { frag.appendChild(parent2); const domstr = new XMLSerializer().serializeToString(frag); const res = await func(domstr, 1).then(() => func(domstr, 1)); - assert.isTrue(stubWin.calledTwice, 'called window'); - assert.isTrue(stubGetValue.calledTwice, 'called get'); - assert.isTrue(stubSetValue.calledTwice, 'called set'); - assert.isFalse(mjs.mutex.has(1), 'mutex'); - assert.isTrue(res, 'result'); + assert.strictEqual(stubWin.callCount, 2, 'called window'); + assert.strictEqual(stubGetValue.callCount, 2, 'called get'); + assert.strictEqual(stubSetValue.callCount, 2, 'called set'); + assert.strictEqual(mjs.mutex.has(1), false, 'mutex'); + assert.strictEqual(res, true, 'result'); }); it('should call function', async () => { @@ -478,11 +474,11 @@ describe('session', () => { frag.appendChild(parent2); const domstr = new XMLSerializer().serializeToString(frag); const res = await func(domstr, 1); - assert.isTrue(stubWin.calledOnce, 'called window'); - assert.isTrue(stubGetValue.calledOnce, 'called get'); - assert.isTrue(stubSetValue.calledOnce, 'called set'); - assert.isFalse(mjs.mutex.has(1), 'mutex'); - assert.isTrue(res, 'result'); + assert.strictEqual(stubWin.calledOnce, true, 'called window'); + assert.strictEqual(stubGetValue.calledOnce, true, 'called get'); + assert.strictEqual(stubSetValue.calledOnce, true, 'called set'); + assert.strictEqual(mjs.mutex.has(1), false, 'mutex'); + assert.strictEqual(res, true, 'result'); }); it('should call function', async () => { @@ -572,11 +568,11 @@ describe('session', () => { frag.appendChild(parent2); const domstr = new XMLSerializer().serializeToString(frag); const res = await func(domstr, 1); - assert.isTrue(stubWin.calledOnce, 'called window'); - assert.isTrue(stubGetValue.calledOnce, 'called get'); - assert.isTrue(stubSetValue.calledOnce, 'called set'); - assert.isFalse(mjs.mutex.has(1), 'mutex'); - assert.isTrue(res, 'result'); + assert.strictEqual(stubWin.calledOnce, true, 'called window'); + assert.strictEqual(stubGetValue.calledOnce, true, 'called get'); + assert.strictEqual(stubSetValue.calledOnce, true, 'called set'); + assert.strictEqual(mjs.mutex.has(1), false, 'mutex'); + assert.strictEqual(res, true, 'result'); }); }); @@ -600,9 +596,9 @@ describe('session', () => { }); mjs.ports.set(portId, port); const res = await func(); - assert.isTrue(stubCurrentWin.calledOnce, 'called current window'); - assert.isFalse(port.postMessage.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(port.postMessage.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -616,9 +612,9 @@ describe('session', () => { }); mjs.ports.set(portId, port); const res = await func(); - assert.isTrue(stubCurrentWin.calledOnce, 'called current window'); - assert.isFalse(port.postMessage.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(port.postMessage.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -632,9 +628,9 @@ describe('session', () => { }); mjs.ports.set(portId, port); const res = await func(); - assert.strictEqual(stubCurrentWin.callCount, 2, 'called current window'); - assert.isFalse(port.postMessage.called, 'not called message'); - assert.isNull(res, 'result'); + assert.strictEqual(stubCurrentWin.callCount, 2, 'called window'); + assert.strictEqual(port.postMessage.called, false, 'not called message'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -671,14 +667,13 @@ describe('session', () => { body.appendChild(parent); body.appendChild(parent2); const res = await func(); - assert.isTrue(stubCurrentWin.calledOnce, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called message'); - assert.isObject(res, 'result'); - assert.property(res, SESSION_SAVE, 'property'); - assert.property(res[SESSION_SAVE], 'windowId', 'property'); - assert.property(res[SESSION_SAVE], 'domString', 'property'); - assert.isNumber(res[SESSION_SAVE].windowId, 'value'); - assert.isString(res[SESSION_SAVE].domString, 'value'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called message'); + assert.strictEqual( + Object.prototype.hasOwnProperty.call(res, SESSION_SAVE), true, + 'property'); + assert.strictEqual(typeof res[SESSION_SAVE].windowId, 'number', 'value'); + assert.strictEqual(typeof res[SESSION_SAVE].domString, 'string', 'value'); }); }); }); diff --git a/test/tab-content.test.js b/test/tab-content.test.js index 6f860faa..62f64cac 100644 --- a/test/tab-content.test.js +++ b/test/tab-content.test.js @@ -4,12 +4,12 @@ /* eslint-disable import-x/order */ /* api */ +import { strict as assert } from 'node:assert'; import fs from 'node:fs'; import path from 'node:path'; import process from 'node:process'; -import sinon from 'sinon'; -import { assert } from 'chai'; import { afterEach, beforeEach, describe, it } from 'mocha'; +import sinon from 'sinon'; import { browser, createJsdom } from './mocha/setup.js'; /* test */ @@ -52,10 +52,6 @@ describe('tab-content', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('icon', () => { it('should exist', async () => { const items = [ @@ -64,7 +60,7 @@ describe('tab-content', () => { ]; for (const item of items) { const file = path.resolve(path.join(process.cwd(), 'src', 'mjs', item)); - assert.isTrue(fs.existsSync(file), `exist ${item}`); + assert.strictEqual(fs.existsSync(file), true, `exist ${item}`); } }); @@ -82,8 +78,8 @@ describe('tab-content', () => { favicon.forEach((value, key) => { const file = path.resolve(path.join(process.cwd(), 'src', 'mjs', value)); - assert.isTrue(fs.existsSync(file), `exist ${file}`); - assert.isTrue(itemKeys.includes(key), 'key'); + assert.strictEqual(fs.existsSync(file), true, `exist ${file}`); + assert.strictEqual(itemKeys.includes(key), true, 'key'); }); }); @@ -97,7 +93,7 @@ describe('tab-content', () => { iconName.forEach(value => { const file = path.resolve(path.join(process.cwd(), 'src', 'img', `${value}.svg`)); - assert.isTrue(fs.existsSync(file), `exist ${value}`); + assert.strictEqual(fs.existsSync(file), true, `exist ${value}`); }); }); }); @@ -111,7 +107,7 @@ describe('tab-content', () => { body.appendChild(elm); const res = await func(); assert.strictEqual(elm.src, '', 'src'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should not set fallback icon if argument is empty object', async () => { @@ -120,7 +116,7 @@ describe('tab-content', () => { body.appendChild(elm); const res = await func({}); assert.strictEqual(elm.src, '', 'src'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should not set fallback icon if type is not error', async () => { @@ -132,7 +128,7 @@ describe('tab-content', () => { type: 'foo' }); assert.strictEqual(elm.src, '', 'src'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should not set fallback icon if target is not img', async () => { @@ -143,8 +139,8 @@ describe('tab-content', () => { target: elm, type: 'error' }); - assert.isUndefined(elm.src, 'src'); - assert.isFalse(res, 'result'); + assert.strictEqual(elm.src, undefined, 'src'); + assert.strictEqual(res, false, 'result'); }); it('should set fallback icon', async () => { @@ -156,7 +152,7 @@ describe('tab-content', () => { type: 'error' }); assert.strictEqual(elm.src, URL_FAVICON_DEFAULT, 'src'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should set fallback icon', async () => { @@ -169,7 +165,7 @@ describe('tab-content', () => { type: 'error' }); assert.strictEqual(elm.src, URL_FAVICON_DEFAULT, 'src'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should set fallback icon', async () => { @@ -182,7 +178,7 @@ describe('tab-content', () => { type: 'error' }); assert.strictEqual(elm.src, URL_FAVICON_DEFAULT, 'src'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); }); @@ -195,7 +191,7 @@ describe('tab-content', () => { const spy = sinon.spy(elm, 'addEventListener'); body.appendChild(elm); await func(elm); - assert.isFalse(spy.calledOnce, 'not called'); + assert.strictEqual(spy.called, false, 'not called'); elm.addEventListener.restore(); }); @@ -205,7 +201,7 @@ describe('tab-content', () => { const spy = sinon.spy(elm, 'addEventListener'); body.appendChild(elm); await func(elm); - assert.isTrue(spy.calledOnce, 'called'); + assert.strictEqual(spy.calledOnce, true, 'called'); elm.addEventListener.restore(); }); }); @@ -487,7 +483,7 @@ describe('tab-content', () => { it('should get null', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -495,7 +491,7 @@ describe('tab-content', () => { const body = document.querySelector('body'); body.appendChild(elm); const res = await func(elm); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -505,7 +501,7 @@ describe('tab-content', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(elm); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get result', async () => { @@ -528,7 +524,7 @@ describe('tab-content', () => { const res = await func(elm); assert.strictEqual(browser.tabs.get.callCount, i + 1, 'called get'); assert.strictEqual(browser.tabs.update.callCount, j + 1, 'called update'); - assert.isTrue(res, 'result'); + assert.strictEqual(res, true, 'result'); }); it('should get result', async () => { @@ -570,7 +566,7 @@ describe('tab-content', () => { const res = await func({ foo: 'bar' }); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -585,9 +581,9 @@ describe('tab-content', () => { target: elm }; const res = await func(evt); - assert.isFalse(preventDefault.called, 'event not prevented'); - assert.isFalse(stopPropagation.called, 'event not stopped'); - assert.isNull(res, 'result'); + assert.strictEqual(preventDefault.called, false, 'event not prevented'); + assert.strictEqual(stopPropagation.called, false, 'event not stopped'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -604,9 +600,9 @@ describe('tab-content', () => { target: elm }; const res = await func(evt); - assert.isFalse(preventDefault.called, 'event not prevented'); - assert.isFalse(stopPropagation.called, 'event not stopped'); - assert.isNull(res, 'result'); + assert.strictEqual(preventDefault.called, false, 'event not prevented'); + assert.strictEqual(stopPropagation.called, false, 'event not stopped'); + assert.strictEqual(res, null, 'result'); }); it('should get result', async () => { @@ -634,11 +630,11 @@ describe('tab-content', () => { target: elm }; const res = await func(evt); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); assert.strictEqual(browser.tabs.get.callCount, i + 1, 'called get'); assert.strictEqual(browser.tabs.update.callCount, j + 1, 'called update'); - assert.isTrue(res, 'result'); + assert.strictEqual(res, true, 'result'); }); it('should get result', async () => { @@ -674,8 +670,8 @@ describe('tab-content', () => { target: elm }; const res = await func(evt); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); assert.strictEqual(browser.tabs.get.callCount, i + 1, 'called get'); assert.strictEqual(browser.tabs.update.callCount, j + 2, 'called update'); assert.deepEqual(res, [true, true], 'result'); @@ -691,7 +687,7 @@ describe('tab-content', () => { const spy = sinon.spy(elm, 'addEventListener'); body.appendChild(elm); await func(elm); - assert.isFalse(spy.calledOnce, 'called'); + assert.strictEqual(spy.called, false, 'called'); elm.addEventListener.restore(); }); @@ -702,7 +698,7 @@ describe('tab-content', () => { elm.classList.add(CLASS_TAB_AUDIO); body.appendChild(elm); await func(elm); - assert.isTrue(spy.calledOnce, 'called'); + assert.strictEqual(spy.calledOnce, true, 'called'); elm.addEventListener.restore(); }); }); @@ -845,8 +841,8 @@ describe('tab-content', () => { await func(elm, { foo: 'bar' }); - assert.isUndefined(elm.alt, 'alt'); - assert.isUndefined(elm.src, 'src'); + assert.strictEqual(elm.alt, undefined, 'alt'); + assert.strictEqual(elm.src, undefined, 'src'); }); it('should not set icon if 2nd argument is empty object', async () => { @@ -964,9 +960,9 @@ describe('tab-content', () => { target: elm }; const res = await func(evt); - assert.isFalse(preventDefault.called, 'event not prevented'); - assert.isFalse(stopPropagation.called, 'event not stopped'); - assert.isNull(res, 'result'); + assert.strictEqual(preventDefault.called, false, 'event not prevented'); + assert.strictEqual(stopPropagation.called, false, 'event not stopped'); + assert.strictEqual(res, null, 'result'); }); it('should get result', async () => { @@ -986,10 +982,10 @@ describe('tab-content', () => { target: elm }; const res = await func(evt); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); assert.strictEqual(browser.tabs.remove.callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should get result', async () => { @@ -1012,10 +1008,10 @@ describe('tab-content', () => { target: elm }; const res = await func(evt); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); assert.strictEqual(browser.tabs.remove.callCount, i + 1, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -1028,7 +1024,7 @@ describe('tab-content', () => { preventDefault: stub }; func(evt); - assert.isTrue(stub.calledOnce); + assert.strictEqual(stub.calledOnce, true); }); }); @@ -1041,7 +1037,7 @@ describe('tab-content', () => { const spy = sinon.spy(elm, 'addEventListener'); body.appendChild(elm); await func(elm); - assert.isFalse(spy.called, 'not called'); + assert.strictEqual(spy.called, false, 'not called'); elm.addEventListener.restore(); }); @@ -1052,7 +1048,7 @@ describe('tab-content', () => { elm.classList.add(CLASS_TAB_CLOSE); body.appendChild(elm); await func(elm); - assert.isTrue(spy.calledTwice, 'called'); + assert.strictEqual(spy.callCount, 2, 'called'); elm.addEventListener.restore(); }); }); @@ -1066,7 +1062,7 @@ describe('tab-content', () => { ]; assert.strictEqual(iconColor.size, itemKeys.length, 'size'); for (const key of itemKeys) { - assert.isTrue(iconColor.has(key), `key ${key}`); + assert.strictEqual(iconColor.has(key), true, `key ${key}`); } }); }); @@ -1081,9 +1077,9 @@ describe('tab-content', () => { parent.appendChild(elm); body.appendChild(parent); await func(elm); - assert.isUndefined(elm.alt, 'alt'); - assert.isUndefined(elm.src, 'src'); - assert.isFalse(parent.classList.contains(IDENTIFIED), 'class'); + assert.strictEqual(elm.alt, undefined, 'alt'); + assert.strictEqual(elm.src, undefined, 'src'); + assert.strictEqual(parent.classList.contains(IDENTIFIED), false, 'class'); }); it('should not set icon if 2nd argument is empty object', async () => { @@ -1095,7 +1091,7 @@ describe('tab-content', () => { await func(elm, {}); assert.strictEqual(elm.alt, '', 'alt'); assert.strictEqual(elm.src, '', 'src'); - assert.isFalse(parent.classList.contains(IDENTIFIED), 'class'); + assert.strictEqual(parent.classList.contains(IDENTIFIED), false, 'class'); }); it('should not set icon if icon does not match', async () => { @@ -1111,7 +1107,7 @@ describe('tab-content', () => { }); assert.strictEqual(elm.alt, '', 'alt'); assert.strictEqual(elm.src, '', 'src'); - assert.isFalse(parent.classList.contains(IDENTIFIED), 'class'); + assert.strictEqual(parent.classList.contains(IDENTIFIED), false, 'class'); }); it('should not set icon if name is not a string', async () => { @@ -1127,7 +1123,7 @@ describe('tab-content', () => { }); assert.strictEqual(elm.alt, '', 'alt'); assert.strictEqual(elm.src, '', 'src'); - assert.isFalse(parent.classList.contains(IDENTIFIED), 'class'); + assert.strictEqual(parent.classList.contains(IDENTIFIED), false, 'class'); }); it('should not set icon if icon and/or name lacks', async () => { @@ -1142,7 +1138,7 @@ describe('tab-content', () => { }); assert.strictEqual(elm.alt, '', 'alt'); assert.strictEqual(elm.src, '', 'src'); - assert.isFalse(parent.classList.contains(IDENTIFIED), 'class'); + assert.strictEqual(parent.classList.contains(IDENTIFIED), false, 'class'); }); it('should not set icon if icon and/or name lacks', async () => { @@ -1157,7 +1153,7 @@ describe('tab-content', () => { }); assert.strictEqual(elm.alt, '', 'alt'); assert.strictEqual(elm.src, '', 'src'); - assert.isFalse(parent.classList.contains(IDENTIFIED), 'class'); + assert.strictEqual(parent.classList.contains(IDENTIFIED), false, 'class'); }); it('should set icon', async () => { @@ -1173,7 +1169,7 @@ describe('tab-content', () => { }); assert.strictEqual(elm.alt, 'foo', 'alt'); assert.strictEqual(elm.src, '../img/briefcase.svg#blue', 'src'); - assert.isTrue(parent.classList.contains(IDENTIFIED), 'class'); + assert.strictEqual(parent.classList.contains(IDENTIFIED), true, 'class'); }); it('should set icon', async () => { @@ -1189,7 +1185,7 @@ describe('tab-content', () => { }); assert.strictEqual(elm.alt, 'foo', 'alt'); assert.strictEqual(elm.src, '../img/briefcase.svg#current', 'src'); - assert.isTrue(parent.classList.contains(IDENTIFIED), 'class'); + assert.strictEqual(parent.classList.contains(IDENTIFIED), true, 'class'); }); it('should set icon', async () => { @@ -1212,8 +1208,8 @@ describe('tab-content', () => { }); stubFetch.restore(); assert.strictEqual(elm.alt, 'foo', 'alt'); - assert.isTrue(elm.src.startsWith('data:'), 'src'); - assert.isTrue(parent.classList.contains(IDENTIFIED), 'class'); + assert.strictEqual(elm.src.startsWith('data:'), true, 'src'); + assert.strictEqual(parent.classList.contains(IDENTIFIED), true, 'class'); }); }); @@ -1257,8 +1253,8 @@ describe('tab-content', () => { const res = await func(elm); assert.strictEqual(browser.tabs.get.withArgs(1).callCount, i + 1, 'called'); - assert.isTrue(elm.classList.contains(HIGHLIGHTED)); - assert.isFalse(elm.classList.contains(CLASS_MULTI)); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), true); + assert.strictEqual(elm.classList.contains(CLASS_MULTI), false); assert.deepEqual(res, [undefined, undefined], 'result'); }); @@ -1281,8 +1277,8 @@ describe('tab-content', () => { const res = await func(elm, 2); assert.strictEqual(browser.tabs.get.withArgs(1).callCount, i + 1, 'called'); - assert.isTrue(elm.classList.contains(HIGHLIGHTED)); - assert.isTrue(elm.classList.contains(CLASS_MULTI)); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), true); + assert.strictEqual(elm.classList.contains(CLASS_MULTI), true); assert.deepEqual(res, [undefined, undefined], 'result'); }); }); @@ -1333,7 +1329,7 @@ describe('tab-content', () => { const res = await func([1]); assert.strictEqual(browser.tabs.get.withArgs(1).callCount, i + 1, 'called'); - assert.isTrue(elm.classList.contains(HIGHLIGHTED)); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), true); assert.deepEqual(res, [[undefined, undefined]], 'result'); }); @@ -1368,8 +1364,8 @@ describe('tab-content', () => { body.appendChild(elm4); const res = await func([1, 2]); assert.strictEqual(browser.tabs.get.callCount, i + 2, 'called'); - assert.isTrue(elm.classList.contains(HIGHLIGHTED)); - assert.isTrue(elm4.classList.contains(HIGHLIGHTED)); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), true); + assert.strictEqual(elm4.classList.contains(HIGHLIGHTED), true); assert.deepEqual(res, [[undefined, undefined], [undefined, undefined]], 'result'); }); @@ -1416,8 +1412,8 @@ describe('tab-content', () => { const res = await func(elm); assert.strictEqual(browser.tabs.get.withArgs(1).callCount, i + 1, 'called'); - assert.isFalse(elm.classList.contains(HIGHLIGHTED)); - assert.isFalse(elm.classList.contains(CLASS_MULTI)); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), false); + assert.strictEqual(elm.classList.contains(CLASS_MULTI), false); assert.deepEqual(res, [undefined, undefined], 'result'); }); }); @@ -1468,7 +1464,7 @@ describe('tab-content', () => { const res = await func([1]); assert.strictEqual(browser.tabs.get.withArgs(1).callCount, i + 1, 'called'); - assert.isFalse(elm.classList.contains(HIGHLIGHTED)); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), false); assert.deepEqual(res, [[undefined, undefined]], 'result'); }); @@ -1503,8 +1499,8 @@ describe('tab-content', () => { body.appendChild(elm4); const res = await func([1, 2]); assert.strictEqual(browser.tabs.get.callCount, i + 2, 'called'); - assert.isFalse(elm.classList.contains(HIGHLIGHTED)); - assert.isFalse(elm4.classList.contains(HIGHLIGHTED)); + assert.strictEqual(elm.classList.contains(HIGHLIGHTED), false); + assert.strictEqual(elm4.classList.contains(HIGHLIGHTED), false); assert.deepEqual(res, [[undefined, undefined], [undefined, undefined]], 'result'); }); diff --git a/test/tab-dnd.test.js b/test/tab-dnd.test.js index 3e5dc10a..7b0a3e79 100644 --- a/test/tab-dnd.test.js +++ b/test/tab-dnd.test.js @@ -4,9 +4,9 @@ /* eslint-disable import-x/order */ /* api */ -import sinon from 'sinon'; -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; +import sinon from 'sinon'; import { browser, createJsdom, mockPort } from './mocha/setup.js'; /* test */ @@ -48,10 +48,6 @@ describe('dnd', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('clear drop target', () => { const func = mjs.clearDropTarget; @@ -64,8 +60,8 @@ describe('dnd', () => { parent.appendChild(elm); body.appendChild(parent); func(); - assert.isTrue(elm.classList.contains(TAB), 'class'); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'class'); + assert.strictEqual(elm.classList.contains(TAB), true, 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'class'); }); it('should remove class', () => { @@ -77,9 +73,10 @@ describe('dnd', () => { parent.appendChild(elm); body.appendChild(parent); func(); - assert.isTrue(elm.classList.contains(TAB), 'class'); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'class'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'class'); + assert.strictEqual(elm.classList.contains(TAB), true, 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'class'); }); it('should remove class', () => { @@ -91,9 +88,10 @@ describe('dnd', () => { parent.appendChild(elm); body.appendChild(parent); func(); - assert.isTrue(elm.classList.contains(TAB), 'class'); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'class'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'class'); + assert.strictEqual(elm.classList.contains(TAB), true, 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'class'); }); it('should remove class', () => { @@ -123,11 +121,13 @@ describe('dnd', () => { body.appendChild(parent); const i = browser.i18n.getMessage.callCount; func(); - assert.isFalse(parent.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(parent.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 2, 'called'); - assert.isTrue(elm.classList.contains(TAB), 'class'); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'class'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'class'); + assert.strictEqual(elm.classList.contains(TAB), true, 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'class'); }); it('should remove class', () => { @@ -156,11 +156,13 @@ describe('dnd', () => { body.appendChild(parent); const i = browser.i18n.getMessage.callCount; func(); - assert.isFalse(parent.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(parent.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); assert.strictEqual(browser.i18n.getMessage.callCount, i, 'not called'); - assert.isTrue(elm.classList.contains(TAB), 'class'); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'class'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'class'); + assert.strictEqual(elm.classList.contains(TAB), true, 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'class'); }); }); @@ -173,7 +175,7 @@ describe('dnd', () => { const res = await func(); assert.strictEqual(browser.tabs.create.callCount, i, 'not called'); assert.strictEqual(browser.search.query.callCount, j, 'not called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -209,7 +211,7 @@ describe('dnd', () => { ]); assert.strictEqual(createFunc.callCount, 4, 'called'); assert.strictEqual(browser.search.query.callCount, 2, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); assert.deepEqual(order, [ { id: 11, @@ -228,7 +230,7 @@ describe('dnd', () => { url: undefined } ], 'order'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -264,7 +266,7 @@ describe('dnd', () => { ], true); assert.strictEqual(createFunc.callCount, 4, 'called'); assert.strictEqual(browser.search.query.callCount, 2, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); assert.deepEqual(order, [ { id: 11, @@ -283,7 +285,7 @@ describe('dnd', () => { url: 'https://example.com' } ], 'order'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -348,10 +350,10 @@ describe('dnd', () => { textValue: 'https://example.com\njavascript:void(0)\nfoo\n\nbar' }; const res = await func(elm2, data); - assert.isFalse(browser.tabs.create.called, 'not called'); - assert.isFalse(browser.search.search.called, 'not called'); - assert.isFalse(browser.search.query.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.create.called, false, 'not called'); + assert.strictEqual(browser.search.search.called, false, 'not called'); + assert.strictEqual(browser.search.query.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -420,9 +422,9 @@ describe('dnd', () => { }); const res = await func(elm2, data); assert.strictEqual(createFunc.callCount, 2, 'called'); - assert.isFalse(browser.search.search.called, 'not called'); - assert.isFalse(browser.search.query.called, 'not called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(browser.search.search.called, false, 'not called'); + assert.strictEqual(browser.search.query.called, false, 'not called'); + assert.strictEqual(res, undefined, 'result'); }); it('shoult call function', async () => { @@ -491,9 +493,9 @@ describe('dnd', () => { }); const res = await func(elm2, data); assert.strictEqual(createFunc.callCount, 1, 'called'); - assert.isFalse(browser.search.search.called, 'not called'); - assert.isFalse(browser.search.query.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.search.search.called, false, 'not called'); + assert.strictEqual(browser.search.query.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('shoult call function', async () => { @@ -564,7 +566,7 @@ describe('dnd', () => { assert.strictEqual(createFunc.callCount, 4, 'called'); assert.strictEqual(browser.search.search.callCount, 0, 'not called'); assert.strictEqual(browser.search.query.callCount, 3, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('shoult call function', async () => { @@ -641,8 +643,8 @@ describe('dnd', () => { assert.strictEqual(createFunc.callCount, 3, 'called'); assert.strictEqual(browser.search.search.callCount, 0, 'not called'); assert.strictEqual(browser.search.query.callCount, 2, 'called'); - assert.isTrue(getTab.called, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(getTab.called, true, 'called'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -714,10 +716,10 @@ describe('dnd', () => { }); const res = await func(elm3, data); assert.strictEqual(createFunc.callCount, 2, 'called'); - assert.isFalse(browser.search.search.called, 'not called'); - assert.isFalse(browser.search.query.called, 'not called'); - assert.isFalse(getFunc.called, 'not called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(browser.search.search.called, false, 'not called'); + assert.strictEqual(browser.search.query.called, false, 'not called'); + assert.strictEqual(getFunc.called, false, 'not called'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -789,10 +791,10 @@ describe('dnd', () => { }); const res = await func(elm3, data); assert.strictEqual(createFunc.callCount, 2, 'called'); - assert.isFalse(browser.search.search.called, 'not called'); - assert.isFalse(browser.search.query.called, 'not called'); - assert.isFalse(getFunc.called, 'not called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(browser.search.search.called, false, 'not called'); + assert.strictEqual(browser.search.query.called, false, 'not called'); + assert.strictEqual(getFunc.called, false, 'not called'); + assert.strictEqual(res, undefined, 'result'); }); it('shoult call function', async () => { @@ -867,8 +869,8 @@ describe('dnd', () => { assert.strictEqual(createFunc.callCount, 4, 'called'); assert.strictEqual(browser.search.search.callCount, 0, 'not called'); assert.strictEqual(browser.search.query.callCount, 3, 'called'); - assert.isTrue(getFunc.called, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(getFunc.called, true, 'called'); + assert.strictEqual(res, undefined, 'result'); }); it('shoult call function', async () => { @@ -943,8 +945,8 @@ describe('dnd', () => { assert.strictEqual(createFunc.callCount, 4, 'called'); assert.strictEqual(browser.search.search.callCount, 0, 'not called'); assert.strictEqual(browser.search.query.callCount, 3, 'called'); - assert.isTrue(getFunc.called, 'called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(getFunc.called, true, 'called'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -1024,10 +1026,10 @@ describe('dnd', () => { const res = await func(elm3, data); assert.strictEqual(updateFunc.callCount, 1, 'called'); assert.strictEqual(createFunc.callCount, 1, 'called'); - assert.isFalse(browser.search.search.called, 'not called'); - assert.isFalse(browser.search.query.called, 'not called'); - assert.isFalse(getFunc.called, 'not called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(browser.search.search.called, false, 'not called'); + assert.strictEqual(browser.search.query.called, false, 'not called'); + assert.strictEqual(getFunc.called, false, 'not called'); + assert.strictEqual(res, undefined, 'result'); }); it('shoult call function', async () => { @@ -1109,8 +1111,8 @@ describe('dnd', () => { assert.strictEqual(createFunc.callCount, 3, 'called'); assert.strictEqual(browser.search.search.callCount, 1, 'called'); assert.strictEqual(browser.search.query.callCount, 2, 'called'); - assert.isFalse(getFunc.called, 'not called'); - assert.isUndefined(res, 'result'); + assert.strictEqual(getFunc.called, false, 'not called'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -1189,11 +1191,11 @@ describe('dnd', () => { tabIds: [] }; const res = await func(elm2, data); - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(browser.tabs.update.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(browser.tabs.update.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1281,10 +1283,10 @@ describe('dnd', () => { return tabArr; }); const res = await func(elm2, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(browser.tabs.update.called, 'not called'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(browser.tabs.update.called, false, 'not called'); assert.deepEqual(res, [{ id: 1, index: 1 @@ -1376,10 +1378,10 @@ describe('dnd', () => { return tabArr; }); const res = await func(elm, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(browser.tabs.update.called, 'not called'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(browser.tabs.update.called, false, 'not called'); assert.deepEqual(res, [{ id: 2, index: 0 @@ -1475,14 +1477,14 @@ describe('dnd', () => { const res = await func(elm2, data); const node = document.querySelector('[data-tab-id="11"]'); const nodeParent = node.parentNode; - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isTrue(updateFunc.called, 'called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isFalse(nodeParent === parent2, 'parent'); - assert.isTrue(nodeParent === parent2.previousElementSibling, 'parent'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, true, 'called'); + assert.notDeepEqual(nodeParent, parent, 'parent'); + assert.notDeepEqual(nodeParent, parent2, 'parent'); + assert.deepEqual(nodeParent, parent2.previousElementSibling, 'parent'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1574,14 +1576,14 @@ describe('dnd', () => { const res = await func(elm2, data); const node = document.querySelector('[data-tab-id="14"]'); const nodeParent = node.parentNode; - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(updateFunc.called, 'not called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isFalse(nodeParent === parent2, 'parent'); - assert.isTrue(nodeParent === parent2.previousElementSibling, 'parent'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, false, 'not called'); + assert.notDeepEqual(nodeParent, parent, 'parent'); + assert.notDeepEqual(nodeParent, parent2, 'parent'); + assert.deepEqual(nodeParent, parent2.previousElementSibling, 'parent'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1675,18 +1677,13 @@ describe('dnd', () => { const nodeParent = node.parentNode; const node2 = document.querySelector('[data-tab-id="14"]'); const node2Parent = node2.parentNode; - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isTrue(updateFunc.called, 'not called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isFalse(nodeParent === parent2, 'parent'); - assert.isFalse(nodeParent === node2Parent, 'parent'); - assert.isFalse(node2Parent === parent, 'parent'); - assert.isFalse(node2Parent === parent2, 'parent'); - assert.isTrue(node2Parent === nodeParent.nextElementSibling, 'parent'); - assert.isTrue(node2Parent === parent2.previousElementSibling, 'parent'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, true, 'not called'); + assert.deepEqual(node2Parent, nodeParent.nextElementSibling, 'parent'); + assert.deepEqual(node2Parent, parent2.previousElementSibling, 'parent'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1778,14 +1775,14 @@ describe('dnd', () => { const res = await func(elm2, data); const node = document.querySelector('[data-tab-id="14"]'); const nodeParent = node.parentNode; - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(updateFunc.called, 'not called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isFalse(nodeParent === parent2, 'parent'); - assert.isTrue(nodeParent === parent2.previousElementSibling, 'parent'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, false, 'not called'); + assert.notDeepEqual(nodeParent, parent, 'parent'); + assert.notDeepEqual(nodeParent, parent2, 'parent'); + assert.deepEqual(nodeParent, parent2.previousElementSibling, 'parent'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1879,17 +1876,17 @@ describe('dnd', () => { const nodeParent = node.parentNode; const node2 = document.querySelector('[data-tab-id="11"]'); const node2Parent = node2.parentNode; - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isTrue(updateFunc.called, 'not called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isFalse(nodeParent === parent2, 'parent'); - assert.isTrue(nodeParent === parent2.previousElementSibling, 'parent'); - assert.isTrue(node2Parent === nodeParent, 'parent'); - assert.isTrue(node === nodeParent.lastElementChild, 'node'); - assert.isTrue(node === node2.nextElementSibling, 'node'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, true, 'not called'); + assert.notDeepEqual(nodeParent, parent, 'parent'); + assert.notDeepEqual(nodeParent, parent2, 'parent'); + assert.deepEqual(nodeParent, parent2.previousElementSibling, 'parent'); + assert.deepEqual(node2Parent, nodeParent, 'parent'); + assert.deepEqual(node, nodeParent.lastElementChild, 'node'); + assert.deepEqual(node, node2.nextElementSibling, 'node'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1981,15 +1978,16 @@ describe('dnd', () => { const res = await func(elm2, data); const node = document.querySelector('[data-tab-id="14"]'); const nodeParent = node.parentNode; - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(updateFunc.called, 'not called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isFalse(nodeParent === parent2, 'parent'); - assert.isTrue(nodeParent === parent2.previousElementSibling, 'parent'); - assert.isTrue(nodeParent.classList.contains(CLASS_TAB_GROUP), 'parent'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, false, 'not called'); + assert.notDeepEqual(nodeParent, parent, 'parent'); + assert.notDeepEqual(nodeParent, parent2, 'parent'); + assert.deepEqual(nodeParent, parent2.previousElementSibling, 'parent'); + assert.strictEqual(nodeParent.classList.contains(CLASS_TAB_GROUP), true, + 'parent'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -2077,10 +2075,10 @@ describe('dnd', () => { return tabArr; }); const res = await func(elm4, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(browser.tabs.update.called, 'not called'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(browser.tabs.update.called, false, 'not called'); assert.deepEqual(res, [{ id: 3, index: 3 @@ -2172,10 +2170,10 @@ describe('dnd', () => { return tabArr; }); const res = await func(elm3, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(browser.tabs.update.called, 'not called'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(browser.tabs.update.called, false, 'not called'); assert.deepEqual(res, [{ id: 4, index: 2 @@ -2278,12 +2276,12 @@ describe('dnd', () => { return tabArr; }); const res = await func(elm5, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(browser.tabs.update.called, 'not called'); - assert.isTrue(elm3.parentNode === parent3, 'parent'); - assert.isTrue(elm3 === elm5.nextElementSibling, 'node'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(browser.tabs.update.called, false, 'not called'); + assert.deepEqual(elm3.parentNode, parent3, 'parent'); + assert.deepEqual(elm3, elm5.nextElementSibling, 'node'); assert.deepEqual(res, [{ id: 3, index: 4 @@ -2386,12 +2384,12 @@ describe('dnd', () => { return tabArr; }); const res = await func(elm3, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(browser.tabs.update.called, 'not called'); - assert.isTrue(elm5.parentNode === parent2, 'parent'); - assert.isTrue(elm5 === elm3.previousElementSibling, 'node'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(browser.tabs.update.called, false, 'not called'); + assert.deepEqual(elm5.parentNode, parent2, 'parent'); + assert.deepEqual(elm5, elm3.previousElementSibling, 'node'); assert.deepEqual(res, [{ id: 5, index: 2 @@ -2494,15 +2492,15 @@ describe('dnd', () => { return tabArr; }); const res = await func(elm5, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(browser.tabs.update.called, 'not called'); - assert.isFalse(elm3.parentNode === parent3, 'parent'); - assert.isTrue(elm3.parentNode === parent3.nextElementSibling, 'parent'); - assert.isTrue(elm3 === elm3.parentNode.firstElementChild, 'node'); - assert.isTrue(elm4.parentNode === elm3.parentNode, 'parent'); - assert.isTrue(elm4 === elm3.nextElementSibling, 'node'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(browser.tabs.update.called, false, 'not called'); + assert.notDeepEqual(elm3.parentNode, parent3, 'parent'); + assert.deepEqual(elm3.parentNode, parent3.nextElementSibling, 'parent'); + assert.deepEqual(elm3, elm3.parentNode.firstElementChild, 'node'); + assert.deepEqual(elm4.parentNode, elm3.parentNode, 'parent'); + assert.deepEqual(elm4, elm3.nextElementSibling, 'node'); assert.deepEqual(res, [{ id: 3, index: 4 @@ -2608,16 +2606,16 @@ describe('dnd', () => { return tabArr; }); const res = await func(elm3, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(browser.tabs.update.called, 'not called'); - assert.isFalse(elm4.parentNode === parent3, 'parent'); - assert.isTrue(elm4.parentNode === parent2.previousElementSibling, + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(browser.tabs.update.called, false, 'not called'); + assert.notDeepEqual(elm4.parentNode, parent3, 'parent'); + assert.deepEqual(elm4.parentNode, parent2.previousElementSibling, 'parent'); - assert.isTrue(elm4 === elm4.parentNode.firstElementChild, 'node'); - assert.isTrue(elm5.parentNode === elm4.parentNode, 'parent'); - assert.isTrue(elm5 === elm4.nextElementSibling, 'node'); + assert.deepEqual(elm4, elm4.parentNode.firstElementChild, 'node'); + assert.deepEqual(elm5.parentNode, elm4.parentNode, 'parent'); + assert.deepEqual(elm5, elm4.nextElementSibling, 'node'); assert.deepEqual(res, [{ id: 4, index: 2 @@ -2716,14 +2714,14 @@ describe('dnd', () => { const res = await func(elm4, data); const node = document.querySelector('[data-tab-id="13"]'); const nodeParent = node.parentNode; - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(updateFunc.called, 'called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isFalse(nodeParent === parent2, 'parent'); - assert.isTrue(nodeParent === parent2.nextElementSibling, 'parent'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, false, 'called'); + assert.notDeepEqual(nodeParent, parent, 'parent'); + assert.notDeepEqual(nodeParent, parent2, 'parent'); + assert.deepEqual(nodeParent, parent2.nextElementSibling, 'parent'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -2815,14 +2813,14 @@ describe('dnd', () => { const res = await func(elm3, data); const node = document.querySelector('[data-tab-id="11"]'); const nodeParent = node.parentNode; - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isTrue(updateFunc.called, 'called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isFalse(nodeParent === parent2, 'parent'); - assert.isTrue(nodeParent === parent2.previousElementSibling, 'parent'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, true, 'called'); + assert.notDeepEqual(nodeParent, parent, 'parent'); + assert.notDeepEqual(nodeParent, parent2, 'parent'); + assert.deepEqual(nodeParent, parent2.previousElementSibling, 'parent'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -2916,17 +2914,17 @@ describe('dnd', () => { const nodeParent = node.parentNode; const node2 = document.querySelector('[data-tab-id="14"]'); const node2Parent = node2.parentNode; - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isTrue(updateFunc.called, 'called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isFalse(nodeParent === parent2, 'parent'); - assert.isFalse(node2Parent === parent, 'parent'); - assert.isFalse(node2Parent === parent2, 'parent'); - assert.isTrue(node2Parent === nodeParent.nextElementSibling, 'parent'); - assert.isTrue(node2Parent === parent2.previousElementSibling, 'parent'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, true, 'called'); + assert.notDeepEqual(nodeParent, parent, 'parent'); + assert.notDeepEqual(nodeParent, parent2, 'parent'); + assert.notDeepEqual(node2Parent, parent, 'parent'); + assert.notDeepEqual(node2Parent, parent2, 'parent'); + assert.deepEqual(node2Parent, nodeParent.nextElementSibling, 'parent'); + assert.deepEqual(node2Parent, parent2.previousElementSibling, 'parent'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -3029,16 +3027,15 @@ describe('dnd', () => { const res = await func(elm5, data); const node = document.querySelector('[data-tab-id="11"]'); const nodeParent = node.parentNode; - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isTrue(updateFunc.called, 'called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isFalse(nodeParent === parent2, 'parent'); - assert.isTrue(nodeParent === parent3, 'parent'); - assert.isTrue(nodeParent.classList.contains(CLASS_TAB_GROUP), 'class'); - assert.isTrue(node === elm5.nextElementSibling, 'node'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, true, 'called'); + assert.deepEqual(nodeParent, parent3, 'parent'); + assert.strictEqual(nodeParent.classList.contains(CLASS_TAB_GROUP), true, + 'class'); + assert.deepEqual(node, elm5.nextElementSibling, 'node'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -3141,16 +3138,15 @@ describe('dnd', () => { const res = await func(elm3, data); const node = document.querySelector('[data-tab-id="15"]'); const nodeParent = node.parentNode; - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(updateFunc.called, 'called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isTrue(nodeParent === parent2, 'parent'); - assert.isFalse(nodeParent === parent3, 'parent'); - assert.isTrue(nodeParent.classList.contains(CLASS_TAB_GROUP), 'class'); - assert.isTrue(node === elm3.previousElementSibling, 'node'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, false, 'called'); + assert.deepEqual(nodeParent, parent2, 'parent'); + assert.strictEqual(nodeParent.classList.contains(CLASS_TAB_GROUP), true, + 'class'); + assert.deepEqual(node, elm3.previousElementSibling, 'node'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -3254,18 +3250,19 @@ describe('dnd', () => { const node = document.querySelector('[data-tab-id="11"]'); const nodeParent = node.parentNode; const node2 = document.querySelector('[data-tab-id="12"]'); - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isTrue(updateFunc.called, 'called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isFalse(nodeParent === parent2, 'parent'); - assert.isFalse(nodeParent === parent3, 'parent'); - assert.isTrue(nodeParent === parent3.previousElementSibling, 'parent'); - assert.isTrue(nodeParent.classList.contains(CLASS_TAB_GROUP), 'class'); - assert.isTrue(node === nodeParent.firstElementChild, 'node'); - assert.isTrue(node === node2.previousElementSibling, 'node'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, true, 'called'); + assert.notDeepEqual(nodeParent, parent, 'parent'); + assert.notDeepEqual(nodeParent, parent2, 'parent'); + assert.notDeepEqual(nodeParent, parent3, 'parent'); + assert.deepEqual(nodeParent, parent3.previousElementSibling, 'parent'); + assert.strictEqual(nodeParent.classList.contains(CLASS_TAB_GROUP), true, + 'class'); + assert.deepEqual(node, nodeParent.firstElementChild, 'node'); + assert.deepEqual(node, node2.previousElementSibling, 'node'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -3369,18 +3366,19 @@ describe('dnd', () => { const node = document.querySelector('[data-tab-id="13"]'); const nodeParent = node.parentNode; const node2 = document.querySelector('[data-tab-id="14"]'); - assert.isFalse(browser.tabs.move.called, 'not called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isFalse(updateFunc.called, 'called'); - assert.isFalse(nodeParent === parent, 'parent'); - assert.isFalse(nodeParent === parent2, 'parent'); - assert.isFalse(nodeParent === parent3, 'parent'); - assert.isTrue(nodeParent === parent3.nextElementSibling, 'parent'); - assert.isTrue(nodeParent.classList.contains(CLASS_TAB_GROUP), 'class'); - assert.isTrue(node === nodeParent.firstElementChild, 'node'); - assert.isTrue(node === node2.previousElementSibling, 'node'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.tabs.move.called, false, 'not called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, false, 'called'); + assert.notDeepEqual(nodeParent, parent, 'parent'); + assert.notDeepEqual(nodeParent, parent2, 'parent'); + assert.notDeepEqual(nodeParent, parent3, 'parent'); + assert.deepEqual(nodeParent, parent3.nextElementSibling, 'parent'); + assert.strictEqual(nodeParent.classList.contains(CLASS_TAB_GROUP), true, + 'class'); + assert.deepEqual(node, nodeParent.firstElementChild, 'node'); + assert.deepEqual(node, node2.previousElementSibling, 'node'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -3482,10 +3480,10 @@ describe('dnd', () => { }; }); const res = await func(elm2, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isTrue(highlightFunc.called, 'called'); - assert.isFalse(updateFunc.called, 'called'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(highlightFunc.called, true, 'called'); + assert.strictEqual(updateFunc.called, false, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -3588,10 +3586,10 @@ describe('dnd', () => { }; }); const res = await func(elm2, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isTrue(highlightFunc.called, 'called'); - assert.isFalse(updateFunc.called, 'called'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(highlightFunc.called, true, 'called'); + assert.strictEqual(updateFunc.called, false, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -3691,10 +3689,10 @@ describe('dnd', () => { }; }); const res = await func(elm2, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isTrue(updateFunc.called, 'called'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, true, 'called'); assert.deepEqual(res, { id: 15 }, 'result'); @@ -3799,10 +3797,10 @@ describe('dnd', () => { }; }); const res = await func(elm3, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isTrue(highlightFunc.called, 'called'); - assert.isFalse(updateFunc.called, 'called'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(highlightFunc.called, true, 'called'); + assert.strictEqual(updateFunc.called, false, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -3905,10 +3903,10 @@ describe('dnd', () => { }; }); const res = await func(elm3, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isFalse(browser.tabs.duplicate.called, 'not called'); - assert.isTrue(highlightFunc.called, 'called'); - assert.isFalse(updateFunc.called, 'called'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.duplicate.called, false, 'not called'); + assert.strictEqual(highlightFunc.called, true, 'called'); + assert.strictEqual(updateFunc.called, false, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -4008,10 +4006,10 @@ describe('dnd', () => { }; }); const res = await func(elm3, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isTrue(updateFunc.called, 'called'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, true, 'called'); assert.deepEqual(res, { id: 15 }, 'result'); @@ -4113,10 +4111,10 @@ describe('dnd', () => { }; }); const res = await func(elm3, data); - assert.isTrue(moveFunc.called, 'called'); - assert.isTrue(dupeFunc.called, 'called'); - assert.isFalse(browser.tabs.highlight.called, 'not called'); - assert.isTrue(updateFunc.called, 'called'); + assert.strictEqual(moveFunc.called, true, 'called'); + assert.strictEqual(dupeFunc.called, true, 'called'); + assert.strictEqual(browser.tabs.highlight.called, false, 'not called'); + assert.strictEqual(updateFunc.called, true, 'called'); assert.deepEqual(res, { id: 15 }, 'result'); @@ -4141,7 +4139,7 @@ describe('dnd', () => { type: 'foo' }; const res = func(evt); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should throw', () => { @@ -4280,11 +4278,11 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isFalse(preventDefault.called, 'called'); - assert.isFalse(stopPropagation.called, 'called'); - assert.isFalse(getCurrentWin.called, 'not called'); - assert.isFalse(portPostMsg.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(preventDefault.called, false, 'called'); + assert.strictEqual(stopPropagation.called, false, 'called'); + assert.strictEqual(getCurrentWin.called, false, 'not called'); + assert.strictEqual(portPostMsg.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -4414,11 +4412,11 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isFalse(preventDefault.called, 'called'); - assert.isFalse(stopPropagation.called, 'called'); - assert.isFalse(getCurrentWin.called, 'not called'); - assert.isFalse(portPostMsg.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(preventDefault.called, false, 'called'); + assert.strictEqual(stopPropagation.called, false, 'called'); + assert.strictEqual(getCurrentWin.called, false, 'not called'); + assert.strictEqual(portPostMsg.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -4549,11 +4547,11 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isFalse(getCurrentWin.called, 'not called'); - assert.isFalse(portPostMsg.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, false, 'not called'); + assert.strictEqual(portPostMsg.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -4687,10 +4685,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -4831,10 +4829,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -4975,10 +4973,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5121,10 +5119,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5268,10 +5266,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5414,10 +5412,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5560,10 +5558,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5714,10 +5712,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5849,10 +5847,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -5990,10 +5988,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -6125,10 +6123,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -6266,10 +6264,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -6400,10 +6398,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); @@ -6534,10 +6532,10 @@ describe('dnd', () => { const res = await func(evt, { windowId: 1 }); - assert.isTrue(preventDefault.called, 'called'); - assert.isTrue(stopPropagation.called, 'called'); - assert.isTrue(getCurrentWin.called, 'called'); - assert.isTrue(portPostMsg.called, 'called'); + assert.strictEqual(preventDefault.called, true, 'called'); + assert.strictEqual(stopPropagation.called, true, 'called'); + assert.strictEqual(getCurrentWin.called, true, 'called'); + assert.strictEqual(portPostMsg.called, true, 'called'); assert.deepEqual(res, {}, 'result'); }); }); @@ -6558,7 +6556,7 @@ describe('dnd', () => { type: 'foo' }; await func(evt); - assert.isTrue(elm.classList.contains(DROP_TARGET), 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), true, 'class'); }); it('should remove class', async () => { @@ -6574,7 +6572,7 @@ describe('dnd', () => { type: 'dragend' }; await func(evt); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'class'); }); }); @@ -6595,7 +6593,7 @@ describe('dnd', () => { type: 'foo' }; func(evt); - assert.isTrue(elm.classList.contains(DROP_TARGET), 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), true, 'class'); }); it('should remove class', () => { @@ -6612,7 +6610,7 @@ describe('dnd', () => { type: 'dragleave' }; func(evt); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'class'); }); it('should remove class', () => { @@ -6632,7 +6630,8 @@ describe('dnd', () => { type: 'dragleave' }; func(evt); - assert.isFalse(heading.classList.contains(DROP_TARGET), 'class'); + assert.strictEqual(heading.classList.contains(DROP_TARGET), false, + 'class'); }); it('should not remove class', () => { @@ -6652,7 +6651,7 @@ describe('dnd', () => { type: 'dragleave' }; func(evt); - assert.isTrue(elm.classList.contains(DROP_TARGET), 'class'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), true, 'class'); }); }); @@ -6702,10 +6701,12 @@ describe('dnd', () => { func(evt, { windowId: 1 }); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); - assert.isUndefined(evt.dataTransfer.dropEffect, 'drop effect'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); + assert.strictEqual(evt.dataTransfer.dropEffect, undefined, 'drop effect'); assert.strictEqual(preventDefault.callCount, i, 'not called'); assert.strictEqual(stopPropagation.callCount, j, 'not called'); }); @@ -6753,13 +6754,18 @@ describe('dnd', () => { func(evt, { windowId: 1 }); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); - assert.isFalse(heading.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(heading.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(heading.classList.contains(DROP_TARGET_BEFORE), 'before'); - assert.isUndefined(evt.dataTransfer.dropEffect, 'drop effect'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); + assert.strictEqual(heading.classList.contains(DROP_TARGET), false, + 'target'); + assert.strictEqual(heading.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(heading.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); + assert.strictEqual(evt.dataTransfer.dropEffect, undefined, 'drop effect'); assert.strictEqual(preventDefault.callCount, i, 'not called'); assert.strictEqual(stopPropagation.callCount, j, 'not called'); }); @@ -6801,10 +6807,12 @@ describe('dnd', () => { func(evt, { windowId: 1 }); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); - assert.isUndefined(evt.dataTransfer.dropEffect, 'drop effect'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); + assert.strictEqual(evt.dataTransfer.dropEffect, undefined, 'drop effect'); assert.strictEqual(preventDefault.callCount, i, 'not called'); assert.strictEqual(stopPropagation.callCount, j, 'not called'); }); @@ -6847,9 +6855,11 @@ describe('dnd', () => { func(evt, { windowId: 1 }); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); assert.strictEqual(evt.dataTransfer.dropEffect, 'none', 'drop effect'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); @@ -6893,9 +6903,11 @@ describe('dnd', () => { func(evt, { windowId: 1 }); - assert.isTrue(elm.classList.contains(DROP_TARGET), 'target'); - assert.isTrue(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), true, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), true, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); assert.strictEqual(evt.dataTransfer.dropEffect, 'move', 'drop effect'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); @@ -6945,12 +6957,17 @@ describe('dnd', () => { func(evt, { windowId: 1 }); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); - assert.isTrue(heading.classList.contains(DROP_TARGET), 'target'); - assert.isTrue(heading.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(heading.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); + assert.strictEqual(heading.classList.contains(DROP_TARGET), true, + 'target'); + assert.strictEqual(heading.classList.contains(DROP_TARGET_AFTER), true, + 'after'); + assert.strictEqual(heading.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); assert.strictEqual(evt.dataTransfer.dropEffect, 'move', 'drop effect'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); @@ -6998,12 +7015,17 @@ describe('dnd', () => { func(evt, { windowId: 1 }); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); - assert.isFalse(heading.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(heading.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(heading.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); + assert.strictEqual(heading.classList.contains(DROP_TARGET), false, + 'target'); + assert.strictEqual(heading.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(heading.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); assert.strictEqual(evt.dataTransfer.dropEffect, 'move', 'drop effect'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); @@ -7047,9 +7069,11 @@ describe('dnd', () => { func(evt, { windowId: 1 }); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); assert.strictEqual(evt.dataTransfer.dropEffect, 'none', 'drop effect'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); @@ -7093,9 +7117,11 @@ describe('dnd', () => { func(evt, { windowId: 1 }); - assert.isTrue(elm.classList.contains(DROP_TARGET), 'target'); - assert.isTrue(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), true, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), true, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); assert.strictEqual(evt.dataTransfer.dropEffect, 'move', 'drop effect'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); @@ -7139,9 +7165,11 @@ describe('dnd', () => { func(evt, { windowId: 1 }); - assert.isTrue(elm.classList.contains(DROP_TARGET), 'target'); - assert.isTrue(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), true, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), true, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); assert.strictEqual(evt.dataTransfer.dropEffect, 'move', 'drop effect'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); @@ -7185,9 +7213,11 @@ describe('dnd', () => { func(evt, { windowId: 1 }); - assert.isTrue(elm.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isTrue(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), true, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), true, + 'before'); assert.strictEqual(evt.dataTransfer.dropEffect, 'move', 'drop effect'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); @@ -7232,9 +7262,11 @@ describe('dnd', () => { func(evt, { windowId: 1 }); - assert.isTrue(elm.classList.contains(DROP_TARGET), 'target'); - assert.isTrue(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), true, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), true, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); assert.strictEqual(evt.dataTransfer.dropEffect, 'copy', 'drop effect'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); @@ -7280,9 +7312,11 @@ describe('dnd', () => { isMac: true, windowId: 1 }); - assert.isTrue(elm.classList.contains(DROP_TARGET), 'target'); - assert.isTrue(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), true, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), true, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); assert.strictEqual(evt.dataTransfer.dropEffect, 'copy', 'drop effect'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); @@ -7321,9 +7355,11 @@ describe('dnd', () => { type: 'dragover' }; func(evt); - assert.isTrue(elm.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), true, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); }); @@ -7367,12 +7403,17 @@ describe('dnd', () => { type: 'dragover' }; func(evt); - assert.isFalse(elm.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); - assert.isTrue(heading.classList.contains(DROP_TARGET), 'target'); - assert.isTrue(heading.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(heading.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), false, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); + assert.strictEqual(heading.classList.contains(DROP_TARGET), true, + 'target'); + assert.strictEqual(heading.classList.contains(DROP_TARGET_AFTER), true, + 'after'); + assert.strictEqual(heading.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); }); @@ -7410,9 +7451,11 @@ describe('dnd', () => { type: 'dragover' }; func(evt); - assert.isTrue(elm.classList.contains(DROP_TARGET), 'target'); - assert.isFalse(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isTrue(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), true, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), false, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), true, + 'before'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); }); @@ -7450,9 +7493,11 @@ describe('dnd', () => { type: 'dragover' }; func(evt); - assert.isTrue(elm.classList.contains(DROP_TARGET), 'target'); - assert.isTrue(elm.classList.contains(DROP_TARGET_AFTER), 'after'); - assert.isFalse(elm.classList.contains(DROP_TARGET_BEFORE), 'before'); + assert.strictEqual(elm.classList.contains(DROP_TARGET), true, 'target'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_AFTER), true, + 'after'); + assert.strictEqual(elm.classList.contains(DROP_TARGET_BEFORE), false, + 'before'); assert.strictEqual(preventDefault.callCount, i + 1, 'called'); assert.strictEqual(stopPropagation.callCount, j + 1, 'called'); }); @@ -7504,7 +7549,7 @@ describe('dnd', () => { const res = func({ type: 'foo' }); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should get empty array', async () => { diff --git a/test/tab-group.test.js b/test/tab-group.test.js index 17bacec3..00d62abd 100644 --- a/test/tab-group.test.js +++ b/test/tab-group.test.js @@ -4,21 +4,20 @@ /* eslint-disable import-x/order */ /* api */ -import sinon from 'sinon'; -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; +import sinon from 'sinon'; import { browser, createJsdom, mockPort } from './mocha/setup.js'; /* test */ import * as mjs from '../src/mjs/tab-group.js'; import { - ACTIVE, BOOKMARK_FOLDER_MSG, - CLASS_COLLAPSE_AUTO, CLASS_GROUP, CLASS_HEADING, CLASS_HEADING_LABEL, - CLASS_HEADING_LABEL_EDIT, CLASS_TAB_COLLAPSED, CLASS_TAB_CONTAINER, - CLASS_TAB_CONTAINER_TMPL, CLASS_TAB_CONTEXT, CLASS_TAB_GROUP, CLASS_UNGROUP, - DROP_TARGET, DROP_TARGET_AFTER, HIGHLIGHTED, MIME_JSON, MIME_PLAIN, PINNED, - SIDEBAR, TAB, TAB_GROUP_COLLAPSE, TAB_GROUP_ENABLE, TAB_GROUP_EXPAND, - TAB_GROUP_LABEL_EDIT + ACTIVE, BOOKMARK_FOLDER_MSG, CLASS_COLLAPSE_AUTO, CLASS_GROUP, CLASS_HEADING, + CLASS_HEADING_LABEL, CLASS_HEADING_LABEL_EDIT, CLASS_TAB_COLLAPSED, + CLASS_TAB_CONTAINER, CLASS_TAB_CONTAINER_TMPL, CLASS_TAB_CONTEXT, + CLASS_TAB_GROUP, CLASS_UNGROUP, DROP_TARGET, DROP_TARGET_AFTER, HIGHLIGHTED, + MIME_JSON, MIME_PLAIN, PINNED, SIDEBAR, TAB, TAB_GROUP_COLLAPSE, + TAB_GROUP_ENABLE, TAB_GROUP_EXPAND, TAB_GROUP_LABEL_EDIT } from '../src/mjs/constant.js'; describe('tab-group', () => { @@ -50,10 +49,6 @@ describe('tab-group', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('restore sidebar tab containers', () => { const func = mjs.restoreTabContainers; @@ -85,10 +80,13 @@ describe('tab-group', () => { await func(); assert.strictEqual(body.childElementCount, 3, 'child count'); assert.deepEqual(elm.parentNode, body, 'pinned'); - assert.isNull(elm2.parentNode, 'removed'); - assert.isFalse(elm3.classList.contains(CLASS_TAB_GROUP), 'remove class'); - assert.isTrue(elm4.classList.contains(CLASS_TAB_GROUP), 'add class'); - assert.isTrue(body.classList.contains(CLASS_GROUP), 'add group'); + assert.strictEqual(elm2.parentNode, null, 'removed'); + assert.strictEqual(elm3.classList.contains(CLASS_TAB_GROUP), false, + 'remove class'); + assert.strictEqual(elm4.classList.contains(CLASS_TAB_GROUP), true, + 'add class'); + assert.strictEqual(body.classList.contains(CLASS_GROUP), true, + 'add group'); }); it('should call function', async () => { @@ -117,10 +115,13 @@ describe('tab-group', () => { await func(); assert.strictEqual(body.childElementCount, 3, 'child count'); assert.deepEqual(elm.parentNode, body, 'pinned'); - assert.isNull(elm2.parentNode, 'removed'); - assert.isFalse(elm3.classList.contains(CLASS_TAB_GROUP), 'remove class'); - assert.isFalse(elm4.classList.contains(CLASS_TAB_GROUP), 'add class'); - assert.isFalse(body.classList.contains(CLASS_GROUP), 'remove group'); + assert.strictEqual(elm2.parentNode, null, 'removed'); + assert.strictEqual(elm3.classList.contains(CLASS_TAB_GROUP), false, + 'remove class'); + assert.strictEqual(elm4.classList.contains(CLASS_TAB_GROUP), false, + 'add class'); + assert.strictEqual(body.classList.contains(CLASS_GROUP), false, + 'remove group'); }); }); @@ -129,7 +130,7 @@ describe('tab-group', () => { it('should not call function', async () => { await func(); - assert.isFalse(browser.i18n.getMessage.called, 'result'); + assert.strictEqual(browser.i18n.getMessage.called, false, 'result'); }); it('should not call function', () => { @@ -137,7 +138,7 @@ describe('tab-group', () => { const body = document.querySelector('body'); body.appendChild(elm); func(elm); - assert.isFalse(browser.i18n.getMessage.called, 'result'); + assert.strictEqual(browser.i18n.getMessage.called, false, 'result'); }); it('should set value', () => { @@ -159,7 +160,8 @@ describe('tab-group', () => { elm.appendChild(elm2); body.appendChild(elm); func(elm); - assert.isTrue(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 2, 'called'); assert.strictEqual(elm3.title, 'foo', 'title'); assert.strictEqual(elm4.alt, 'bar', 'alt'); @@ -183,8 +185,9 @@ describe('tab-group', () => { elm.appendChild(elm2); body.appendChild(elm); func(elm, true); - assert.isTrue(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(elm2.classList.contains(ACTIVE), 'active'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(elm2.classList.contains(ACTIVE), true, 'active'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 2, 'called'); assert.strictEqual(elm3.title, 'foo', 'title'); assert.strictEqual(elm4.alt, 'bar', 'alt'); @@ -208,8 +211,9 @@ describe('tab-group', () => { elm.appendChild(elm2); body.appendChild(elm); func(elm, false); - assert.isTrue(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(elm2.classList.contains(ACTIVE), 'active'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(elm2.classList.contains(ACTIVE), false, 'active'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 2, 'called'); assert.strictEqual(elm3.title, 'foo', 'title'); assert.strictEqual(elm4.alt, 'bar', 'alt'); @@ -232,7 +236,8 @@ describe('tab-group', () => { body.appendChild(elm); body.classList.add(CLASS_UNGROUP); func(elm); - assert.isFalse(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); assert.strictEqual(browser.i18n.getMessage.callCount, i, 'not called'); }); }); @@ -242,7 +247,7 @@ describe('tab-group', () => { it('should not call function', () => { func(); - assert.isFalse(browser.i18n.getMessage.called, 'result'); + assert.strictEqual(browser.i18n.getMessage.called, false, 'result'); }); it('should not call function', () => { @@ -250,7 +255,7 @@ describe('tab-group', () => { const body = document.querySelector('body'); body.appendChild(elm); func(elm); - assert.isFalse(browser.i18n.getMessage.called, 'result'); + assert.strictEqual(browser.i18n.getMessage.called, false, 'result'); }); it('should set value', () => { @@ -277,7 +282,8 @@ describe('tab-group', () => { elm.appendChild(elm2); body.appendChild(elm); func(elm); - assert.isFalse(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 2, 'called'); assert.strictEqual(elm3.title, 'foo', 'title'); assert.strictEqual(elm4.alt, 'bar', 'alt'); @@ -308,8 +314,10 @@ describe('tab-group', () => { elm.appendChild(elm2); body.appendChild(elm); func(elm); - assert.isFalse(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(elm1.classList.contains(ACTIVE), 'heading class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(elm1.classList.contains(ACTIVE), false, + 'heading class'); assert.strictEqual(browser.i18n.getMessage.callCount, i + 2, 'called'); assert.strictEqual(elm3.title, 'foo', 'title'); assert.strictEqual(elm4.alt, 'bar', 'alt'); @@ -326,7 +334,8 @@ describe('tab-group', () => { body.classList.add(CLASS_UNGROUP); const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isFalse(body.classList.contains(CLASS_UNGROUP), 'class'); + assert.strictEqual(body.classList.contains(CLASS_UNGROUP), false, + 'class'); assert.deepEqual(res, [], 'result'); }); @@ -341,7 +350,8 @@ describe('tab-group', () => { body.classList.add(CLASS_UNGROUP); const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isFalse(body.classList.contains(CLASS_UNGROUP), 'class'); + assert.strictEqual(body.classList.contains(CLASS_UNGROUP), false, + 'class'); assert.deepEqual(res, [], 'result'); }); @@ -379,9 +389,12 @@ describe('tab-group', () => { body.classList.add(CLASS_UNGROUP); const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isTrue(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(elm2.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(body.classList.contains(CLASS_UNGROUP), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(elm2.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(body.classList.contains(CLASS_UNGROUP), false, + 'class'); assert.deepEqual(res, [undefined, undefined], 'result'); }); @@ -419,9 +432,11 @@ describe('tab-group', () => { body.classList.remove(CLASS_UNGROUP); const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isFalse(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(elm2.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(body.classList.contains(CLASS_UNGROUP), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(elm2.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(body.classList.contains(CLASS_UNGROUP), true, 'class'); assert.deepEqual(res, [undefined, undefined], 'result'); }); }); @@ -464,7 +479,8 @@ describe('tab-group', () => { elm.appendChild(elm3); body.appendChild(elm); const res = await func(elm, true); - assert.isTrue(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); assert.strictEqual(elm4.title, 'foo', 'title'); assert.strictEqual(elm6.alt, 'bar', 'alt'); assert.strictEqual(browser.tabs.update.callCount, i + 1, 'called'); @@ -501,7 +517,8 @@ describe('tab-group', () => { elm.appendChild(elm3); body.appendChild(elm); const res = await func(elm2, true); - assert.isTrue(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); assert.strictEqual(elm4.title, 'foo', 'title'); assert.strictEqual(elm6.alt, 'bar', 'alt'); assert.strictEqual(browser.tabs.update.callCount, i + 1, 'called'); @@ -538,7 +555,8 @@ describe('tab-group', () => { elm.appendChild(elm3); body.appendChild(elm); const res = await func(elm3, true); - assert.isTrue(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); assert.strictEqual(elm4.title, 'foo', 'title'); assert.strictEqual(elm6.alt, 'bar', 'alt'); assert.strictEqual(browser.tabs.update.callCount, i + 1, 'called'); @@ -575,7 +593,8 @@ describe('tab-group', () => { elm.appendChild(elm3); body.appendChild(elm); const res = await func(elm, false); - assert.isTrue(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); assert.strictEqual(elm4.title, 'foo', 'title'); assert.strictEqual(elm6.alt, 'bar', 'alt'); assert.strictEqual(browser.tabs.update.callCount, i, 'not called'); @@ -613,7 +632,8 @@ describe('tab-group', () => { elm.appendChild(elm3); body.appendChild(elm); const res = await func(elm, true); - assert.isFalse(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); assert.strictEqual(elm4.title, 'baz', 'title'); assert.strictEqual(elm6.alt, 'qux', 'alt'); assert.strictEqual(browser.tabs.update.callCount, i + 1, 'called'); @@ -651,7 +671,8 @@ describe('tab-group', () => { elm.appendChild(elm3); body.appendChild(elm); const res = await func(elm2, true); - assert.isFalse(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); assert.strictEqual(elm4.title, 'baz', 'title'); assert.strictEqual(elm6.alt, 'qux', 'alt'); assert.strictEqual(browser.tabs.update.callCount, i + 1, 'called'); @@ -689,7 +710,8 @@ describe('tab-group', () => { elm.appendChild(elm3); body.appendChild(elm); const res = await func(elm3, true); - assert.isFalse(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); assert.strictEqual(elm4.title, 'baz', 'title'); assert.strictEqual(elm6.alt, 'qux', 'alt'); assert.strictEqual(browser.tabs.update.callCount, i + 1, 'called'); @@ -727,7 +749,8 @@ describe('tab-group', () => { elm.appendChild(elm3); body.appendChild(elm); const res = await func(elm, false); - assert.isFalse(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); assert.strictEqual(elm4.title, 'baz', 'title'); assert.strictEqual(elm6.alt, 'qux', 'alt'); assert.strictEqual(browser.tabs.update.callCount, i, 'not called'); @@ -833,9 +856,12 @@ describe('tab-group', () => { const res = await func(elm); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(browser.tabs.update.callCount, j + 1, 'called'); - assert.isFalse(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(elmB.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(elmC.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(elmB.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(elmC.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); assert.strictEqual(elm4.title, 'baz', 'title'); assert.strictEqual(elm6.alt, 'qux', 'alt'); assert.strictEqual(elmB4.title, 'foo', 'title'); @@ -920,9 +946,12 @@ describe('tab-group', () => { const res = await func(elmC); assert.strictEqual(browser.i18n.getMessage.callCount, i + 6, 'called'); assert.strictEqual(browser.tabs.update.callCount, j + 1, 'called'); - assert.isTrue(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(elmB.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(elmC.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(elmB.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(elmC.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); assert.strictEqual(elm4.title, 'foo', 'title'); assert.strictEqual(elm6.alt, 'bar', 'alt'); assert.strictEqual(elmB4.title, 'foo', 'title'); @@ -1009,9 +1038,12 @@ describe('tab-group', () => { const res = await func(elmC); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); assert.strictEqual(browser.tabs.update.callCount, j + 1, 'called'); - assert.isFalse(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(elmB.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isFalse(elmC.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(elmB.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(elmC.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); assert.strictEqual(elm4.title, 'quux', 'title'); assert.strictEqual(elm6.alt, 'corge', 'alt'); assert.strictEqual(elmB4.title, 'foo', 'title'); @@ -1114,9 +1146,12 @@ describe('tab-group', () => { body.appendChild(elmC); const res = await func(elm); assert.strictEqual(browser.i18n.getMessage.callCount, i + 4, 'called'); - assert.isFalse(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(elmB.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(elmC.classList.contains(CLASS_TAB_COLLAPSED), 'class'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(elmB.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(elmC.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); assert.strictEqual(elmB4.title, 'foo', 'title'); assert.strictEqual(elmB6.alt, 'bar', 'alt'); assert.strictEqual(elmC4.title, 'foo', 'title'); @@ -1162,11 +1197,11 @@ describe('tab-group', () => { target: elm }; const res = await func(evt); - assert.isFalse(preventDefault.called, 'event not prevented'); - assert.isFalse(stopPropagation.called, 'event not stopped'); - assert.isFalse(stubCurrentWin.called, 'not called current window'); - assert.isFalse(port.postMessage.called, 'not called msg'); - assert.isNull(res, 'result'); + assert.strictEqual(preventDefault.called, false, 'event not prevented'); + assert.strictEqual(stopPropagation.called, false, 'event not stopped'); + assert.strictEqual(stubCurrentWin.called, false, 'not called window'); + assert.strictEqual(port.postMessage.called, false, 'not called msg'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1196,10 +1231,10 @@ describe('tab-group', () => { target: elm }; const res = await func(evt); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); - assert.isTrue(stubCurrentWin.calledOnce, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, {}, 'result'); }); @@ -1234,10 +1269,10 @@ describe('tab-group', () => { target: elm }; const res = await func(evt); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); - assert.isTrue(stubCurrentWin.calledOnce, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, {}, 'result'); }); @@ -1275,10 +1310,10 @@ describe('tab-group', () => { target: elm }; const res = await func(evt); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); - assert.isTrue(stubCurrentWin.calledOnce, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, {}, 'result'); }); @@ -1322,10 +1357,10 @@ describe('tab-group', () => { target: elm }; const res = await func(evt); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); - assert.isTrue(stubCurrentWin.calledOnce, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, {}, 'result'); }); @@ -1372,10 +1407,10 @@ describe('tab-group', () => { target: elm }; const res = await func(evt); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); - assert.isTrue(stubCurrentWin.calledOnce, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, {}, 'result'); }); }); @@ -1415,12 +1450,12 @@ describe('tab-group', () => { target: elm }; const res = await func(evt); - assert.isFalse(preventDefault.called, 'event not prevented'); - assert.isFalse(stopPropagation.called, 'event not stopped'); + assert.strictEqual(preventDefault.called, false, 'event not prevented'); + assert.strictEqual(stopPropagation.called, false, 'event not stopped'); assert.strictEqual(browser.tabs.update.callCount, i, 'not called'); - assert.isFalse(stubCurrentWin.called, 'not called current window'); - assert.isFalse(port.postMessage.called, 'not called msg'); - assert.isNull(res, 'result'); + assert.strictEqual(stubCurrentWin.called, false, 'not called window'); + assert.strictEqual(port.postMessage.called, false, 'not called msg'); + assert.strictEqual(res, null, 'result'); }); it('should call functions', async () => { @@ -1506,14 +1541,17 @@ describe('tab-group', () => { target: elm }; const res = await func(evt); - assert.isTrue(preventDefault.calledOnce, 'event prevented'); - assert.isTrue(stopPropagation.calledOnce, 'event stopped'); + assert.strictEqual(preventDefault.calledOnce, true, 'event prevented'); + assert.strictEqual(stopPropagation.calledOnce, true, 'event stopped'); assert.strictEqual(browser.tabs.update.callCount, i + 1, 'called'); - assert.isFalse(elm.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(elmB.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(elmC.classList.contains(CLASS_TAB_COLLAPSED), 'class'); - assert.isTrue(stubCurrentWin.calledOnce, 'called current winddow'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_COLLAPSED), false, + 'class'); + assert.strictEqual(elmB.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(elmC.classList.contains(CLASS_TAB_COLLAPSED), true, + 'class'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called winddow'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, {}, 'result'); }); }); @@ -1528,8 +1566,8 @@ describe('tab-group', () => { const spy2 = sinon.spy(elm, 'removeEventListener'); body.appendChild(elm); await func(); - assert.isFalse(spy.called, 'not called'); - assert.isFalse(spy2.called, 'not called'); + assert.strictEqual(spy.called, false, 'not called'); + assert.strictEqual(spy2.called, false, 'not called'); elm.addEventListener.restore(); elm.removeEventListener.restore(); }); @@ -1541,8 +1579,8 @@ describe('tab-group', () => { const spy2 = sinon.spy(elm, 'removeEventListener'); body.appendChild(elm); await func(elm); - assert.isFalse(spy.called, 'not called'); - assert.isFalse(spy2.called, 'not called'); + assert.strictEqual(spy.called, false, 'not called'); + assert.strictEqual(spy2.called, false, 'not called'); elm.addEventListener.restore(); elm.removeEventListener.restore(); }); @@ -1554,8 +1592,8 @@ describe('tab-group', () => { const spy2 = sinon.spy(elm, 'removeEventListener'); body.appendChild(elm); await func(elm, true); - assert.isFalse(spy.called, 'not called'); - assert.isFalse(spy2.called, 'not called'); + assert.strictEqual(spy.called, false, 'not called'); + assert.strictEqual(spy2.called, false, 'not called'); elm.addEventListener.restore(); elm.removeEventListener.restore(); }); @@ -1568,8 +1606,8 @@ describe('tab-group', () => { elm.classList.add(CLASS_TAB_CONTEXT); body.appendChild(elm); await func(elm); - assert.isTrue(spy.calledOnce, 'called'); - assert.isTrue(spy2.calledOnce, 'called'); + assert.strictEqual(spy.calledOnce, true, 'called'); + assert.strictEqual(spy2.calledOnce, true, 'called'); elm.addEventListener.restore(); elm.removeEventListener.restore(); }); @@ -1582,8 +1620,8 @@ describe('tab-group', () => { elm.classList.add(CLASS_TAB_CONTEXT); body.appendChild(elm); await func(elm, true); - assert.isTrue(spy.calledOnce, 'called'); - assert.isTrue(spy2.calledOnce, 'called'); + assert.strictEqual(spy.calledOnce, true, 'called'); + assert.strictEqual(spy2.calledOnce, true, 'called'); elm.addEventListener.restore(); elm.removeEventListener.restore(); }); @@ -1596,8 +1634,8 @@ describe('tab-group', () => { elm.classList.add(CLASS_HEADING_LABEL); body.appendChild(elm); await func(elm); - assert.isTrue(spy.calledOnce, 'called'); - assert.isTrue(spy2.calledOnce, 'called'); + assert.strictEqual(spy.calledOnce, true, 'called'); + assert.strictEqual(spy2.calledOnce, true, 'called'); elm.addEventListener.restore(); elm.removeEventListener.restore(); }); @@ -1610,8 +1648,8 @@ describe('tab-group', () => { elm.classList.add(CLASS_HEADING_LABEL); body.appendChild(elm); await func(elm, true); - assert.isTrue(spy.calledOnce, 'called'); - assert.isTrue(spy2.calledOnce, 'called'); + assert.strictEqual(spy.calledOnce, true, 'called'); + assert.strictEqual(spy2.calledOnce, true, 'called'); elm.addEventListener.restore(); elm.removeEventListener.restore(); }); @@ -1627,8 +1665,8 @@ describe('tab-group', () => { const spy2 = sinon.spy(elm, 'removeEventListener'); body.appendChild(elm); const res = await func(false); - assert.isFalse(spy.called, 'not called'); - assert.isFalse(spy2.called, 'not called'); + assert.strictEqual(spy.called, false, 'not called'); + assert.strictEqual(spy2.called, false, 'not called'); assert.deepEqual(res, [], 'result'); elm.addEventListener.restore(); elm.removeEventListener.restore(); @@ -1641,8 +1679,8 @@ describe('tab-group', () => { const spy2 = sinon.spy(elm, 'removeEventListener'); body.appendChild(elm); const res = await func(true); - assert.isFalse(spy.called, 'not called'); - assert.isFalse(spy2.called, 'not called'); + assert.strictEqual(spy.called, false, 'not called'); + assert.strictEqual(spy2.called, false, 'not called'); assert.deepEqual(res, [], 'result'); elm.addEventListener.restore(); elm.removeEventListener.restore(); @@ -1803,8 +1841,8 @@ describe('tab-group', () => { assert.strictEqual(spy2.callCount, j + 1, 'called'); assert.strictEqual(spy3.callCount, k + 1, 'called'); assert.strictEqual(spy4.callCount, l + 1, 'called'); - assert.isFalse(parent.hasAttribute('data-multi'), 'dataset'); - assert.isFalse(parent2.hasAttribute('data-multi'), 'dataset'); + assert.strictEqual(parent.hasAttribute('data-multi'), false, 'dataset'); + assert.strictEqual(parent2.hasAttribute('data-multi'), false, 'dataset'); assert.deepEqual(res, [undefined, undefined], 'result'); elm.addEventListener.restore(); elm.removeEventListener.restore(); @@ -1838,8 +1876,8 @@ describe('tab-group', () => { assert.strictEqual(spy2.callCount, j, 'not called'); assert.strictEqual(spy3.callCount, k + 1, 'called'); assert.strictEqual(spy4.callCount, l + 1, 'called'); - assert.isFalse(parent.hasAttribute('data-multi'), 'dataset'); - assert.isFalse(parent2.hasAttribute('data-multi'), 'dataset'); + assert.strictEqual(parent.hasAttribute('data-multi'), false, 'dataset'); + assert.strictEqual(parent2.hasAttribute('data-multi'), false, 'dataset'); assert.deepEqual(res, [undefined], 'result'); elm.addEventListener.restore(); elm.removeEventListener.restore(); @@ -1872,9 +1910,9 @@ describe('tab-group', () => { assert.strictEqual(spy2.callCount, j + 1, 'called'); assert.strictEqual(spy3.callCount, k + 1, 'called'); assert.strictEqual(spy4.callCount, l + 1, 'called'); - assert.isTrue(parent.hasAttribute('data-multi'), 'dataset'); + assert.strictEqual(parent.hasAttribute('data-multi'), true, 'dataset'); assert.strictEqual(parent.dataset.multi, 'true', 'dataset value'); - assert.isTrue(parent2.hasAttribute('data-multi'), 'dataset'); + assert.strictEqual(parent2.hasAttribute('data-multi'), true, 'dataset'); assert.strictEqual(parent2.dataset.multi, 'true', 'dataset value'); assert.deepEqual(res, [undefined, undefined], 'result'); elm.addEventListener.restore(); @@ -1909,8 +1947,8 @@ describe('tab-group', () => { assert.strictEqual(spy2.callCount, j, 'not called'); assert.strictEqual(spy3.callCount, k + 1, 'called'); assert.strictEqual(spy4.callCount, l + 1, 'called'); - assert.isFalse(parent.hasAttribute('data-multi'), 'dataset'); - assert.isTrue(parent2.hasAttribute('data-multi'), 'dataset'); + assert.strictEqual(parent.hasAttribute('data-multi'), false, 'dataset'); + assert.strictEqual(parent2.hasAttribute('data-multi'), true, 'dataset'); assert.strictEqual(parent2.dataset.multi, 'true', 'dataset value'); assert.deepEqual(res, [undefined], 'result'); elm.addEventListener.restore(); @@ -1925,7 +1963,7 @@ describe('tab-group', () => { it('should get null', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function if parent is not collapsed', async () => { @@ -1944,7 +1982,7 @@ describe('tab-group', () => { parent.appendChild(elm2); body.appendChild(parent); const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function if active tab is first child', async () => { @@ -1964,7 +2002,7 @@ describe('tab-group', () => { parent.appendChild(elm2); body.appendChild(parent); const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -2001,7 +2039,7 @@ describe('tab-group', () => { it('should get null if no argument given', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -2011,7 +2049,7 @@ describe('tab-group', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(elm); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get result', async () => { @@ -2023,7 +2061,7 @@ describe('tab-group', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(elm); - assert.isTrue(res === elm, 'result'); + assert.deepEqual(res, elm, 'result'); }); it('should get result', async () => { @@ -2038,7 +2076,7 @@ describe('tab-group', () => { parent.appendChild(elm2); body.appendChild(parent); const res = await func(elm2); - assert.isTrue(res === elm, 'result'); + assert.deepEqual(res, elm, 'result'); }); }); @@ -2070,10 +2108,10 @@ describe('tab-group', () => { preventDefault: stub }; const res = await func(evt); - assert.isFalse(stub.called, 'not called'); - assert.isFalse(stubCurrentWin.called, 'not called current window'); - assert.isFalse(port.postMessage.called, 'not called msg'); - assert.isNull(res, 'result'); + assert.strictEqual(stub.called, false, 'not called'); + assert.strictEqual(stubCurrentWin.called, false, 'not called window'); + assert.strictEqual(port.postMessage.called, false, 'not called msg'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -2092,10 +2130,10 @@ describe('tab-group', () => { type: 'focus' }; const res = await func(evt); - assert.isFalse(stub.called, 'not called'); - assert.isFalse(stubCurrentWin.called, 'not called current window'); - assert.isFalse(port.postMessage.called, 'not called msg'); - assert.isNull(res, 'result'); + assert.strictEqual(stub.called, false, 'not called'); + assert.strictEqual(stubCurrentWin.called, false, 'not called window'); + assert.strictEqual(port.postMessage.called, false, 'not called msg'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -2114,10 +2152,10 @@ describe('tab-group', () => { type: 'blur' }; const res = await func(evt); - assert.isFalse(stub.called, 'not called'); - assert.isFalse(stubCurrentWin.called, 'not called current window'); - assert.isFalse(port.postMessage.called, 'not called msg'); - assert.isNull(res, 'result'); + assert.strictEqual(stub.called, false, 'not called'); + assert.strictEqual(stubCurrentWin.called, false, 'not called window'); + assert.strictEqual(port.postMessage.called, false, 'not called msg'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -2138,10 +2176,10 @@ describe('tab-group', () => { type: 'keydown' }; const res = await func(evt); - assert.isFalse(stub.called, 'not called'); - assert.isFalse(stubCurrentWin.called, 'not called current window'); - assert.isFalse(port.postMessage.called, 'not called msg'); - assert.isNull(res, 'result'); + assert.strictEqual(stub.called, false, 'not called'); + assert.strictEqual(stubCurrentWin.called, false, 'not called window'); + assert.strictEqual(port.postMessage.called, false, 'not called msg'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -2175,11 +2213,11 @@ describe('tab-group', () => { type: 'blur' }; const res = await func(evt); - assert.isTrue(stub.calledOnce, 'called preventDefault'); - assert.isTrue(spy.calledThrice, 'called removeEventListener'); - assert.isTrue(spy2.calledOnce, 'called addEventListener'); - assert.isTrue(stubCurrentWin.calledOnce, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(stub.calledOnce, true, 'called preventDefault'); + assert.strictEqual(spy.calledThrice, true, 'called removeEventListener'); + assert.strictEqual(spy2.calledOnce, true, 'called addEventListener'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, {}, 'result'); }); @@ -2216,11 +2254,11 @@ describe('tab-group', () => { type: 'keydown' }; const res = await func(evt); - assert.isTrue(stub.calledOnce, 'called preventDefault'); - assert.isTrue(spy.calledThrice, 'called removeEventListener'); - assert.isTrue(spy2.calledOnce, 'called addEventListener'); - assert.isTrue(stubCurrentWin.calledOnce, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(stub.calledOnce, true, 'called preventDefault'); + assert.strictEqual(spy.calledThrice, true, 'called removeEventListener'); + assert.strictEqual(spy2.calledOnce, true, 'called addEventListener'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, {}, 'result'); }); @@ -2258,11 +2296,11 @@ describe('tab-group', () => { type: 'keydown' }; const res = await func(evt); - assert.isTrue(stub.calledOnce, 'called preventDefault'); - assert.isTrue(spy.calledThrice, 'called removeEventListener'); - assert.isTrue(spy2.calledOnce, 'called addEventListener'); - assert.isTrue(stubCurrentWin.calledOnce, 'called current window'); - assert.isTrue(port.postMessage.calledOnce, 'called msg'); + assert.strictEqual(stub.calledOnce, true, 'called preventDefault'); + assert.strictEqual(spy.calledThrice, true, 'called removeEventListener'); + assert.strictEqual(spy2.calledOnce, true, 'called addEventListener'); + assert.strictEqual(stubCurrentWin.calledOnce, true, 'called window'); + assert.strictEqual(port.postMessage.calledOnce, true, 'called msg'); assert.deepEqual(res, {}, 'result'); }); }); @@ -2272,7 +2310,7 @@ describe('tab-group', () => { it('get null', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -2280,7 +2318,7 @@ describe('tab-group', () => { const body = document.querySelector('body'); body.appendChild(elm); const res = await func(elm); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -2298,9 +2336,9 @@ describe('tab-group', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(elm); - assert.isFalse(spy.called, 'not called'); - assert.isFalse(spy2.called, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(spy.called, false, 'not called'); + assert.strictEqual(spy2.called, false, 'not called'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -2318,8 +2356,8 @@ describe('tab-group', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(elm); - assert.isTrue(spy.calledTwice, 'called addEventListener'); - assert.isTrue(spy2.calledTwice, 'called removeEventListener'); + assert.strictEqual(spy.callCount, 2, 'called addEventListener'); + assert.strictEqual(spy2.callCount, 2, 'called removeEventListener'); assert.deepEqual(res, child, 'result'); }); }); @@ -2339,7 +2377,7 @@ describe('tab-group', () => { target: elm }; const res = await func(evt); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -2362,7 +2400,7 @@ describe('tab-group', () => { target: button }; const res = await func(evt); - assert.isTrue(spy.calledTwice, 'called addEventListener'); + assert.strictEqual(spy.callCount, 2, 'called addEventListener'); assert.deepEqual(res, child, 'result'); }); }); @@ -2672,10 +2710,13 @@ describe('tab-group', () => { parent.appendChild(elm); body.appendChild(parent); func(parent); - assert.isTrue(elm.hasAttribute('data-multi'), 'dataset'); - assert.isFalse(spy.called, 'not called child removeEventListener'); - assert.isFalse(spy2.called, 'not called button removeEventListener'); - assert.isFalse(spy3.called, 'not called context removeEventListener'); + assert.strictEqual(elm.hasAttribute('data-multi'), true, 'dataset'); + assert.strictEqual(spy.called, false, + 'not called child removeEventListener'); + assert.strictEqual(spy2.called, false, + 'not called button removeEventListener'); + assert.strictEqual(spy3.called, false, + 'not called context removeEventListener'); }); it('should call function', () => { @@ -2760,9 +2801,11 @@ describe('tab-group', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(parent); - assert.isTrue(spy.calledTwice, 'called child removeEventListener'); - assert.isTrue(spy2.calledOnce, 'called button removeEventListener'); - assert.isTrue(spy3.calledTwice, 'called context removeEventListener'); + assert.strictEqual(spy.callCount, 2, 'called child removeEventListener'); + assert.strictEqual(spy2.calledOnce, true, + 'called button removeEventListener'); + assert.strictEqual(spy3.callCount, 2, + 'called context removeEventListener'); assert.strictEqual(msg.callCount, i + 1, 'called msg'); assert.strictEqual(button.title, 'foo', 'title'); assert.deepEqual(res, [undefined], 'result'); @@ -2788,7 +2831,7 @@ describe('tab-group', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(parent); - assert.isFalse(elm.hasAttribute('data-multi'), 'dataset'); + assert.strictEqual(elm.hasAttribute('data-multi'), false, 'dataset'); assert.strictEqual(msg.callCount, i + 1, 'called msg'); assert.strictEqual(button.title, 'foo', 'title'); assert.deepEqual(res, [undefined, child], 'result'); @@ -2816,7 +2859,7 @@ describe('tab-group', () => { const res = await func(parent, { multi: true }); - assert.isTrue(elm.hasAttribute('data-multi'), 'dataset'); + assert.strictEqual(elm.hasAttribute('data-multi'), true, 'dataset'); assert.strictEqual(elm.dataset.multi, 'true', 'dataset value'); assert.strictEqual(msg.callCount, i + 1, 'called msg'); assert.strictEqual(button.title, 'foo', 'title'); @@ -2833,7 +2876,7 @@ describe('tab-group', () => { elm.classList.add(CLASS_TAB_CONTAINER, PINNED, CLASS_COLLAPSE_AUTO); body.appendChild(elm); await func(); - assert.isFalse(elm.classList.contains(CLASS_COLLAPSE_AUTO)); + assert.strictEqual(elm.classList.contains(CLASS_COLLAPSE_AUTO), false); }); it('should add class', async () => { @@ -2842,7 +2885,7 @@ describe('tab-group', () => { elm.classList.add(CLASS_TAB_CONTAINER, PINNED); body.appendChild(elm); await func(true); - assert.isTrue(elm.classList.contains(CLASS_COLLAPSE_AUTO)); + assert.strictEqual(elm.classList.contains(CLASS_COLLAPSE_AUTO), true); }); }); @@ -2851,7 +2894,7 @@ describe('tab-group', () => { it('should get null', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -2869,7 +2912,7 @@ describe('tab-group', () => { const res = await func(label); assert.strictEqual(browser.bookmarks.create.callCount, i, 'not called create'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -2911,7 +2954,7 @@ describe('tab-group', () => { const res = await func(elm); assert.strictEqual(browser.bookmarks.create.callCount, i, 'not called create'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -3080,7 +3123,7 @@ describe('tab-group', () => { it('should get null', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -3169,7 +3212,7 @@ describe('tab-group', () => { it('should get null', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -3186,7 +3229,7 @@ describe('tab-group', () => { body.appendChild(sect); const res = await func(label); assert.strictEqual(browser.tabs.remove.callCount, i, 'not called remove'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -3215,7 +3258,7 @@ describe('tab-group', () => { body.appendChild(sect); const res = await func(elm); assert.strictEqual(browser.tabs.remove.callCount, i + 1, 'called remove'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -3238,7 +3281,7 @@ describe('tab-group', () => { it('should get null if tab is not contained', async () => { const res = await func(['foo']); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not detatch pinned tab', async () => { @@ -3265,7 +3308,7 @@ describe('tab-group', () => { const res = await func([elm2], 1); assert.strictEqual(browser.tabs.move.callCount, i, 'not called'); assert.strictEqual(elm.childElementCount, 2, 'child'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function if tab is last child', async () => { @@ -3292,7 +3335,7 @@ describe('tab-group', () => { const res = await func([elm3], 1); assert.strictEqual(browser.tabs.move.callCount, i, 'not called'); assert.strictEqual(elm.childElementCount, 2, 'child'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -3318,7 +3361,7 @@ describe('tab-group', () => { const res = await func([elm2], 1); assert.strictEqual(browser.tabs.move.callCount, i + 1, 'called'); assert.strictEqual(elm.childElementCount, 1, 'child'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should call function', async () => { @@ -3344,7 +3387,7 @@ describe('tab-group', () => { const res = await func([elm2]); assert.strictEqual(browser.tabs.move.callCount, i + 1, 'called'); assert.strictEqual(elm.childElementCount, 1, 'child'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -3382,7 +3425,7 @@ describe('tab-group', () => { body.appendChild(elm); const res = await func(1); assert.strictEqual(elm.childElementCount, 3, 'child'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not group tabs if only one tab contained', async () => { @@ -3414,7 +3457,7 @@ describe('tab-group', () => { const res = await func(1); assert.strictEqual(elm.childElementCount, 2, 'child'); assert.strictEqual(elm2.childElementCount, 1, 'child'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should group tabs', async () => { @@ -3447,7 +3490,7 @@ describe('tab-group', () => { const res = await func(1); assert.strictEqual(elm.childElementCount, 1, 'child'); assert.strictEqual(elm2.childElementCount, 0, 'child'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should group tabs', async () => { @@ -3480,7 +3523,7 @@ describe('tab-group', () => { const res = await func(); assert.strictEqual(elm.childElementCount, 1, 'child'); assert.strictEqual(elm2.childElementCount, 0, 'child'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should group tabs', async () => { @@ -3513,7 +3556,7 @@ describe('tab-group', () => { const res = await func(); assert.strictEqual(elm.childElementCount, 2, 'child'); assert.strictEqual(elm2.childElementCount, 1, 'child'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -3522,7 +3565,7 @@ describe('tab-group', () => { it('should throw', async () => { await func().catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected Number but got Undefined.'); }); }); @@ -3548,7 +3591,7 @@ describe('tab-group', () => { assert.strictEqual(browser.tabs.query.withArgs(arg).callCount, i + 1, 'query'); assert.strictEqual(browser.tabs.move.callCount, j, 'not moved'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should group tabs', async () => { @@ -3605,7 +3648,7 @@ describe('tab-group', () => { assert.strictEqual(parent.nextElementSibling.childElementCount, 2, 'child'); assert.strictEqual(parent2.childElementCount, 0, 'child'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should group tabs', async () => { @@ -3660,7 +3703,7 @@ describe('tab-group', () => { assert.strictEqual(body.childElementCount, 3, 'parent'); assert.strictEqual(parent.childElementCount, 1, 'child'); assert.strictEqual(parent2.childElementCount, 2, 'child'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -3669,7 +3712,7 @@ describe('tab-group', () => { it('should throw', async () => { await func().catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected Number but got Undefined.'); }); }); @@ -3695,7 +3738,7 @@ describe('tab-group', () => { assert.strictEqual(browser.tabs.query.withArgs(arg).callCount, i, 'not called query'); assert.strictEqual(browser.tabs.move.callCount, j, 'not moved'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not group', async () => { @@ -3719,7 +3762,7 @@ describe('tab-group', () => { assert.strictEqual(browser.tabs.query.withArgs(arg).callCount, i + 1, 'query'); assert.strictEqual(browser.tabs.move.callCount, j, 'not moved'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should group tabs', async () => { @@ -3776,7 +3819,7 @@ describe('tab-group', () => { assert.strictEqual(parent.nextElementSibling.childElementCount, 2, 'child'); assert.strictEqual(parent2.childElementCount, 0, 'child'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should group tabs', async () => { @@ -3831,7 +3874,7 @@ describe('tab-group', () => { assert.strictEqual(body.childElementCount, 3, 'parent'); assert.strictEqual(parent.childElementCount, 1, 'child'); assert.strictEqual(parent2.childElementCount, 2, 'child'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -3841,7 +3884,7 @@ describe('tab-group', () => { it('should do nothing if argument is not element', async () => { const spy = sinon.spy(document, 'getElementById'); await func(); - assert.isFalse(spy.called, 'not called'); + assert.strictEqual(spy.called, false, 'not called'); document.getElementById.restore(); }); diff --git a/test/theme.test.js b/test/theme.test.js index 214a9874..6971cf1e 100644 --- a/test/theme.test.js +++ b/test/theme.test.js @@ -4,12 +4,12 @@ /* eslint-disable import-x/order, regexp/no-super-linear-backtracking */ /* api */ +import { strict as assert } from 'node:assert'; import path from 'node:path'; import { promises as fsPromise } from 'node:fs'; import { fileURLToPath } from 'node:url'; -import { assert } from 'chai'; -import { afterEach, beforeEach, describe, it } from 'mocha'; import { resolve } from '@asamuzakjp/css-color'; +import { afterEach, beforeEach, describe, it } from 'mocha'; import { sleep } from '../src/mjs/common.js'; import { browser, createJsdom } from './mocha/setup.js'; @@ -114,25 +114,23 @@ describe('theme', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('theme map', () => { it('should get object', async () => { - assert.isObject(mjs.themeMap, 'mjs.themeMap'); + assert.strictEqual(typeof mjs.themeMap, 'object', 'mjs.themeMap'); }); }); describe('current theme colors', () => { it('should get map', async () => { - assert.instanceOf(mjs.currentThemeColors, Map, 'currentThemeColors'); + assert.strictEqual(mjs.currentThemeColors instanceof Map, true, + 'currentThemeColors'); }); }); describe('current theme', () => { it('should get map', async () => { - assert.instanceOf(mjs.currentTheme, Map, 'currentTheme'); + assert.strictEqual(mjs.currentTheme instanceof Map, true, + 'currentTheme'); }); }); @@ -143,7 +141,7 @@ describe('theme', () => { browser.theme.getCurrent.resolves({}); browser.management.getAll.resolves(null); const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get value', async () => { @@ -223,7 +221,7 @@ describe('theme', () => { it('should throw', async () => { await func().catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected String but got Undefined.', 'message'); }); @@ -231,7 +229,7 @@ describe('theme', () => { it('should throw', async () => { await func('foo').catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected Array or String but got Undefined.', 'message'); @@ -269,11 +267,11 @@ describe('theme', () => { 'map'); assert.strictEqual(mjs.currentThemeColors.get('grault'), '#8000ff', 'map'); - assert.isFalse(mjs.currentThemeColors.has('garply'), 'map'); + assert.strictEqual(mjs.currentThemeColors.has('garply'), false, 'map'); assert.strictEqual(mjs.currentThemeColors.get('waldo'), '#8000ff80', 'map'); - assert.isFalse(mjs.currentThemeColors.has(''), 'map'); - assert.isFalse(mjs.currentThemeColors.has(' '), 'map'); + assert.strictEqual(mjs.currentThemeColors.has(''), false, 'map'); + assert.strictEqual(mjs.currentThemeColors.has(' '), false, 'map'); }); }); @@ -289,7 +287,7 @@ describe('theme', () => { it('should throw', async () => { mjs.currentThemeColors.set('tab_line', 'foo'); await func().catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected String but got Null.', 'message'); }); @@ -2156,8 +2154,8 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(mjs.currentTheme.size, 2, 'size'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT), 'key'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT_ID), 'id'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT), true, 'key'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT_ID), true, 'id'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT_ID), 'foo', 'id value'); }); @@ -2183,11 +2181,12 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(mjs.currentTheme.size, 2, 'size'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT), 'key'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT_ID), 'id'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT), true, 'key'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT_ID), true, 'id'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT_ID), 'foo', 'id value'); - assert.isObject(mjs.currentTheme.get(THEME_CURRENT), 'key value'); + assert.strictEqual(typeof mjs.currentTheme.get(THEME_CURRENT), 'object', + 'key value'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT)[CUSTOM_BG], '#f0f0f4', 'value'); }); @@ -2210,8 +2209,8 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(mjs.currentTheme.size, 2, 'size'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT), 'key'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT_ID), 'id'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT), true, 'key'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT_ID), true, 'id'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT_ID), 'foo', 'id value'); }); @@ -2236,8 +2235,8 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(mjs.currentTheme.size, 2, 'size'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT), 'key'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT_ID), 'id'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT), true, 'key'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT_ID), true, 'id'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT_ID), 'foo', 'id value'); }); @@ -2268,11 +2267,12 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(mjs.currentTheme.size, 2, 'size'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT), 'key'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT_ID), 'id'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT), true, 'key'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT_ID), true, 'id'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT_ID), 'foo', 'id value'); - assert.isObject(mjs.currentTheme.get(THEME_CURRENT), 'key value'); + assert.strictEqual(typeof mjs.currentTheme.get(THEME_CURRENT), 'object', + 'key value'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT)[CUSTOM_BG], '#ff0000', 'value'); }); @@ -2304,11 +2304,12 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(mjs.currentTheme.size, 2, 'size'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT), 'key'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT_ID), 'id'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT), true, 'key'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT_ID), true, 'id'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT_ID), 'foo', 'id value'); - assert.isObject(mjs.currentTheme.get(THEME_CURRENT), 'key value'); + assert.strictEqual(typeof mjs.currentTheme.get(THEME_CURRENT), 'object', + 'key value'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT)[CUSTOM_BG], '#0000ff', 'value'); }); @@ -2339,11 +2340,12 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(mjs.currentTheme.size, 2, 'size'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT), 'key'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT_ID), 'id'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT), true, 'key'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT_ID), true, 'id'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT_ID), 'foo', 'id value'); - assert.isObject(mjs.currentTheme.get(THEME_CURRENT), 'key value'); + assert.strictEqual(typeof mjs.currentTheme.get(THEME_CURRENT), 'object', + 'key value'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT)[CUSTOM_BG], '#ff0000', 'value'); }); @@ -2375,11 +2377,12 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(mjs.currentTheme.size, 2, 'size'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT), 'key'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT_ID), 'id'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT), true, 'key'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT_ID), true, 'id'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT_ID), 'foo', 'id value'); - assert.isObject(mjs.currentTheme.get(THEME_CURRENT), 'key value'); + assert.strictEqual(typeof mjs.currentTheme.get(THEME_CURRENT), 'object', + 'key value'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT)[CUSTOM_BG], '#0000ff', 'value'); }); @@ -2415,11 +2418,12 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(mjs.currentTheme.size, 2, 'size'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT), 'key'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT_ID), 'id'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT), true, 'key'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT_ID), true, 'id'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT_ID), 'foo', 'id value'); - assert.isObject(mjs.currentTheme.get(THEME_CURRENT), 'key value'); + assert.strictEqual(typeof mjs.currentTheme.get(THEME_CURRENT), 'object', + 'key value'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT)[CUSTOM_BG], '#0000ff', 'value'); }); @@ -2455,11 +2459,12 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(mjs.currentTheme.size, 2, 'size'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT), 'key'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT_ID), 'id'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT), true, 'key'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT_ID), true, 'id'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT_ID), 'foo', 'id value'); - assert.isObject(mjs.currentTheme.get(THEME_CURRENT), 'key value'); + assert.strictEqual(typeof mjs.currentTheme.get(THEME_CURRENT), 'object', + 'key value'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT)[CUSTOM_BG], '#ff00ff', 'value'); }); @@ -2496,11 +2501,12 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(mjs.currentTheme.size, 2, 'size'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT), 'key'); - assert.isTrue(mjs.currentTheme.has(THEME_CURRENT_ID), 'id'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT), true, 'key'); + assert.strictEqual(mjs.currentTheme.has(THEME_CURRENT_ID), true, 'id'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT_ID), 'foo', 'id value'); - assert.isObject(mjs.currentTheme.get(THEME_CURRENT), 'key value'); + assert.strictEqual(typeof mjs.currentTheme.get(THEME_CURRENT), 'object', + 'key value'); assert.strictEqual(mjs.currentTheme.get(THEME_CURRENT)[CUSTOM_BG], '#00ff00', 'value'); }); @@ -2517,8 +2523,9 @@ describe('theme', () => { it('it should not call function', async () => { const res = await func(); - assert.isTrue(browser.runtime.sendMessage.notCalled, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(browser.runtime.sendMessage.called, false, + 'not called'); + assert.strictEqual(res, null, 'result'); }); it('it should call function', async () => { @@ -2536,8 +2543,9 @@ describe('theme', () => { bar: 'baz' }); const res = await func(); - assert.isFalse(browser.management.getAll.called, 'not called'); - assert.isTrue(browser.runtime.sendMessage.calledOnce, 'called'); + assert.strictEqual(browser.management.getAll.called, false, 'not called'); + assert.strictEqual(browser.runtime.sendMessage.calledOnce, true, + 'called'); assert.deepEqual(res, [ { [THEME_CUSTOM_SETTING]: { @@ -2568,8 +2576,9 @@ describe('theme', () => { bar: 'baz' }); const res = await func(); - assert.isFalse(browser.management.getAll.called, 'not called'); - assert.isTrue(browser.runtime.sendMessage.calledOnce, 'called'); + assert.strictEqual(browser.management.getAll.called, false, 'not called'); + assert.strictEqual(browser.runtime.sendMessage.calledOnce, true, + 'called'); assert.deepEqual(res, [ { [THEME_CUSTOM_SETTING]: { @@ -2599,8 +2608,9 @@ describe('theme', () => { bar: 'baz' }); const res = await func('foo'); - assert.isFalse(browser.management.getAll.called, 'not called'); - assert.isTrue(browser.runtime.sendMessage.calledOnce, 'called'); + assert.strictEqual(browser.management.getAll.called, false, 'not called'); + assert.strictEqual(browser.runtime.sendMessage.calledOnce, true, + 'called'); assert.deepEqual(res, [ { [THEME_CUSTOM_SETTING]: { @@ -2630,8 +2640,9 @@ describe('theme', () => { bar: 'baz' }); const res = await func(); - assert.isTrue(browser.management.getAll.called, 'called'); - assert.isTrue(browser.runtime.sendMessage.calledOnce, 'called'); + assert.strictEqual(browser.management.getAll.called, true, 'called'); + assert.strictEqual(browser.runtime.sendMessage.calledOnce, true, + 'called'); assert.deepEqual(res, [ { [THEME_CUSTOM_SETTING]: { @@ -2658,7 +2669,7 @@ describe('theme', () => { it('should throw', async () => { await func().catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected String but got Undefined.', 'message'); }); @@ -2806,7 +2817,7 @@ describe('theme', () => { const { sheet } = elm; assert.strictEqual(sheet.cssRules.length, 1, 'length'); assert.strictEqual(sheet.cssRules[0].selectorText, - `.${CLASS_THEME_CUSTOM}`, 'selector'); + `.${CLASS_THEME_CUSTOM}`, 'selector'); }); it('should not delete style if selector does not match', async () => { @@ -2882,7 +2893,7 @@ describe('theme', () => { const res = await func(); assert.strictEqual(browser.runtime.sendMessage.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -2912,7 +2923,7 @@ describe('theme', () => { 'not called'); assert.strictEqual(browser.management.getAll.callCount, l, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -2945,7 +2956,7 @@ describe('theme', () => { 'not called'); assert.strictEqual(browser.management.getAll.callCount, l, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -2973,7 +2984,7 @@ describe('theme', () => { 'not called'); assert.strictEqual(browser.management.getAll.callCount, l, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -3432,10 +3443,14 @@ describe('theme', () => { const body = document.querySelector('body'); await func(); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isTrue(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isFalse(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isTrue(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), true, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), false, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), true, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set auto dark theme', async () => { @@ -3447,10 +3462,14 @@ describe('theme', () => { const body = document.querySelector('body'); await func(); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isTrue(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isTrue(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isFalse(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), true, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), true, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), false, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set auto light theme', async () => { @@ -3461,10 +3480,14 @@ describe('theme', () => { const body = document.querySelector('body'); await func([THEME_LIGHT]); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isTrue(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isFalse(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isTrue(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), true, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), false, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), true, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set auto dark theme', async () => { @@ -3476,10 +3499,14 @@ describe('theme', () => { const body = document.querySelector('body'); await func([THEME_DARK]); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isTrue(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isTrue(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isFalse(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), true, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), true, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), false, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set system light theme', async () => { @@ -3490,10 +3517,14 @@ describe('theme', () => { const body = document.querySelector('body'); await func([THEME_SYSTEM]); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isFalse(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isFalse(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isTrue(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), false, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), false, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), true, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set system dark theme', async () => { @@ -3507,10 +3538,14 @@ describe('theme', () => { body.classList.remove(CLASS_THEME_LIGHT); await func([THEME_SYSTEM]); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isFalse(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isTrue(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isFalse(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), false, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), true, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), false, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set custom theme', async () => { @@ -3521,10 +3556,14 @@ describe('theme', () => { const body = document.querySelector('body'); await func([THEME_CUSTOM]); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isTrue(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isFalse(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isFalse(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isFalse(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), true, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), false, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), false, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), false, + 'system'); }); it('should set system light theme', async () => { @@ -3551,10 +3590,14 @@ describe('theme', () => { body.classList.remove(CLASS_THEME_LIGHT); await func([THEME_AUTO]); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isFalse(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isFalse(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isTrue(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), false, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), false, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), true, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set system light theme', async () => { @@ -3581,10 +3624,14 @@ describe('theme', () => { body.classList.remove(CLASS_THEME_LIGHT); await func([THEME_AUTO]); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isFalse(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isFalse(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isTrue(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), false, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), false, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), true, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set system light theme', async () => { @@ -3612,10 +3659,14 @@ describe('theme', () => { const body = document.querySelector('body'); await func([THEME_AUTO]); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isFalse(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isFalse(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isTrue(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), false, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), false, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), true, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set system dark theme', async () => { @@ -3644,10 +3695,14 @@ describe('theme', () => { const body = document.querySelector('body'); await func([THEME_AUTO]); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isFalse(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isTrue(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isFalse(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), false, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), true, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), false, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set auto light theme', async () => { @@ -3672,10 +3727,14 @@ describe('theme', () => { const body = document.querySelector('body'); await func([THEME_AUTO]); assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); - assert.isTrue(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isFalse(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isTrue(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), true, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), false, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), true, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set auto dark theme', async () => { @@ -3701,10 +3760,14 @@ describe('theme', () => { const body = document.querySelector('body'); await func([THEME_AUTO]); assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); - assert.isTrue(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isTrue(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isFalse(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), true, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), true, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), false, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should not store', async () => { @@ -3714,10 +3777,14 @@ describe('theme', () => { local: true }); assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); - assert.isTrue(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isFalse(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isTrue(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), true, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), false, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), true, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should not store', async () => { @@ -3728,10 +3795,14 @@ describe('theme', () => { local: true }); assert.strictEqual(browser.storage.local.set.callCount, i, 'not called'); - assert.isTrue(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isTrue(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isFalse(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), true, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), true, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), false, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set auto light theme', async () => { @@ -3744,10 +3815,14 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isTrue(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isFalse(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isTrue(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), true, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), false, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), true, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); it('should set auto dark theme', async () => { @@ -3761,10 +3836,14 @@ describe('theme', () => { themeId: 'foo' }); assert.strictEqual(stubStorage.callCount, i + 1, 'called'); - assert.isTrue(body.classList.contains(CLASS_THEME_CUSTOM), 'custom'); - assert.isTrue(body.classList.contains(CLASS_THEME_DARK), 'dark'); - assert.isFalse(body.classList.contains(CLASS_THEME_LIGHT), 'light'); - assert.isTrue(body.classList.contains(CLASS_THEME_SYSTEM), 'system'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), true, + 'custom'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), true, + 'dark'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), false, + 'light'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), true, + 'system'); }); }); @@ -3803,7 +3882,7 @@ describe('theme', () => { const res = await func(); assert.strictEqual(browser.theme.getCurrent.callCount, i, 'not called'); assert.strictEqual(mjs.timeStamp.size, 0, 'size'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -3831,7 +3910,7 @@ describe('theme', () => { }); assert.strictEqual(browser.theme.getCurrent.callCount, i, 'not called'); assert.strictEqual(mjs.timeStamp.size, 0, 'size'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -3868,7 +3947,7 @@ describe('theme', () => { }); assert.strictEqual(browser.theme.getCurrent.callCount, i + 1, 'called'); assert.strictEqual(mjs.timeStamp.size, 0, 'size'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -3917,7 +3996,7 @@ describe('theme', () => { }); assert.strictEqual(browser.theme.getCurrent.callCount, i + 4, 'called'); assert.strictEqual(mjs.timeStamp.size, 0, 'size'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -4020,10 +4099,14 @@ describe('theme', () => { 'style'); assert.strictEqual(elm.sheet.cssRules[0].style[CSS_VAR_COLOR], '#ffffff', 'style'); - assert.isTrue(body.classList.contains(CLASS_THEME_CUSTOM), 'class'); - assert.isFalse(body.classList.contains(CLASS_THEME_DARK), 'class'); - assert.isFalse(body.classList.contains(CLASS_THEME_LIGHT), 'class'); - assert.isFalse(body.classList.contains(CLASS_THEME_SYSTEM), 'class'); + assert.strictEqual(body.classList.contains(CLASS_THEME_CUSTOM), true, + 'class'); + assert.strictEqual(body.classList.contains(CLASS_THEME_DARK), false, + 'class'); + assert.strictEqual(body.classList.contains(CLASS_THEME_LIGHT), false, + 'class'); + assert.strictEqual(body.classList.contains(CLASS_THEME_SYSTEM), false, + 'class'); assert.deepEqual(res, [undefined, undefined], 'result'); }); }); @@ -4139,7 +4222,7 @@ describe('theme', () => { }); assert.strictEqual(browser.theme.getCurrent.callCount, i + 1, 'called'); assert.strictEqual(mjs.timeStamp.size, 0, 'size'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -4181,7 +4264,7 @@ describe('theme', () => { }); assert.strictEqual(browser.theme.getCurrent.callCount, i + 1, 'called'); assert.strictEqual(mjs.timeStamp.size, 0, 'size'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); }); @@ -4190,7 +4273,7 @@ describe('theme', () => { it('should throw', async () => { await func().catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected String but got Undefined.', 'message'); }); @@ -4245,7 +4328,7 @@ describe('theme', () => { const i = browser.storage.local.get.callCount; const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should get result', async () => { @@ -4257,7 +4340,7 @@ describe('theme', () => { const i = browser.storage.local.get.callCount; const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isTrue(res, 'result'); + assert.strictEqual(res, true, 'result'); }); it('should get result', async () => { @@ -4269,7 +4352,7 @@ describe('theme', () => { const i = browser.storage.local.get.callCount; const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); }); @@ -4280,14 +4363,14 @@ describe('theme', () => { const body = document.querySelector('body'); body.classList.remove(CLASS_COMPACT); await func(true); - assert.isTrue(body.classList.contains(CLASS_COMPACT)); + assert.strictEqual(body.classList.contains(CLASS_COMPACT), true); }); it('should not add class', async () => { const body = document.querySelector('body'); body.classList.add(CLASS_COMPACT); await func(false); - assert.isFalse(body.classList.contains(CLASS_COMPACT)); + assert.strictEqual(body.classList.contains(CLASS_COMPACT), false); }); }); @@ -4300,7 +4383,7 @@ describe('theme', () => { const i = browser.storage.local.get.callCount; const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should get result', async () => { @@ -4312,7 +4395,7 @@ describe('theme', () => { const i = browser.storage.local.get.callCount; const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isTrue(res, 'result'); + assert.strictEqual(res, true, 'result'); }); it('should get result', async () => { @@ -4324,7 +4407,7 @@ describe('theme', () => { const i = browser.storage.local.get.callCount; const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); }); @@ -4335,14 +4418,14 @@ describe('theme', () => { const body = document.querySelector('body'); body.classList.remove(CLASS_NARROW); await func(true); - assert.isTrue(body.classList.contains(CLASS_NARROW)); + assert.strictEqual(body.classList.contains(CLASS_NARROW), true); }); it('should not add class', async () => { const body = document.querySelector('body'); body.classList.add(CLASS_NARROW); await func(false); - assert.isFalse(body.classList.contains(CLASS_NARROW)); + assert.strictEqual(body.classList.contains(CLASS_NARROW), false); }); }); @@ -4355,7 +4438,7 @@ describe('theme', () => { const i = browser.storage.local.get.callCount; const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should get result', async () => { @@ -4367,7 +4450,7 @@ describe('theme', () => { const i = browser.storage.local.get.callCount; const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isTrue(res, 'result'); + assert.strictEqual(res, true, 'result'); }); it('should get result', async () => { @@ -4379,7 +4462,7 @@ describe('theme', () => { const i = browser.storage.local.get.callCount; const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); }); @@ -4390,14 +4473,15 @@ describe('theme', () => { const body = document.querySelector('body'); body.classList.remove(CLASS_NARROW_TAB_GROUP); await func(true); - assert.isTrue(body.classList.contains(CLASS_NARROW_TAB_GROUP)); + assert.strictEqual(body.classList.contains(CLASS_NARROW_TAB_GROUP), true); }); it('should not add class', async () => { const body = document.querySelector('body'); body.classList.add(CLASS_NARROW_TAB_GROUP); await func(false); - assert.isFalse(body.classList.contains(CLASS_NARROW_TAB_GROUP)); + assert.strictEqual(body.classList.contains(CLASS_NARROW_TAB_GROUP), + false); }); }); @@ -4410,7 +4494,7 @@ describe('theme', () => { const i = browser.storage.local.get.callCount; const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should get result', async () => { @@ -4422,7 +4506,7 @@ describe('theme', () => { const i = browser.storage.local.get.callCount; const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isTrue(res, 'result'); + assert.strictEqual(res, true, 'result'); }); it('should get result', async () => { @@ -4434,7 +4518,7 @@ describe('theme', () => { const i = browser.storage.local.get.callCount; const res = await func(); assert.strictEqual(browser.storage.local.get.callCount, i + 1, 'called'); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); }); @@ -4450,7 +4534,7 @@ describe('theme', () => { parent.appendChild(elm); body.appendChild(parent); await func(true); - assert.isTrue(elm.classList.contains(CLASS_SEPARATOR_SHOW)); + assert.strictEqual(elm.classList.contains(CLASS_SEPARATOR_SHOW), true); }); it('should not add class', async () => { @@ -4462,7 +4546,7 @@ describe('theme', () => { parent.appendChild(elm); body.appendChild(parent); await func(false); - assert.isFalse(elm.classList.contains(CLASS_SEPARATOR_SHOW)); + assert.strictEqual(elm.classList.contains(CLASS_SEPARATOR_SHOW), false); }); }); @@ -4471,7 +4555,7 @@ describe('theme', () => { it('should throw', async () => { await func().catch(e => { - assert.instanceOf(e, TypeError, 'error'); + assert.strictEqual(e instanceof TypeError, true, 'error'); assert.strictEqual(e.message, 'Expected String but got Undefined.'); }); }); @@ -4484,7 +4568,7 @@ describe('theme', () => { const res = await func(''); const { sheet } = elm; assert.strictEqual(sheet.cssRules.length, 0, 'length'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not set css', async () => { @@ -4495,7 +4579,7 @@ describe('theme', () => { const res = await func('foo'); const { sheet } = elm; assert.strictEqual(sheet.cssRules.length, 0, 'length'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should set css', async () => { @@ -4509,7 +4593,7 @@ describe('theme', () => { assert.strictEqual(sheet.cssRules[0].selectorText, CSS_ROOT, 'selector'); assert.strictEqual(sheet.cssRules[0].style.cssText, '--font-weight-active: bold;', 'cssText'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should set css', async () => { @@ -4523,7 +4607,7 @@ describe('theme', () => { assert.strictEqual(sheet.cssRules[0].selectorText, CSS_ROOT, 'selector'); assert.strictEqual(sheet.cssRules[0].style.cssText, '--font-weight-active: normal;', 'cssText'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -4538,7 +4622,7 @@ describe('theme', () => { const res = await func(''); const { sheet } = elm; assert.strictEqual(sheet.cssRules.length, 0, 'length'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not set css', async () => { @@ -4549,7 +4633,7 @@ describe('theme', () => { const res = await func('foo'); const { sheet } = elm; assert.strictEqual(sheet.cssRules.length, 0, 'length'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should set css', async () => { @@ -4563,7 +4647,7 @@ describe('theme', () => { assert.strictEqual(sheet.cssRules[0].selectorText, CSS_ROOT, 'selector'); assert.strictEqual(sheet.cssRules[0].style.cssText, '--zoom-level: 1.5;', 'cssText'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); it('should set css', async () => { @@ -4577,7 +4661,7 @@ describe('theme', () => { assert.strictEqual(sheet.cssRules[0].selectorText, CSS_ROOT, 'selector'); assert.strictEqual(sheet.cssRules[0].style.cssText, '--zoom-level: 1.5;', 'cssText'); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); @@ -4590,7 +4674,7 @@ describe('theme', () => { elm.setAttribute('hidden', 'hidden'); body.appendChild(elm); await func(); - assert.isFalse(elm.hasAttribute('hidden'), 'hidden'); + assert.strictEqual(elm.hasAttribute('hidden'), false, 'hidden'); }); }); @@ -4623,7 +4707,7 @@ describe('theme', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(); - assert.isUndefined(res, 'result'); + assert.strictEqual(res, undefined, 'result'); }); }); }); diff --git a/test/util.test.js b/test/util.test.js index 2dc69b48..d3607c29 100644 --- a/test/util.test.js +++ b/test/util.test.js @@ -4,9 +4,9 @@ /* eslint-disable import-x/order */ /* api */ -import sinon from 'sinon'; -import { assert } from 'chai'; +import { strict as assert } from 'node:assert'; import { afterEach, beforeEach, describe, it } from 'mocha'; +import sinon from 'sinon'; import { browser, createJsdom, mockPort } from './mocha/setup.js'; /* test */ @@ -46,24 +46,22 @@ describe('util', () => { browser._sandbox.reset(); }); - it('should get browser object', () => { - assert.isObject(browser, 'browser'); - }); - describe('get template', () => { const func = mjs.getTemplate; it('should throw if no argument given', async () => { - assert.throws(() => func(), 'Expected String but got Undefined.'); + assert.throws(() => func(), TypeError, + 'Expected String but got Undefined.', 'throw'); }); it('should throw if argument is not string', async () => { - assert.throws(() => func(1), 'Expected String but got Number.'); + assert.throws(() => func(1), TypeError, + 'Expected String but got Number.', 'throw'); }); it('should get null', async () => { const res = func('foo'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get cloned fragment', async () => { @@ -84,7 +82,7 @@ describe('util', () => { it('should get null if no argument given', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null if container not found', async () => { @@ -92,7 +90,7 @@ describe('util', () => { const body = document.querySelector('body'); body.appendChild(elm); const res = await func(elm); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get container', async () => { @@ -105,7 +103,7 @@ describe('util', () => { cnt.appendChild(p); body.appendChild(cnt); const res = await func(elm); - assert.isTrue(res === cnt, 'result'); + assert.deepEqual(res, cnt, 'result'); }); }); @@ -152,7 +150,8 @@ describe('util', () => { parent.appendChild(elm); body.appendChild(parent); await func(elm); - assert.isFalse(elm.classList.contains(CLASS_TAB_GROUP), 'result'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_GROUP), false, + 'result'); }); it('should do nothing', async () => { @@ -167,7 +166,8 @@ describe('util', () => { parent.appendChild(elm); body.appendChild(parent); await func(elm); - assert.isTrue(elm.classList.contains(CLASS_TAB_GROUP), 'result'); + assert.strictEqual(elm.classList.contains(CLASS_TAB_GROUP), true, + 'result'); }); }); @@ -176,12 +176,12 @@ describe('util', () => { it('should get null if no argument given', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { const res = await func('foo'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get result', async () => { @@ -250,7 +250,7 @@ describe('util', () => { body.appendChild(tmpl); body.appendChild(newTab); const res = await func(elm, target); - assert.isNull(target.parentNode, 'parent'); + assert.strictEqual(target.parentNode, null, 'parent'); assert.deepEqual(res, elm, 'result'); assert.deepEqual(res.parentNode.nextElementSibling, newTab, 'position'); }); @@ -261,7 +261,7 @@ describe('util', () => { it('should get null if no argument given', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -271,7 +271,7 @@ describe('util', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(elm); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get result', async () => { @@ -282,7 +282,7 @@ describe('util', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(elm); - assert.isTrue(res === parent, 'result'); + assert.deepEqual(res, parent, 'result'); }); }); @@ -291,7 +291,7 @@ describe('util', () => { it('should get null if no argument given', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -301,7 +301,7 @@ describe('util', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(elm); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get result', async () => { @@ -320,11 +320,13 @@ describe('util', () => { const func = mjs.getSidebarTabIds; it('should throw if no argument given', () => { - assert.throws(() => func(), 'Expected Array but got Undefined.', 'throw'); + assert.throws(() => func(), TypeError, + 'Expected Array but got Undefined.', 'throw'); }); it('should throw if argument is not array', () => { - assert.throws(() => func(1), 'Expected Array but got Number.', 'throw'); + assert.throws(() => func(1), TypeError, + 'Expected Array but got Number.', 'throw'); }); it('should get empty array if array does not contain element', async () => { @@ -358,12 +360,12 @@ describe('util', () => { it('should get null if no argument given', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null if argument is not element', async () => { const res = await func('foo'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { @@ -371,7 +373,7 @@ describe('util', () => { const body = document.querySelector('body'); body.appendChild(elm); const res = await func(elm); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get result', async () => { @@ -448,10 +450,11 @@ describe('util', () => { body.appendChild(elm4); body.appendChild(elm5); const res = await func(elm2, elm4); - assert.strictEqual(res.length, 3, 'length'); - assert.isTrue(res[0] === elm2, 'result'); - assert.isTrue(res[1] === elm3, 'result'); - assert.isTrue(res[2] === elm4, 'result'); + assert.deepEqual(res, [ + elm2, + elm3, + elm4 + ], 'result'); }); it('should get result', async () => { @@ -477,10 +480,11 @@ describe('util', () => { body.appendChild(elm4); body.appendChild(elm5); const res = await func(elm3, elm5); - assert.strictEqual(res.length, 3, 'length'); - assert.isTrue(res[0] === elm3, 'result'); - assert.isTrue(res[1] === elm4, 'result'); - assert.isTrue(res[2] === elm5, 'result'); + assert.deepEqual(res, [ + elm3, + elm4, + elm5 + ], 'result'); }); it('should get result', async () => { @@ -506,11 +510,12 @@ describe('util', () => { body.appendChild(elm4); body.appendChild(elm5); const res = await func(elm4, elm); - assert.strictEqual(res.length, 4, 'length'); - assert.isTrue(res[0] === elm, 'result'); - assert.isTrue(res[1] === elm2, 'result'); - assert.isTrue(res[2] === elm3, 'result'); - assert.isTrue(res[3] === elm4, 'result'); + assert.deepEqual(res, [ + elm, + elm2, + elm3, + elm4 + ], 'result'); }); }); @@ -519,7 +524,7 @@ describe('util', () => { it('should get null', () => { const res = func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', () => { @@ -527,7 +532,7 @@ describe('util', () => { const body = document.querySelector('body'); body.appendChild(div); const res = func(div); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get result', () => { @@ -623,7 +628,7 @@ describe('util', () => { body.appendChild(group); body.appendChild(newtab); const res = func(div, true); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); }); @@ -632,7 +637,7 @@ describe('util', () => { it('should get null', () => { const res = func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', () => { @@ -640,7 +645,7 @@ describe('util', () => { const body = document.querySelector('body'); body.appendChild(div); const res = func(div); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', () => { @@ -655,7 +660,7 @@ describe('util', () => { group.appendChild(div); body.appendChild(group); const res = func(div); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get result', () => { @@ -749,7 +754,7 @@ describe('util', () => { it('should get false if no argument given', async () => { const res = await func(); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should get false', async () => { @@ -759,7 +764,7 @@ describe('util', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(elm); - assert.isFalse(res, 'result'); + assert.strictEqual(res, false, 'result'); }); it('should get result', async () => { @@ -770,7 +775,7 @@ describe('util', () => { parent.appendChild(elm); body.appendChild(parent); const res = await func(elm); - assert.isTrue(res, 'result'); + assert.strictEqual(res, true, 'result'); }); }); @@ -779,7 +784,7 @@ describe('util', () => { it('should get null if no argument given', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null if tab not found', async () => { @@ -787,7 +792,7 @@ describe('util', () => { const body = document.querySelector('body'); body.appendChild(elm); const res = await func(elm); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -803,7 +808,7 @@ describe('util', () => { body.appendChild(elm); const res = await func(elm); assert.strictEqual(browser.tabs.update.callCount, i + 1, 'called'); - assert.isTrue(res, 'result'); + assert.strictEqual(res, true, 'result'); }); }); @@ -831,8 +836,8 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(); - assert.isFalse(stubPinned.called, 'not called'); - assert.isFalse(stubNewTab.called, 'not called'); + assert.strictEqual(stubPinned.called, false, 'not called'); + assert.strictEqual(stubNewTab.called, false, 'not called'); }); it('should not call function', async () => { @@ -862,9 +867,9 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isFalse(stubPinned.called, 'not called'); - assert.isFalse(stubNewTab.called, 'not called'); - assert.isFalse(stubElm.called, 'not called'); + assert.strictEqual(stubPinned.called, false, 'not called'); + assert.strictEqual(stubNewTab.called, false, 'not called'); + assert.strictEqual(stubElm.called, false, 'not called'); }); it('should not call function', async () => { @@ -897,9 +902,9 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isFalse(stubPinned.called, 'not called'); - assert.isFalse(stubNewTab.called, 'not called'); - assert.isFalse(stubElm.called, 'not called'); + assert.strictEqual(stubPinned.called, false, 'not called'); + assert.strictEqual(stubNewTab.called, false, 'not called'); + assert.strictEqual(stubElm.called, false, 'not called'); }); it('should not call function', async () => { @@ -933,10 +938,10 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isTrue(stubPinned.called, 'called'); - assert.isTrue(stubNewTab.called, 'called'); - assert.isTrue(stubElm.called, 'called'); - assert.isFalse(elm.scrollIntoView.called, 'not called'); + assert.strictEqual(stubPinned.called, true, 'called'); + assert.strictEqual(stubNewTab.called, true, 'called'); + assert.strictEqual(stubElm.called, true, 'called'); + assert.strictEqual(elm.scrollIntoView.called, false, 'not called'); }); it('should not call function', async () => { @@ -970,10 +975,10 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isFalse(stubPinned.called, 'not called'); - assert.isFalse(stubNewTab.called, 'not called'); - assert.isFalse(stubElm.called, 'not called'); - assert.isFalse(elm.scrollIntoView.called, 'not called'); + assert.strictEqual(stubPinned.called, false, 'not called'); + assert.strictEqual(stubNewTab.called, false, 'not called'); + assert.strictEqual(stubElm.called, false, 'not called'); + assert.strictEqual(elm.scrollIntoView.called, false, 'not called'); }); it('should call function', async () => { @@ -1007,13 +1012,13 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isTrue(stubPinned.calledOnce, 'called'); - assert.isTrue(stubNewTab.calledOnce, 'called'); - assert.isTrue(stubElm.calledOnce, 'called'); - assert.isTrue(elm.scrollIntoView.withArgs({ + assert.strictEqual(stubPinned.calledOnce, true, 'called'); + assert.strictEqual(stubNewTab.calledOnce, true, 'called'); + assert.strictEqual(stubElm.calledOnce, true, 'called'); + assert.strictEqual(elm.scrollIntoView.withArgs({ behavior: 'smooth', block: 'center' - }).calledOnce, 'called'); + }).calledOnce, true, 'called'); }); it('should call function', async () => { @@ -1047,13 +1052,13 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isTrue(stubPinned.calledOnce, 'called'); - assert.isTrue(stubNewTab.calledOnce, 'called'); - assert.isTrue(stubElm.calledOnce, 'called'); - assert.isTrue(elm.scrollIntoView.withArgs({ + assert.strictEqual(stubPinned.calledOnce, true, 'called'); + assert.strictEqual(stubNewTab.calledOnce, true, 'called'); + assert.strictEqual(stubElm.calledOnce, true, 'called'); + assert.strictEqual(elm.scrollIntoView.withArgs({ behavior: 'smooth', block: 'start' - }).calledOnce, 'called'); + }).calledOnce, true, 'called'); }); it('should call function', async () => { @@ -1090,14 +1095,14 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isFalse(stubMain.calledOnce, 'called'); - assert.isTrue(stubPinned.calledOnce, 'called'); - assert.isTrue(stubNewTab.calledOnce, 'called'); - assert.isTrue(stubElm.calledOnce, 'called'); - assert.isTrue(elm.scrollIntoView.withArgs({ + assert.strictEqual(stubMain.called, false, 'not called'); + assert.strictEqual(stubPinned.calledOnce, true, 'called'); + assert.strictEqual(stubNewTab.calledOnce, true, 'called'); + assert.strictEqual(stubElm.calledOnce, true, 'called'); + assert.strictEqual(elm.scrollIntoView.withArgs({ behavior: 'smooth', block: 'center' - }).calledOnce, 'called'); + }).calledOnce, true, 'called'); }); it('should call function', async () => { @@ -1134,14 +1139,14 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isFalse(stubMain.calledOnce, 'called'); - assert.isTrue(stubPinned.calledOnce, 'called'); - assert.isTrue(stubNewTab.calledOnce, 'called'); - assert.isTrue(stubElm.calledOnce, 'called'); - assert.isTrue(elm.scrollIntoView.withArgs({ + assert.strictEqual(stubMain.called, false, 'not called'); + assert.strictEqual(stubPinned.calledOnce, true, 'called'); + assert.strictEqual(stubNewTab.calledOnce, true, 'called'); + assert.strictEqual(stubElm.calledOnce, true, 'called'); + assert.strictEqual(elm.scrollIntoView.withArgs({ behavior: 'smooth', block: 'center' - }).calledOnce, 'called'); + }).calledOnce, true, 'called'); }); it('should call function', async () => { @@ -1178,14 +1183,14 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isFalse(stubMain.calledOnce, 'called'); - assert.isTrue(stubPinned.calledOnce, 'called'); - assert.isTrue(stubNewTab.calledOnce, 'called'); - assert.isTrue(stubElm.calledOnce, 'called'); - assert.isTrue(elm.scrollIntoView.withArgs({ + assert.strictEqual(stubMain.called, false, 'not called'); + assert.strictEqual(stubPinned.calledOnce, true, 'called'); + assert.strictEqual(stubNewTab.calledOnce, true, 'called'); + assert.strictEqual(stubElm.calledOnce, true, 'called'); + assert.strictEqual(elm.scrollIntoView.withArgs({ behavior: 'smooth', block: 'center' - }).calledOnce, 'called'); + }).calledOnce, true, 'called'); }); it('should call function', async () => { @@ -1222,14 +1227,14 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isTrue(stubMain.calledOnce, 'called'); - assert.isTrue(stubPinned.calledOnce, 'called'); - assert.isTrue(stubNewTab.calledOnce, 'called'); - assert.isTrue(stubElm.calledOnce, 'called'); - assert.isFalse(elm.scrollIntoView.withArgs({ + assert.strictEqual(stubMain.calledOnce, true, 'called'); + assert.strictEqual(stubPinned.calledOnce, true, 'called'); + assert.strictEqual(stubNewTab.calledOnce, true, 'called'); + assert.strictEqual(stubElm.calledOnce, true, 'called'); + assert.strictEqual(elm.scrollIntoView.withArgs({ behavior: 'smooth', block: 'center' - }).calledOnce, 'called'); + }).called, false, 'called'); }); it('should call function', async () => { @@ -1266,14 +1271,14 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isFalse(stubMain.calledOnce, 'called'); - assert.isTrue(stubPinned.calledOnce, 'called'); - assert.isTrue(stubNewTab.calledOnce, 'called'); - assert.isTrue(stubElm.calledOnce, 'called'); - assert.isTrue(elm.scrollIntoView.withArgs({ + assert.strictEqual(stubMain.calledOnce, false, 'called'); + assert.strictEqual(stubPinned.calledOnce, true, 'called'); + assert.strictEqual(stubNewTab.calledOnce, true, 'called'); + assert.strictEqual(stubElm.calledOnce, true, 'called'); + assert.strictEqual(elm.scrollIntoView.withArgs({ behavior: 'smooth', block: 'start' - }).calledOnce, 'called'); + }).calledOnce, true, 'called'); }); it('should not call function', async () => { @@ -1310,14 +1315,14 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isFalse(stubMain.calledOnce, 'called'); - assert.isTrue(stubPinned.calledOnce, 'called'); - assert.isTrue(stubNewTab.calledOnce, 'called'); - assert.isTrue(stubElm.calledOnce, 'called'); - assert.isFalse(elm.scrollIntoView.withArgs({ + assert.strictEqual(stubMain.calledOnce, false, true, 'called'); + assert.strictEqual(stubPinned.calledOnce, true, 'called'); + assert.strictEqual(stubNewTab.calledOnce, true, 'called'); + assert.strictEqual(stubElm.calledOnce, true, 'called'); + assert.strictEqual(elm.scrollIntoView.withArgs({ behavior: 'smooth', block: 'start' - }).called, 'called'); + }).called, false, 'called'); }); it('should not call function', async () => { @@ -1354,14 +1359,14 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isFalse(stubMain.calledOnce, 'called'); - assert.isTrue(stubPinned.calledOnce, 'called'); - assert.isTrue(stubNewTab.calledOnce, 'called'); - assert.isTrue(stubElm.calledOnce, 'called'); - assert.isFalse(elm.scrollIntoView.withArgs({ + assert.strictEqual(stubMain.calledOnce, false, 'called'); + assert.strictEqual(stubPinned.calledOnce, true, 'called'); + assert.strictEqual(stubNewTab.calledOnce, true, 'called'); + assert.strictEqual(stubElm.calledOnce, true, 'called'); + assert.strictEqual(elm.scrollIntoView.withArgs({ behavior: 'smooth', block: 'start' - }).called, 'called'); + }).called, false, 'called'); }); it('should call function', async () => { @@ -1398,14 +1403,14 @@ describe('util', () => { main.appendChild(newTab); body.appendChild(main); await func(elm); - assert.isFalse(stubMain.calledOnce, 'called'); - assert.isTrue(stubPinned.calledOnce, 'called'); - assert.isTrue(stubNewTab.calledOnce, 'called'); - assert.isTrue(stubElm.calledOnce, 'called'); - assert.isTrue(elm.scrollIntoView.withArgs({ + assert.strictEqual(stubMain.calledOnce, false, 'called'); + assert.strictEqual(stubPinned.calledOnce, true, 'called'); + assert.strictEqual(stubNewTab.calledOnce, true, 'called'); + assert.strictEqual(stubElm.calledOnce, true, 'called'); + assert.strictEqual(elm.scrollIntoView.withArgs({ behavior: 'smooth', block: 'center' - }).calledOnce, 'called'); + }).calledOnce, true, 'called'); }); }); @@ -1414,12 +1419,12 @@ describe('util', () => { it('should get null', async () => { const res = await func(); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', async () => { const res = await func({}); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -1431,7 +1436,7 @@ describe('util', () => { browser.tabs.query.resolves([{ id: 1 }]); const res = await func(opt); assert.strictEqual(browser.tabs.update.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -1458,7 +1463,7 @@ describe('util', () => { browser.tabs.update.resolves({}); const res = await func(opt); assert.strictEqual(browser.tabs.update.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1512,7 +1517,7 @@ describe('util', () => { browser.tabs.update.resolves({}); const res = await func(opt); assert.strictEqual(browser.tabs.update.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should not call function', async () => { @@ -1539,7 +1544,7 @@ describe('util', () => { browser.tabs.update.resolves({}); const res = await func(opt); assert.strictEqual(browser.tabs.update.callCount, i, 'not called'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should call function', async () => { @@ -1574,18 +1579,18 @@ describe('util', () => { const func = mjs.createUrlMatchString; it('should throw', () => { - assert.throws(() => func(), 'Expected String but got Undefined.', - 'throw'); + assert.throws(() => func(), TypeError, + 'Expected String but got Undefined.', 'throw'); }); it('should get null', () => { const res = func(''); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get null', () => { const res = func('foo'); - assert.isNull(res, 'result'); + assert.strictEqual(res, null, 'result'); }); it('should get result', () => {