From f81f47351fc1d753ace259986799940ac677ae88 Mon Sep 17 00:00:00 2001 From: Toby Fantl Date: Tue, 26 May 2026 16:34:12 -0400 Subject: [PATCH 1/3] Increased click increment value to 100 and set initial click value to click count opposed to zero. --- .changeset/flat-mammals-hug.md | 5 +++++ packages/plugin-button-click-counter/src/index.ts | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/flat-mammals-hug.md 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.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(); }); From acb9a1be0212450904571cc5aac2ba355b831412 Mon Sep 17 00:00:00 2001 From: Toby Fantl Date: Wed, 27 May 2026 13:36:49 -0400 Subject: [PATCH 2/3] Changed the spec file --- packages/plugin-button-click-counter/src/index.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugin-button-click-counter/src/index.spec.ts b/packages/plugin-button-click-counter/src/index.spec.ts index b98ad7b..770833d 100644 --- a/packages/plugin-button-click-counter/src/index.spec.ts +++ b/packages/plugin-button-click-counter/src/index.spec.ts @@ -52,7 +52,7 @@ 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( From 3b9aae1623c8538fd46023d548099978cf410e04 Mon Sep 17 00:00:00 2001 From: Toby Fantl Date: Wed, 27 May 2026 13:42:43 -0400 Subject: [PATCH 3/3] Fixed spec file --- packages/plugin-button-click-counter/src/index.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/plugin-button-click-counter/src/index.spec.ts b/packages/plugin-button-click-counter/src/index.spec.ts index 770833d..c5dd222 100644 --- a/packages/plugin-button-click-counter/src/index.spec.ts +++ b/packages/plugin-button-click-counter/src/index.spec.ts @@ -56,7 +56,7 @@ describe("button-click-counter", () => { ); 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 () => {