@khanacademy/perseus 13.0.0 → 13.2.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.
@@ -242,7 +242,7 @@ exports[`graded-group-set should render all graded groups 1`] = `
242
242
  type="button"
243
243
  >
244
244
  <span
245
- class="text_f1191h-o_O-LabelLarge_5s82ln-o_O-text_m8a8ki"
245
+ class="text_f1191h-o_O-LabelLarge_5s82ln-o_O-text_6kf3xs"
246
246
  >
247
247
  Check
248
248
  </span>
@@ -470,7 +470,7 @@ exports[`graded-group-set should render all graded groups 1`] = `
470
470
  type="button"
471
471
  >
472
472
  <span
473
- class="text_f1191h-o_O-LabelLarge_5s82ln-o_O-text_m8a8ki"
473
+ class="text_f1191h-o_O-LabelLarge_5s82ln-o_O-text_6kf3xs"
474
474
  >
475
475
  Check
476
476
  </span>
@@ -698,7 +698,7 @@ exports[`graded-group-set should render all graded groups 1`] = `
698
698
  type="button"
699
699
  >
700
700
  <span
701
- class="text_f1191h-o_O-LabelLarge_5s82ln-o_O-text_m8a8ki"
701
+ class="text_f1191h-o_O-LabelLarge_5s82ln-o_O-text_6kf3xs"
702
702
  >
703
703
  Check
704
704
  </span>
@@ -308,7 +308,7 @@ exports[`graded group widget should snapshot 1`] = `
308
308
  type="button"
309
309
  >
310
310
  <span
311
- class="text_f1191h-o_O-LabelLarge_5s82ln-o_O-text_m8a8ki"
311
+ class="text_f1191h-o_O-LabelLarge_5s82ln-o_O-text_6kf3xs"
312
312
  >
313
313
  Check
314
314
  </span>
@@ -443,7 +443,7 @@ exports[`graded-group should snapshot: initial render (mobile: false) 1`] = `
443
443
  type="button"
444
444
  >
445
445
  <span
446
- class="text_f1191h-o_O-LabelLarge_5s82ln-o_O-text_m8a8ki"
446
+ class="text_f1191h-o_O-LabelLarge_5s82ln-o_O-text_6kf3xs"
447
447
  >
448
448
  Check
449
449
  </span>
@@ -3638,7 +3638,7 @@ exports[`single-choice question reviewMode: true should snapshot the same: first
3638
3638
  </button>
3639
3639
  </div>
3640
3640
  <div
3641
- class="perseus-radio-rationale-content rationale_1w3tmyh"
3641
+ class="perseus-radio-rationale-content rationale_1ctj0s0"
3642
3642
  data-test-id="perseus-radio-rationale-content-0"
3643
3643
  >
3644
3644
  <div
