import { clickTarget, startTimeline } from "@jspsych/test-utils"; import surveyHtmlForm from "."; const TEST_VALUE = "jsPsych"; describe("survey-html-form plugin", () => { test("default parameters work correctly", async () => { const { displayElement, expectFinished, getData } = await startTimeline([ { type: surveyHtmlForm, html: '

I am feeling , , and .

', }, ]); expect( displayElement.querySelectorAll('#jspsych-survey-html-form input:not([type="submit"]').length ).toBe(3); // Provide some test input displayElement.querySelectorAll( '#jspsych-survey-html-form input[name="second"]' )[0].value = TEST_VALUE; clickTarget(document.querySelector("#jspsych-survey-html-form-next")); await expectFinished(); // Check whether data is parsed properly const data = getData().values()[0].response; expect(data.second).toBe(TEST_VALUE); }); });