mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 11:10:54 +00:00
37 lines
855 B
TypeScript
37 lines
855 B
TypeScript
import imageKeyboardResponse from "@jspsych/plugin-image-keyboard-response";
|
|
|
|
import jsPsych from "../../src";
|
|
import * as pluginAPI from "../../src/plugin-api";
|
|
|
|
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 = 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 = pluginAPI.getAutoPreloadList(timeline).images;
|
|
|
|
expect(images[0]).toBe("img/foo.png");
|
|
});
|
|
});
|