Skip to content

Commit

Permalink
Merge pull request #3364 from levigoldberg/patch-1
Browse files Browse the repository at this point in the history
Change broken selection in enable_button_after parameter
  • Loading branch information
jodeleeuw authored Dec 2, 2024
2 parents b9bf2f3 + dd3caab commit a92a0f9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/many-dogs-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@jspsych/plugin-html-button-response": patch
---

Change broken selection in enable_button_after parameter
3 changes: 2 additions & 1 deletion packages/plugin-html-button-response/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,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");
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-html-button-response/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ class HtmlButtonResponsePlugin implements JsPsychPlugin<Info> {

// disable all the buttons and set a timeout that enables them after a specified delay if timing is set
if (trial.enable_button_after > 0) {
var btns = document.querySelectorAll(".jspsych-html-button-response-button button");
var btns = document.querySelectorAll("#jspsych-html-button-response-btngroup button");
for (var i = 0; i < btns.length; i++) {
btns[i].setAttribute("disabled", "disabled");
}
this.jsPsych.pluginAPI.setTimeout(() => {
var btns = document.querySelectorAll(".jspsych-html-button-response-button button");
var btns = document.querySelectorAll("#jspsych-html-button-response-btngroup button");
for (var i = 0; i < btns.length; i++) {
btns[i].removeAttribute("disabled");
}
Expand Down

0 comments on commit a92a0f9

Please sign in to comment.