mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-12 16:48:12 +00:00
19 lines
704 B
JavaScript
19 lines
704 B
JavaScript
require('../jspsych.js');
|
|
require('../plugins/jspsych-text.js');
|
|
|
|
describe('#addProperties', function(){
|
|
test('should add data to all trials if called before experiment starts', function(){
|
|
var timeline = [
|
|
{type: 'text', text:'hello'}
|
|
];
|
|
jsPsych.data.addProperties({'testprop': 1});
|
|
jsPsych.init({timeline:timeline});
|
|
// click through first trial
|
|
document.dispatchEvent(new KeyboardEvent('keydown', {keyCode: 32}));
|
|
document.dispatchEvent(new KeyboardEvent('keyup', {keyCode: 32}));
|
|
// check if data contains testprop
|
|
expect(jsPsych.data.getData().select('rt').count()).toBe(1);
|
|
expect(jsPsych.data.getData().select('testprop').count()).toBe(1);
|
|
});
|
|
})
|