mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-12 16:48:12 +00:00
add a test case for survey-text defaults
This commit is contained in:
parent
a4b3271b09
commit
f2319fec53
@ -1,4 +1,5 @@
|
||||
const root = '../../';
|
||||
const utils = require('../testing-utils.js');
|
||||
|
||||
jest.useFakeTimers();
|
||||
|
||||
@ -13,4 +14,23 @@ describe('survey-text plugin', function(){
|
||||
expect(typeof window.jsPsych.plugins['survey-text']).not.toBe('undefined');
|
||||
});
|
||||
|
||||
test('default parameters work correctly', function(){
|
||||
var trial = {
|
||||
type: 'survey-text',
|
||||
questions: [{prompt: "How old are you?"}, {prompt: "Where were you born?"}]
|
||||
}
|
||||
|
||||
jsPsych.init({
|
||||
timeline: [trial]
|
||||
});
|
||||
|
||||
expect(jsPsych.getDisplayElement().querySelectorAll('p.jspsych-survey-text').length).toBe(2);
|
||||
expect(jsPsych.getDisplayElement().querySelector('input[name="#jspsych-survey-text-response-0"]').size).toBe(40);
|
||||
expect(jsPsych.getDisplayElement().querySelector('input[name="#jspsych-survey-text-response-1"]').size).toBe(40);
|
||||
|
||||
utils.clickTarget(document.querySelector('#jspsych-survey-text-next'));
|
||||
|
||||
expect(jsPsych.getDisplayElement().innerHTML).toBe('');
|
||||
});
|
||||
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user