Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/flat-mammals-hug.md
Original file line number Diff line number Diff line change
@@ -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.
6 changes: 3 additions & 3 deletions packages/plugin-button-click-counter/src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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"
);
});

Expand Down Expand Up @@ -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 () => {
Expand Down
4 changes: 2 additions & 2 deletions packages/plugin-button-click-counter/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class ButtonClickCounterPlugin implements JsPsychPlugin<Info> {
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);

Expand All @@ -89,7 +89,7 @@ class ButtonClickCounterPlugin implements JsPsychPlugin<Info> {

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();
});
Expand Down
Loading