jsPsych/packages/jspsych/tests/pluginAPI/preloads.test.js
bjoluc 744e67b0a5 Setup monorepo and switch to ES6 modules
* Convert jsPsych and plugins to ES6 modules
* Create packages for each plugin, the core library, and config files
* Setup rollup, jest, and babel configurations
* Update jsPsych to load plugin objects directly from the `type` field
* Update tests to use the ES6 modules
2021-06-23 22:39:38 +02:00

36 lines
820 B
JavaScript

import imageKeyboardResponse from "@jspsych/plugin-image-keyboard-response";
import jsPsych from "../../src";
describe("getAutoPreloadList", function () {
test("gets whole timeline when no argument provided", function () {
var t = {
type: imageKeyboardResponse,
stimulus: "img/foo.png",
render_on_canvas: false,
};
var timeline = [t];
jsPsych.init({
timeline: timeline,
});
var images = jsPsych.pluginAPI.getAutoPreloadList().images;
expect(images[0]).toBe("img/foo.png");
});
test("works with images", function () {
var t = {
type: imageKeyboardResponse,
stimulus: "img/foo.png",
};
var timeline = [t];
var images = jsPsych.pluginAPI.getAutoPreloadList(timeline).images;
expect(images[0]).toBe("img/foo.png");
});
});