diff --git a/tests/jsPsych/timelines.test.js b/tests/jsPsych/timelines.test.js index 196a691a..4e4caea0 100644 --- a/tests/jsPsych/timelines.test.js +++ b/tests/jsPsych/timelines.test.js @@ -348,12 +348,44 @@ describe('endCurrentTimeline', function(){ }) }); + +describe('nested timelines', function() { + test('works without other parameters', function() { + var t1 = { + type: 'html-keyboard-response', + stimulus: 'foo' + }; + + var t2 = { + type: 'html-keyboard-response', + stimulus: 'bar' + }; + + var trials = { + timeline: [t1, t2] + }; + + jsPsych.init({ + timeline: [trials] + }); + + expect(jsPsych.getDisplayElement().innerHTML).toMatch('foo'); + + utils.pressKey(32); + + expect(jsPsych.getDisplayElement().innerHTML).toMatch('bar'); + + utils.pressKey(32); + + }) +}) + describe('add node to end of timeline', function(){ test('adds node to end of timeline, without callback', function() { var new_trial = { - type: 'html-keyboard-response', - stimulus: 'bar' + type: 'html-keyboard-response', + stimulus: 'bar' }; var new_timeline = { @@ -406,4 +438,5 @@ describe('add node to end of timeline', function(){ }); -}); \ No newline at end of file +}); +