add test case for response_ends_trial

This commit is contained in:
Josh de Leeuw 2024-01-14 12:54:35 -05:00
parent d54048b8d0
commit 1c7d0af829

View File

@ -29,6 +29,36 @@ describe("visual-search-circle", () => {
expect(getData().values()[0].correct).toBe(true);
});
it("wait when response_ends_trial is false", async () => {
const { displayElement, expectFinished, expectRunning, getData } = await startTimeline([
{
type: visualSearchCircle,
target: "target.png",
foil: "foil.png",
fixation_image: "fixation.png",
set_size: 4,
target_present: true,
target_present_key: "a",
target_absent_key: "b",
response_ends_trial: false,
trial_duration: 1500,
},
]);
expect(displayElement.querySelectorAll("img").length).toBe(1);
jest.advanceTimersByTime(1000); // fixation duration
expect(displayElement.querySelectorAll("img").length).toBe(5);
pressKey("a");
await expectRunning();
jest.runAllTimers();
await expectFinished();
expect(getData().values()[0].correct).toBe(true);
});
});
describe("visual-search-circle simulation", () => {