diff --git a/.changeset/flat-mammals-hug.md b/.changeset/flat-mammals-hug.md new file mode 100644 index 0000000..19d78dc --- /dev/null +++ b/.changeset/flat-mammals-hug.md @@ -0,0 +1,5 @@ +--- +"@jspsych/plugin-button-click-counter": major +--- + +Increased click increment value to 100 and set initial click value to click count opposed to zero. diff --git a/packages/plugin-button-click-counter/src/index.spec.ts b/packages/plugin-button-click-counter/src/index.spec.ts index b98ad7b..c5dd222 100644 --- a/packages/plugin-button-click-counter/src/index.spec.ts +++ b/packages/plugin-button-click-counter/src/index.spec.ts @@ -52,11 +52,11 @@ describe("button-click-counter", () => { ); btn.click(); expect(displayElement.querySelector("#jspsych-button-click-counter-value").textContent).toBe( - "1" + "100" ); btn.click(); expect(displayElement.querySelector("#jspsych-button-click-counter-value").textContent).toBe( - "2" + "200" ); }); @@ -118,7 +118,7 @@ describe("button-click-counter", () => { await pressKey("Enter"); await expectFinished(); - expect(getData().values()[0].button_clicks).toBe(3); + expect(getData().values()[0].button_clicks).toBe(300); }); it("records rt and key_pressed in trial data", async () => { diff --git a/packages/plugin-button-click-counter/src/index.ts b/packages/plugin-button-click-counter/src/index.ts index 0359a23..0362f56 100644 --- a/packages/plugin-button-click-counter/src/index.ts +++ b/packages/plugin-button-click-counter/src/index.ts @@ -70,7 +70,7 @@ class ButtonClickCounterPlugin implements JsPsychPlugin { countPara.appendChild(document.createTextNode("Button clicks: ")); const countSpan = document.createElement("span"); countSpan.id = "jspsych-button-click-counter-value"; - countSpan.textContent = "0"; + countSpan.textContent = click_count.toString(); countPara.appendChild(countSpan); wrapper.appendChild(countPara); @@ -89,7 +89,7 @@ class ButtonClickCounterPlugin implements JsPsychPlugin { display_element.appendChild(wrapper); btn.addEventListener("click", () => { - click_count++; + click_count = (click_count+100); display_element.querySelector("#jspsych-button-click-counter-value").textContent = click_count.toString(); });