@@ -3834,7 +3834,7 @@ exports[`single-choice question reviewMode: true should snapshot the same: first
3834
3834
  </button>
3835
3835
  </div>
3836
3836
  <div
3837
- class="perseus-radio-rationale-content rationale_1w3tmyh"
3837
+ class="perseus-radio-rationale-content rationale_1ctj0s0"
3838
3838
  data-test-id="perseus-radio-rationale-content-1"
3839
3839
  >
3840
3840
  <div
@@ -4014,7 +4014,7 @@ exports[`single-choice question reviewMode: true should snapshot the same: first
4014
4014
  </button>
4015
4015
  </div>
4016
4016
  <div
4017
- class="perseus-radio-rationale-content rationale_1w3tmyh"
4017
+ class="perseus-radio-rationale-content rationale_1ctj0s0"
4018
4018
  data-test-id="perseus-radio-rationale-content-2"
4019
4019
  >
4020
4020
  <div
@@ -4195,7 +4195,7 @@ exports[`single-choice question reviewMode: true should snapshot the same: first
4195
4195
  </button>
4196
4196
  </div>
4197
4197
  <div
4198
- class="perseus-radio-rationale-content rationale_1w3tmyh"
4198
+ class="perseus-radio-rationale-content rationale_1ctj0s0"
4199
4199
  data-test-id="perseus-radio-rationale-content-3"
4200
4200
  >
4201
4201
  <div
@@ -9,7 +9,7 @@ import {question1} from "../__testdata__/matcher.testdata";
9
9
  import {renderQuestion} from "./renderQuestion";
10
10
 
11
11
  import type {APIOptions} from "../../types";
12
- import type {Matcher} from "enzyme-matchers/lib/types/Matcher";
12
+ import type {Matcher} from "../matcher";
13
13
 
14
14
  describe("matcher widget", () => {
15
15
  beforeEach(() => {
@@ -2,7 +2,7 @@ import "@testing-library/jest-dom";
2
2
 
3
3
  import {testDependencies} from "../../../../../testing/test-dependencies";
4
4
  import * as Dependencies from "../../dependencies";
5
- import {question1} from "../__testdata__/video.testdata";
5
+ import {question1, question2} from "../__testdata__/video.testdata";
6
6
 
7
7
  import {renderQuestion} from "./renderQuestion";
8
8
 
@@ -50,4 +50,20 @@ describe("video widget", () => {
50
50
  // Assert
51
51
  expect(container).toMatchSnapshot("first mobile render");
52
52
  });
53
+
54
+ it("vimeo widget should contain dnt param", () => {
55
+ // Arrange
56
+ const apiOptions: APIOptions = {
57
+ isMobile: false,
58
+ };
59
+
60
+ // Act
61
+ renderQuestion(question2, apiOptions);
62
+
63
+ // Assert
64
+ // eslint-disable-next-line testing-library/no-node-access
65
+ expect(document.getElementsByTagName("iframe")[0].src).toContain(
66
+ "dnt=1",
67
+ );
68
+ });
53
69
  });
@@ -28,7 +28,7 @@ type State = {
28
28
  texRendererLoaded: boolean;
29
29
  };
30
30
 
31
- class Matcher extends React.Component<any, any> {
31
+ export class Matcher extends React.Component<any, any> {
32
32
  static propTypes = {
33
33
  apiOptions: ApiOptions.propTypes,
34
34
  labels: PropTypes.array,
@@ -346,6 +346,7 @@ const styles = StyleSheet.create({
346
346
  padding: intermediateCheckboxPadding,
347
347
  paddingTop: 0,
348
348
  marginLeft: 54,
349
+ color: Color.offBlack64,
349
350
  [mediaQueries.smOrSmaller]: {
350
351
  padding: intermediateCheckboxPaddingPhone,
351
352
  paddingTop: 0,
@@ -24,6 +24,7 @@ const DEFAULT_HEIGHT = 720;
24
24
  const KA_EMBED = "{host}/embed_video?slug={slug}" + "&internal_video_only=1";
25
25
  const IS_URL = /^https?:\/\//;
26
26
  const IS_KA_SITE = /(khanacademy\.org|localhost)/;
27
+ const IS_VIMEO = /(vimeo\.com)/;
27
28
 
28
29
  type UserInput = null;
29
30
  type Rubric = PerseusVideoWidgetOptions;
@@ -75,6 +76,16 @@ class Video extends React.Component<Props> {
75
76
 
76
77
  if (IS_URL.test(location)) {
77
78
  url = location;
79
+ if (IS_VIMEO.test(url)) {
80
+ // If this is a vimeo video, we need to add the query string
81
+ // parameter "dnt" so that analytics/tracking cookies aren't set.
82
+ // https://help.vimeo.com/hc/en-us/articles/12426260232977-Player-parameters-overview
83
+ if (url.indexOf("?") === -1) {
84
+ url += "?dnt=1";
85
+ } else {
86
+ url += "&dnt=1";
87
+ }
88
+ }
78
89
  } else {
79
90
  url = KA_EMBED.replace("{slug}", location);
80
91
  let embedHostname = "https://www.khanacademy.org";