diff options
Diffstat (limited to 'test/settings/components/ui')
-rw-r--r-- | test/settings/components/ui/Radio.test.tsx | 11 | ||||
-rw-r--r-- | test/settings/components/ui/Text.test.tsx | 11 | ||||
-rw-r--r-- | test/settings/components/ui/TextArea.test.tsx | 15 |
3 files changed, 16 insertions, 21 deletions
diff --git a/test/settings/components/ui/Radio.test.tsx b/test/settings/components/ui/Radio.test.tsx index bce4d3a..e2bf214 100644 --- a/test/settings/components/ui/Radio.test.tsx +++ b/test/settings/components/ui/Radio.test.tsx @@ -6,7 +6,6 @@ import React from "react"; import ReactDOM from "react-dom"; import ReactTestUtils from "react-dom/test-utils"; import Radio from "../../../../src/settings/components/ui/Radio"; -import { expect } from "chai"; describe("settings/ui/Radio", () => { let container: HTMLDivElement; @@ -30,10 +29,10 @@ describe("settings/ui/Radio", () => { const label = document.querySelector("label")!; const input = document.querySelector("input")!; - expect(label.textContent).to.contain("myfield"); - expect(input.type).to.contain("radio"); - expect(input.name).to.contain("myradio"); - expect(input.value).to.contain("myvalue"); + expect(label.textContent).toEqual("myfield"); + expect(input.type).toEqual("radio"); + expect(input.name).toEqual("myradio"); + expect(input.value).toEqual("myvalue"); }); it("invoke onChange", (done) => { @@ -45,7 +44,7 @@ describe("settings/ui/Radio", () => { label="myfield" value="myvalue" onChange={(e) => { - expect((e.target as HTMLInputElement).checked).to.be.true; + expect((e.target as HTMLInputElement).checked).toBeTruthy; done(); }} />, diff --git a/test/settings/components/ui/Text.test.tsx b/test/settings/components/ui/Text.test.tsx index 86c4132..a8e0bf9 100644 --- a/test/settings/components/ui/Text.test.tsx +++ b/test/settings/components/ui/Text.test.tsx @@ -6,7 +6,6 @@ import React from "react"; import ReactDOM from "react-dom"; import ReactTestUtils from "react-dom/test-utils"; import Text from "../../../../src/settings/components/ui/Text"; -import { expect } from "chai"; describe("settings/ui/Text", () => { let container: HTMLDivElement; @@ -30,10 +29,10 @@ describe("settings/ui/Text", () => { const label = document.querySelector("label")!; const input = document.querySelector("input")!; - expect(label.textContent).to.contain("myfield"); - expect(input.type).to.contain("text"); - expect(input.name).to.contain("myname"); - expect(input.value).to.contain("myvalue"); + expect(label.textContent?.includes("myfield")).toBeTruthy; + expect(input.type).toEqual("text"); + expect(input.name).toEqual("myname"); + expect(input.value).toEqual("myvalue"); }); it("invoke onChange", (done) => { @@ -44,7 +43,7 @@ describe("settings/ui/Text", () => { label="myfield" value="myvalue" onChange={(e) => { - expect((e.target as HTMLInputElement).value).to.equal("newvalue"); + expect((e.target as HTMLInputElement).value).toEqual("newvalue"); done(); }} />, diff --git a/test/settings/components/ui/TextArea.test.tsx b/test/settings/components/ui/TextArea.test.tsx index 84c0c93..76caec2 100644 --- a/test/settings/components/ui/TextArea.test.tsx +++ b/test/settings/components/ui/TextArea.test.tsx @@ -6,7 +6,6 @@ import React from "react"; import ReactDOM from "react-dom"; import ReactTestUtils from "react-dom/test-utils"; import TextArea from "../../../../src/settings/components/ui/TextArea"; -import { expect } from "chai"; describe("settings/ui/TextArea", () => { let container: HTMLDivElement; @@ -36,11 +35,11 @@ describe("settings/ui/TextArea", () => { const label = document.querySelector("label")!; const textarea = document.querySelector("textarea")!; const error = document.querySelector("[role=alert]")!; - expect(label.textContent).to.contain("myfield"); - expect(textarea.nodeName).to.contain("TEXTAREA"); - expect(textarea.name).to.contain("myname"); - expect(textarea.value).to.contain("myvalue"); - expect(error.textContent).to.contain("myerror"); + expect(label.textContent).toEqual("myfield"); + expect(textarea.nodeName).toEqual("TEXTAREA"); + expect(textarea.name).toEqual("myname"); + expect(textarea.value).toEqual("myvalue"); + expect(error.textContent).toEqual("myerror"); }); it("invoke onChange", (done) => { @@ -51,9 +50,7 @@ describe("settings/ui/TextArea", () => { label="myfield" value="myvalue" onChange={(e) => { - expect((e.target as HTMLTextAreaElement).value).to.equal( - "newvalue" - ); + expect((e.target as HTMLTextAreaElement).value).toEqual("newvalue"); done(); }} />, |