diff --git a/tests/jsPsych.data/interactions.test.js b/tests/jsPsych.data/interactions.test.js index cd02e099..cf114fe6 100644 --- a/tests/jsPsych.data/interactions.test.js +++ b/tests/jsPsych.data/interactions.test.js @@ -25,9 +25,7 @@ describe('Data recording', function(){ {type: 'text', text:'hello'} ]; jsPsych.init({timeline:timeline}); - console.log(jsPsych.data.getInteractionData().json()) window.dispatchEvent(new Event('blur')); - console.log(jsPsych.data.getInteractionData().json()) // click through first trial document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keydown', {keyCode: 32})); document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keyup', {keyCode: 32})); @@ -80,15 +78,14 @@ describe('on_interaction_data_update', function(){ on_interaction_data_update: updatefn }); window.dispatchEvent(new Event('blur')); - console.log(jsPsych.data.getInteractionData().json()) - expect(updatefn.mock.calls.length).toBe(1); + expect(updatefn.mock.calls.length).toBeGreaterThanOrEqual(1); // >= because of jsdom window not isolated to this test. + // click through first trial document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keydown', {keyCode: 32})); document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keyup', {keyCode: 32})); - // check data }); - test.only('fires for focus', function(){ + test('fires for focus', function(){ var updatefn = jest.fn(); var timeline = [ @@ -99,12 +96,10 @@ describe('on_interaction_data_update', function(){ on_interaction_data_update: updatefn }); window.dispatchEvent(new Event('focus')); - console.log(jsPsych.data.getInteractionData().json()) - expect(updatefn.mock.calls.length).toBe(1); + expect(updatefn.mock.calls.length).toBeGreaterThanOrEqual(1); // >= because of jsdom window not isolated to this test. // click through first trial document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keydown', {keyCode: 32})); document.querySelector('.jspsych-display-element').dispatchEvent(new KeyboardEvent('keyup', {keyCode: 32})); - // check data }) /* not sure yet how to test fullscreen events with jsdom engine */