aboutsummaryrefslogtreecommitdiff
path: root/test/content/presenters
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2021-09-26 17:01:31 +0900
committerShin'ya Ueoka <ueokande@i-beam.org>2021-09-26 17:23:14 +0900
commite304581fb15eabb3a973d363a282ee7546561e01 (patch)
tree1afb21a2dee2ada3d10c1417fa61c0aae1f83077 /test/content/presenters
parent11d6d725eee2ac0a1c16e4c7a4ce4f296bb6b016 (diff)
Do not use chai on unit test
Diffstat (limited to 'test/content/presenters')
-rw-r--r--test/content/presenters/Hint.test.ts23
-rw-r--r--test/content/presenters/NavigationPresenter.test.ts3
2 files changed, 12 insertions, 14 deletions
diff --git a/test/content/presenters/Hint.test.ts b/test/content/presenters/Hint.test.ts
index 0823bdc..b3b2d19 100644
--- a/test/content/presenters/Hint.test.ts
+++ b/test/content/presenters/Hint.test.ts
@@ -6,7 +6,6 @@ import AbstractHint, {
LinkHint,
InputHint,
} from "../../../src/content/presenters/Hint";
-import { expect } from "chai";
class Hint extends AbstractHint {}
@@ -21,7 +20,7 @@ describe("Hint", () => {
new Hint(link, "abc");
const elem = document.querySelector(".vimvixen-hint");
- expect(elem!.textContent!.trim()).to.be.equal("abc");
+ expect(elem!.textContent!.trim()).toEqual("abc");
});
});
@@ -33,7 +32,7 @@ describe("Hint", () => {
hint.show();
const elem = document.querySelector(".vimvixen-hint") as HTMLElement;
- expect(elem.style.display).to.not.equal("none");
+ expect(elem.style.display).not.toEqual("none");
});
});
@@ -44,7 +43,7 @@ describe("Hint", () => {
hint.hide();
const elem = document.querySelector(".vimvixen-hint") as HTMLElement;
- expect(elem.style.display).to.equal("none");
+ expect(elem.style.display).toEqual("none");
});
});
@@ -54,9 +53,9 @@ describe("Hint", () => {
const hint = new Hint(link, "abc");
const elem = document.querySelector(".vimvixen-hint")!;
- expect(elem.parentElement).to.not.be.null;
+ expect(elem.parentElement).not.toBeNull;
hint.remove();
- expect(elem.parentElement).to.be.null;
+ expect(elem.parentElement).toBeNull;
});
});
});
@@ -75,7 +74,7 @@ describe("LinkHint", () => {
const link = document.getElementById("test-link1") as HTMLAnchorElement;
const hint = new LinkHint(link, "abc");
- expect(hint.getLink()).to.equal("https://google.com/");
+ expect(hint.getLink()).toEqual("https://google.com/");
});
});
@@ -84,12 +83,12 @@ describe("LinkHint", () => {
let link = document.getElementById("test-link1") as HTMLAnchorElement;
let hint = new LinkHint(link, "abc");
- expect(hint.getLinkTarget()).to.be.null;
+ expect(hint.getLinkTarget()).toBeNull;
link = document.getElementById("test-link2") as HTMLAnchorElement;
hint = new LinkHint(link, "abc");
- expect(hint.getLinkTarget()).to.equal("_blank");
+ expect(hint.getLinkTarget()).toEqual("_blank");
});
});
@@ -118,7 +117,7 @@ describe("InputHint", () => {
const hint = new InputHint(input, "abc");
hint.activate();
- expect(document.activeElement).to.equal(input);
+ expect(document.activeElement).toEqual(input);
});
});
@@ -132,7 +131,7 @@ describe("InputHint", () => {
const hint = new InputHint(input, "abc");
hint.activate();
- expect(input.checked).to.be.true;
+ expect(input.checked).toBeTruthy;
});
});
describe("<textarea>", () => {
@@ -147,7 +146,7 @@ describe("InputHint", () => {
const hint = new InputHint(textarea, "abc");
hint.activate();
- expect(document.activeElement).to.equal(textarea);
+ expect(document.activeElement).toEqual(textarea);
});
});
diff --git a/test/content/presenters/NavigationPresenter.test.ts b/test/content/presenters/NavigationPresenter.test.ts
index c377df4..0e51242 100644
--- a/test/content/presenters/NavigationPresenter.test.ts
+++ b/test/content/presenters/NavigationPresenter.test.ts
@@ -3,7 +3,6 @@
*/
import { NavigationPresenterImpl } from "../../../src/content/presenters/NavigationPresenter";
-import { expect } from "chai";
describe("NavigationPresenterImpl", () => {
let sut: NavigationPresenterImpl;
@@ -14,7 +13,7 @@ describe("NavigationPresenterImpl", () => {
document.body.innerHTML = html;
method();
setTimeout(() => {
- expect(document.location.hash).to.equal(`#${rel}`);
+ expect(document.location.hash).toEqual(`#${rel}`);
done();
}, 0);
};