mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-12 08:38:11 +00:00
add auto preload test
This commit is contained in:
parent
ffc80a372e
commit
b67d4a4881
@ -13,4 +13,21 @@ describe('video-button-response plugin', function(){
|
|||||||
expect(typeof window.jsPsych.plugins['video-button-response']).not.toBe('undefined');
|
expect(typeof window.jsPsych.plugins['video-button-response']).not.toBe('undefined');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('video preloading initiates automatically', function(){
|
||||||
|
const preload_spy = jest.spyOn(jsPsych.pluginAPI, 'registerPreload');
|
||||||
|
const console_spy = jest.spyOn(console, 'warn');
|
||||||
|
var trial = {
|
||||||
|
type: 'video-button-response',
|
||||||
|
stimulus: [root + 'tests/media/sample_video.mp4'],
|
||||||
|
choices: ['y']
|
||||||
|
}
|
||||||
|
jsPsych.init({
|
||||||
|
timeline: [trial]
|
||||||
|
});
|
||||||
|
//expect(preload_spy).toHaveBeenCalled(); // NOT WORKING
|
||||||
|
expect(console_spy).not.toHaveBeenCalled();
|
||||||
|
preload_spy.mockRestore();
|
||||||
|
console_spy.mockRestore();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -13,4 +13,21 @@ describe('video-keyboard-response plugin', function(){
|
|||||||
expect(typeof window.jsPsych.plugins['video-keyboard-response']).not.toBe('undefined');
|
expect(typeof window.jsPsych.plugins['video-keyboard-response']).not.toBe('undefined');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('video preloading initiates automatically', function(){
|
||||||
|
const preload_spy = jest.spyOn(jsPsych.pluginAPI, 'registerPreload');
|
||||||
|
const console_spy = jest.spyOn(console, 'warn');
|
||||||
|
var trial = {
|
||||||
|
type: 'video-keyboard-response',
|
||||||
|
stimulus: [root + 'tests/media/sample_video.mp4'],
|
||||||
|
choices: jsPsych.ALL_KEYS
|
||||||
|
}
|
||||||
|
jsPsych.init({
|
||||||
|
timeline: [trial]
|
||||||
|
});
|
||||||
|
//expect(preload_spy).toHaveBeenCalled(); // NOT WORKING
|
||||||
|
expect(console_spy).not.toHaveBeenCalled();
|
||||||
|
preload_spy.mockRestore();
|
||||||
|
console_spy.mockRestore();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -13,4 +13,20 @@ describe('video-slider-response plugin', function(){
|
|||||||
expect(typeof window.jsPsych.plugins['video-slider-response']).not.toBe('undefined');
|
expect(typeof window.jsPsych.plugins['video-slider-response']).not.toBe('undefined');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('video preloading initiates automatically', function(){
|
||||||
|
const preload_spy = jest.spyOn(jsPsych.pluginAPI, 'registerPreload');
|
||||||
|
const console_spy = jest.spyOn(console, 'warn');
|
||||||
|
var trial = {
|
||||||
|
type: 'video-slider-response',
|
||||||
|
stimulus: [root + 'tests/media/sample_video.mp4']
|
||||||
|
}
|
||||||
|
jsPsych.init({
|
||||||
|
timeline: [trial]
|
||||||
|
});
|
||||||
|
//expect(preload_spy).toHaveBeenCalled(); // NOT WORKING
|
||||||
|
expect(console_spy).not.toHaveBeenCalled();
|
||||||
|
preload_spy.mockRestore();
|
||||||
|
console_spy.mockRestore();
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user