const root = '../../';

jest.useFakeTimers();

describe('survey-text plugin', function(){

	beforeEach(function(){
		require(root + 'jspsych.js');
		require(root + 'plugins/jspsych-survey-text.js');
	});

	test('loads correctly', function(){
		expect(typeof window.jsPsych.plugins['survey-text']).not.toBe('undefined');
	});

});

@@ -15,16 +15,62 @@
 ../../';
+%0Aconst utils = require('../testing-utils.js');
 %0A%0Ajest.u
@@ -365,12 +365,704 @@
 ;%0A%09%7D);%0A%0A
+%09test('default parameters work correctly', function()%7B%0A%09%09var trial = %7B%0A%09%09%09type: 'survey-text',%0A%09%09%09questions: %5B%7Bprompt: %22How old are you?%22%7D, %7Bprompt: %22Where were you born?%22%7D%5D%0A%09%09%7D%0A%0A%09%09jsPsych.init(%7B%0A%09%09%09timeline: %5Btrial%5D%0A%09%09%7D);%0A%0A%09%09expect(jsPsych.getDisplayElement().querySelectorAll('p.jspsych-survey-text').length).toBe(2);%0A%09%09expect(jsPsych.getDisplayElement().querySelector('input%5Bname=%22#jspsych-survey-text-response-0%22%5D').size).toBe(40);%0A%09%09expect(jsPsych.getDisplayElement().querySelector('input%5Bname=%22#jspsych-survey-text-response-1%22%5D').size).toBe(40);%0A%0A%09%09utils.clickTarget(document.querySelector('#jspsych-survey-text-next'));%0A%0A%09%09expect(jsPsych.getDisplayElement().innerHTML).toBe('');%0A%09%7D);%0A%0A
 %7D);%0A

add a test case for survey-text defaults