From 6ddd202bde0260961da56a46f0bb8627de4420fe Mon Sep 17 00:00:00 2001 From: Josh de Leeuw Date: Sat, 10 Jun 2017 23:49:16 -0400 Subject: [PATCH] shell of interaction data tests #350 --- tests/jsPsych.data/interactions.test.js | 71 +++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 tests/jsPsych.data/interactions.test.js diff --git a/tests/jsPsych.data/interactions.test.js b/tests/jsPsych.data/interactions.test.js new file mode 100644 index 00000000..c936231b --- /dev/null +++ b/tests/jsPsych.data/interactions.test.js @@ -0,0 +1,71 @@ +const root = '../../'; + +require(root + 'jspsych.js'); + +require(root + 'plugins/jspsych-text.js'); + +describe('Data recording', function(){ + + xtest('record focus events', function(){ + var timeline = [ + {type: 'text', text:'hello'} + ]; + jsPsych.init({timeline:timeline}); + // 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 if data contains rt + }) + + xtest('record blur events', function(){ + var timeline = [ + {type: 'text', text:'hello'} + ]; + jsPsych.init({timeline:timeline}); + // 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 if data contains rt + }) + + xtest('record fullscreenenter events', function(){ + var timeline = [ + {type: 'text', text:'hello'} + ]; + jsPsych.init({timeline:timeline}); + // 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 if data contains rt + }) + + xtest('record fullscreenexit events', function(){ + var timeline = [ + {type: 'text', text:'hello'} + ]; + jsPsych.init({timeline:timeline}); + // 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 if data contains rt + }) + +}) + +describe('on_interaction_data_update', function(){ + xtest('fires for blur', function(){ + + }); + + xtest('fires for focus', function(){ + + }) + + xtest('fires for fullscreenexit', function(){ + + }) + + xtest('fires for fullscreenenter', function(){ + + }) +})