mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
Merge pull request #3364 from levigoldberg/patch-1
Change broken selection in enable_button_after parameter
This commit is contained in:
commit
a92a0f9570
5
.changeset/many-dogs-shave.md
Normal file
5
.changeset/many-dogs-shave.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"@jspsych/plugin-html-button-response": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Change broken selection in enable_button_after parameter
|
@ -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++) {
|
for (let i = 0; i < btns.length; i++) {
|
||||||
expect(btns[i].getAttribute("disabled")).toBe("disabled");
|
expect(btns[i].getAttribute("disabled")).toBe("disabled");
|
||||||
|
@ -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
|
// 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) {
|
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++) {
|
for (var i = 0; i < btns.length; i++) {
|
||||||
btns[i].setAttribute("disabled", "disabled");
|
btns[i].setAttribute("disabled", "disabled");
|
||||||
}
|
}
|
||||||
this.jsPsych.pluginAPI.setTimeout(() => {
|
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++) {
|
for (var i = 0; i < btns.length; i++) {
|
||||||
btns[i].removeAttribute("disabled");
|
btns[i].removeAttribute("disabled");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user