jsPsych/packages/jspsych/tests/pluginAPI/preloads.test.ts
bjoluc c119650471 Move experiment execution into jsPsych.run()
The `run()` method takes a timeline and returns a promise that is
resolved when the experiment finishes.
Hence, jsPsych can now be initialized without starting an experiment.
This re-enables usage of `jsPsych.timelineVariable()` in timeline
definitions and repairs exclusion checks and extension loading.
2021-07-19 17:10:37 +02:00

33 lines
959 B
TypeScript

// import imageKeyboardResponse from "@jspsych/plugin-image-keyboard-response";
import { initJsPsych } from "../../src";
describe("getAutoPreloadList", () => {
test.skip("gets whole timeline when no argument provided", async () => {
const timeline = [
{
// @ts-ignore TODO enable this test once the plugin is a class
type: imageKeyboardResponse,
stimulus: "img/foo.png",
render_on_canvas: false,
},
];
const jsPsych = initJsPsych();
expect(jsPsych.pluginAPI.getAutoPreloadList(timeline).images).toBe("img/foo.png");
});
test.skip("works with images", async () => {
const timeline = [
{
// @ts-ignore TODO enable this test once the plugin is a class
type: imageKeyboardResponse,
stimulus: "img/foo.png",
},
];
const jsPsych = initJsPsych();
expect(jsPsych.pluginAPI.getAutoPreloadList(timeline).images[0]).toBe("img/foo.png");
});
});