From e51a3beee8f947df69ed8e5acf32bb847e302f7e Mon Sep 17 00:00:00 2001 From: bjoluc Date: Wed, 20 Dec 2023 20:01:54 +0100 Subject: [PATCH] Run prettier on video-several-keyboard-responses plugin --- .../src/index.spec.ts | 8 ++++---- .../src/index.ts | 17 +++++++++-------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/packages/plugin-video-several-keyboard-responses/src/index.spec.ts b/packages/plugin-video-several-keyboard-responses/src/index.spec.ts index 1d2ac515..e270ff9d 100644 --- a/packages/plugin-video-several-keyboard-responses/src/index.spec.ts +++ b/packages/plugin-video-several-keyboard-responses/src/index.spec.ts @@ -71,12 +71,12 @@ describe("video-several-keyboard-responses simulation", () => { jest.runAllTimers(); await expectFinished(); - + const rt = getData().values()[0].rt; const response = getData().values()[0].response; const video_time = getData().values()[0].video_time; - expect(rt.every(value => value > 0)).toBe(true); - expect(response.every(value => typeof value === "string")).toBe(true); - expect(video_time.every(value => typeof value === "number")).toBe(true); + expect(rt.every((value) => value > 0)).toBe(true); + expect(response.every((value) => typeof value === "string")).toBe(true); + expect(video_time.every((value) => typeof value === "number")).toBe(true); }); }); diff --git a/packages/plugin-video-several-keyboard-responses/src/index.ts b/packages/plugin-video-several-keyboard-responses/src/index.ts index b5e7667a..c8f4f32b 100644 --- a/packages/plugin-video-several-keyboard-responses/src/index.ts +++ b/packages/plugin-video-several-keyboard-responses/src/index.ts @@ -252,7 +252,7 @@ class VideoSeveralKeyboardResponsesPlugin implements JsPsychPlugin { var response = { rt: null, key: null, - video_time: null + video_time: null, }; // function to end trial when it is time @@ -291,18 +291,19 @@ class VideoSeveralKeyboardResponsesPlugin implements JsPsychPlugin { var after_response = (info) => { // after a valid response, the stimulus will have the CSS class 'responded' // which can be used to provide visual feedback that a response was recorded - display_element.querySelector("#jspsych-video-several-keyboard-responses-stimulus").className += - " responded"; + display_element.querySelector( + "#jspsych-video-several-keyboard-responses-stimulus" + ).className += " responded"; // by default only record the first response if (response.key == null) { - if(!trial.multiple_responses_allowed){ + if (!trial.multiple_responses_allowed) { // Would make sense to add it to a list, but then it would not be backwards compatible? - response = {rt: info.rt, key: info.key, video_time: video_element.currentTime,}; - }else{ - response = {rt: [info.rt], key: [info.key], video_time: [video_element.currentTime]}; + response = { rt: info.rt, key: info.key, video_time: video_element.currentTime }; + } else { + response = { rt: [info.rt], key: [info.key], video_time: [video_element.currentTime] }; } - }else if (trial.multiple_responses_allowed){ + } else if (trial.multiple_responses_allowed) { response.rt.push(info.rt); response.key.push(info.key); response.video_time.push(video_element.currentTime);