Skip to content

Commit

Permalink
add chs_type: consent to video consent plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
becky-gilbert committed Oct 15, 2024
1 parent ed5ea88 commit 61cf0ee
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/record/src/consentVideo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -272,3 +272,7 @@ test("nextButton", () => {

expect(jsPsych.finishTrial).toHaveBeenCalledTimes(1);
});

test("Does video consent plugin return chsData correctly?", () => {
expect(VideoConsentPlugin.chsData()).toMatchObject({ chs_type: "consent" });
});
11 changes: 11 additions & 0 deletions packages/record/src/consentVideo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,4 +281,15 @@ export class VideoConsentPlugin implements JsPsychPlugin<Info> {
const next = this.getButton(display, "next");
next.addEventListener("click", () => this.jsPsych.finishTrial());
}

/**
* Add CHS type to experiment data. This will enable Lookit API to run the
* "consent" Frame Action Dispatcher method after the experiment has
* completed. It looks like jsPsych uses snake case for these data.
*
* @returns Object containing CHS type.
*/
public static chsData() {
return { chs_type: "consent" };
}
}

0 comments on commit 61cf0ee

Please sign in to comment.