mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-11 16:18:11 +00:00

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.
33 lines
959 B
TypeScript
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");
|
|
});
|
|
});
|