mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-12 16:48:12 +00:00
added tests for trial deadlock
This commit is contained in:
parent
d6f3d79d04
commit
5050d636a4
@ -151,4 +151,23 @@ describe('image-button-response', function(){
|
|||||||
|
|
||||||
expect(jsPsych.getDisplayElement().innerHTML).toBe('');
|
expect(jsPsych.getDisplayElement().innerHTML).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should show console warning when trial duration is null and response ends trial is false', function() {
|
||||||
|
var trial = {
|
||||||
|
type: 'image-button-response',
|
||||||
|
stimulus: '../media/blue.png',
|
||||||
|
choices: ['button-choice'],
|
||||||
|
response_ends_trial: false,
|
||||||
|
trial_duration: null
|
||||||
|
};
|
||||||
|
|
||||||
|
jsPsych.init({
|
||||||
|
timeline: [trial],
|
||||||
|
auto_preload: false
|
||||||
|
});
|
||||||
|
|
||||||
|
spy = jest.spyOn(console, 'warn').mockImplementation();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith("The experiment may be stuck in a loop. Try setting a trial duration or set response_ends_trial to true.");
|
||||||
|
spy.mockRestore();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
@ -123,4 +123,24 @@ describe('image-keyboard-response', function(){
|
|||||||
|
|
||||||
expect(jsPsych.getDisplayElement().innerHTML).toBe('');
|
expect(jsPsych.getDisplayElement().innerHTML).toBe('');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
test('should show console warning when trial duration is null and response ends trial is false', function() {
|
||||||
|
var trial = {
|
||||||
|
type: 'image-keyboard-response',
|
||||||
|
stimulus: '../media/blue.png',
|
||||||
|
choices: ['f','j'],
|
||||||
|
response_ends_trial: false,
|
||||||
|
trial_duration: null
|
||||||
|
};
|
||||||
|
|
||||||
|
jsPsych.init({
|
||||||
|
timeline: [trial],
|
||||||
|
auto_preload: false
|
||||||
|
});
|
||||||
|
|
||||||
|
spy = jest.spyOn(console, 'warn').mockImplementation();
|
||||||
|
expect(console.warn).toHaveBeenCalledWith("The experiment may be stuck in a loop. Try setting a trial duration or set response_ends_trial to true.");
|
||||||
|
spy.mockRestore();
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user