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");