From fe53143d8acd194720d5f3ae5514b916a6eb59e8 Mon Sep 17 00:00:00 2001 From: jade <101148768+jadeddelta@users.noreply.github.com> Date: Mon, 4 Nov 2024 18:49:15 -0500 Subject: [PATCH] fix test cases --- packages/plugin-html-button-response/src/index.spec.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/plugin-html-button-response/src/index.spec.ts b/packages/plugin-html-button-response/src/index.spec.ts index 2dd527bfe7..65cd2c0c2f 100644 --- a/packages/plugin-html-button-response/src/index.spec.ts +++ b/packages/plugin-html-button-response/src/index.spec.ts @@ -4,6 +4,10 @@ import htmlButtonResponse from "."; jest.useFakeTimers(); +beforeEach(() => { + document.body.innerHTML = ""; +}); + describe("html-button-response", () => { it("displays html stimulus and buttons", async () => { const { getHTML } = await startTimeline([ @@ -151,7 +155,8 @@ describe("html-button-response", () => { }, ]); - const btns = document.querySelectorAll(".jspsych-html-button-response-button button"); + const btns = document.querySelectorAll("div#jspsych-html-button-response-btngroup button"); + expect(btns.length).toBeGreaterThan(0); for (let i = 0; i < btns.length; i++) { expect(btns[i].getAttribute("disabled")).toBe("disabled");