import { pressKey, startTimeline } from "@jspsych/test-utils";
import imageKeyboardResponse from ".";
jest.useFakeTimers();
describe("image-keyboard-response", () => {
test("displays image stimulus", async () => {
const { getHTML, expectFinished } = await startTimeline([
{
type: imageKeyboardResponse,
stimulus: "../media/blue.png",
render_on_canvas: false,
},
]);
expect(getHTML()).toContain(
'
{
const { getHTML, expectFinished } = await startTimeline([
{
type: imageKeyboardResponse,
stimulus: "../media/blue.png",
choices: ["f", "j"],
render_on_canvas: false,
},
]);
expect(getHTML()).toContain(
'
{
const { getHTML, expectFinished } = await startTimeline([
{
type: imageKeyboardResponse,
stimulus: "../media/blue.png",
choices: ["f", "j"],
prompt: '
{
const { getHTML, expectFinished } = await startTimeline([
{
type: imageKeyboardResponse,
stimulus: "../media/blue.png",
choices: ["f", "j"],
response_ends_trial: true,
render_on_canvas: false,
},
]);
expect(getHTML()).toContain(
'
{
const spy = jest.spyOn(console, "warn").mockImplementation(() => {});
const { getHTML } = await startTimeline([
{
type: imageKeyboardResponse,
stimulus: "../media/blue.png",
choices: ["f", "j"],
response_ends_trial: false,
trial_duration: null,
render_on_canvas: false,
},
]);
expect(spy).toHaveBeenCalled();
spy.mockRestore();
});
});