mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
add test case for response_ends_trial
This commit is contained in:
parent
d54048b8d0
commit
1c7d0af829
@ -29,6 +29,36 @@ describe("visual-search-circle", () => {
|
|||||||
|
|
||||||
expect(getData().values()[0].correct).toBe(true);
|
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", () => {
|
describe("visual-search-circle simulation", () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user