Skip to content

Commit

Permalink
update unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Shaobin-Jiang committed Jan 10, 2024
1 parent f043947 commit 9d1d309
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions packages/jspsych/src/ProgressBar.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,17 @@ describe("ProgressBar", () => {
'"jsPsych.progressBar.progress must be a number between 0 and 1"'
);
});

it("should work when message is a function", () => {
// Override default container element and progress bar
containerElement = document.createElement("div");
progressBar = new ProgressBar(containerElement, (progress: number) => String(progress));
let messageSpan: HTMLSpanElement = containerElement.querySelector("span");

expect(messageSpan.innerHTML).toEqual("0");

progressBar.progress = 0.5;
expect(messageSpan.innerHTML).toEqual("0.5");
});
});
});

0 comments on commit 9d1d309

Please sign in to comment.