From d2d180967a21c5064608da57d88c8c21ee6498f8 Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 13:40:42 -0500 Subject: [PATCH 1/2] fix display_clear bug --- packages/plugin-visual-search-circle/src/index.spec.ts | 4 ++++ packages/plugin-visual-search-circle/src/index.ts | 2 ++ 2 files changed, 6 insertions(+) diff --git a/packages/plugin-visual-search-circle/src/index.spec.ts b/packages/plugin-visual-search-circle/src/index.spec.ts index bb69740c75..bd530e49b5 100644 --- a/packages/plugin-visual-search-circle/src/index.spec.ts +++ b/packages/plugin-visual-search-circle/src/index.spec.ts @@ -27,6 +27,8 @@ describe("visual-search-circle", () => { pressKey("a"); await expectFinished(); + expect(displayElement.querySelectorAll("img").length).toBe(0); + expect(getData().values()[0].correct).toBe(true); }); @@ -57,6 +59,8 @@ describe("visual-search-circle", () => { jest.runAllTimers(); await expectFinished(); + expect(displayElement.querySelectorAll("img").length).toBe(0); + expect(getData().values()[0].correct).toBe(true); }); }); diff --git a/packages/plugin-visual-search-circle/src/index.ts b/packages/plugin-visual-search-circle/src/index.ts index 0efff05000..e329632d7a 100644 --- a/packages/plugin-visual-search-circle/src/index.ts +++ b/packages/plugin-visual-search-circle/src/index.ts @@ -166,6 +166,8 @@ class VisualSearchCirclePlugin implements JsPsychPlugin { }; const end_trial = () => { + display_element.innerHTML = ""; + this.jsPsych.pluginAPI.clearAllTimeouts(); this.jsPsych.pluginAPI.cancelAllKeyboardResponses(); From 7b797727fa3b2b384ef964eb53d74f474ec902ef Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sun, 14 Jan 2024 13:41:22 -0500 Subject: [PATCH 2/2] add changeset --- .changeset/clever-coats-invent.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/clever-coats-invent.md diff --git a/.changeset/clever-coats-invent.md b/.changeset/clever-coats-invent.md new file mode 100644 index 0000000000..4944e78781 --- /dev/null +++ b/.changeset/clever-coats-invent.md @@ -0,0 +1,5 @@ +--- +"@jspsych/plugin-visual-search-circle": patch +--- + +Fix display clearing problem introduced with version 1.2.0