@lookit/templates 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.spec.ts CHANGED
@@ -74,6 +74,89 @@ test("consent garden template", () => {
74
74
  expect(chsTemplate.consentVideo(trial)).toContain("Project GARDEN");
75
75
  });
76
76
 
77
+ test("consent video with consent-recording-only template", () => {
78
+ const trial = getTrial({ template: "consent-recording-only" });
79
+ const name = "some name";
80
+ window.chs = {
81
+ study: {
82
+ attributes: {
83
+ name,
84
+ duration: "duration",
85
+ },
86
+ },
87
+ } as typeof window.chs;
88
+
89
+ expect(chsTemplate.consentVideo(trial)).toContain(
90
+ '<div id="consent-video-trial">',
91
+ );
92
+ expect(chsTemplate.consentVideo(trial)).toContain(
93
+ `You and your child will be recorded by your computer&#x27;s webcam and microphone only while providing verbal consent.`,
94
+ );
95
+ expect(chsTemplate.consentVideo(trial)).toContain(
96
+ `This webcam recording and other data collected on the CHS/Lookit website are sent securely to the Lookit platform.`,
97
+ );
98
+ expect(chsTemplate.consentVideo(trial)).not.toContain(
99
+ `You will also have the option to withdraw your recordings. If you do, only your consent recording will be kept and all other recordings will be deleted.`,
100
+ );
101
+ });
102
+
103
+ test("consent video with consent-recording-only template and only consent on CHS", () => {
104
+ const trial = getTrial({
105
+ template: "consent-recording-only",
106
+ only_consent_on_chs: true,
107
+ });
108
+ const name = "some name";
109
+ window.chs = {
110
+ study: {
111
+ attributes: {
112
+ name,
113
+ duration: "duration",
114
+ },
115
+ },
116
+ } as typeof window.chs;
117
+
118
+ expect(chsTemplate.consentVideo(trial)).toContain(
119
+ '<div id="consent-video-trial">',
120
+ );
121
+ expect(chsTemplate.consentVideo(trial)).toContain(
122
+ `You and your child will be recorded by your computer&#x27;s webcam and microphone only while providing verbal consent.`,
123
+ );
124
+ expect(chsTemplate.consentVideo(trial)).toContain(
125
+ `This webcam recording is sent securely to the Lookit platform.`,
126
+ );
127
+ expect(chsTemplate.consentVideo(trial)).not.toContain(
128
+ `You will also have the option to withdraw your recordings. If you do, only your consent recording will be kept and all other recordings will be deleted.`,
129
+ );
130
+ });
131
+
132
+ test("video consent param only_consent_on_chs is ignored when the template is not consent-recording-only", () => {
133
+ const trial = getTrial({
134
+ only_consent_on_chs: true,
135
+ });
136
+ const name = "some name";
137
+ window.chs = {
138
+ study: {
139
+ attributes: {
140
+ name,
141
+ duration: "duration",
142
+ },
143
+ },
144
+ } as typeof window.chs;
145
+
146
+ expect(chsTemplate.consentVideo(trial)).toContain(
147
+ '<div id="consent-video-trial">',
148
+ );
149
+ expect(chsTemplate.consentVideo(trial)).not.toContain(
150
+ `You and your child will be recorded by your computer&#x27;s webcam and microphone only while providing verbal consent.`,
151
+ );
152
+ expect(chsTemplate.consentVideo(trial)).not.toContain(
153
+ `This webcam recording is sent securely to the Lookit platform.`,
154
+ );
155
+ expect(chsTemplate.consentVideo(trial)).toContain(
156
+ `You will also have the option to withdraw your recordings. If you do, only your consent recording will be kept and all other recordings will be deleted.`,
157
+ );
158
+ });
159
+
77
160
  test("video config template", () => {
78
161
  const trial = getTrial();
79
162