Merge pull request #3213 from jspsych/add-response-ends-trial-vs-circle

Fix display clearing bug in visual search circle plugin version 1.2.0
This commit is contained in:
Josh de Leeuw 2024-01-14 13:47:25 -05:00 committed by GitHub
commit daea41bd16
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,5 @@
---
"@jspsych/plugin-visual-search-circle": patch
---
Fix display clearing problem introduced with version 1.2.0

View File

@ -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);
});
});

View File

@ -166,6 +166,8 @@ class VisualSearchCirclePlugin implements JsPsychPlugin<Info> {
};
const end_trial = () => {
display_element.innerHTML = "";
this.jsPsych.pluginAPI.clearAllTimeouts();
this.jsPsych.pluginAPI.cancelAllKeyboardResponses();