@khanacademy/wonder-blocks-form 2.2.1

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.
Files changed (38) hide show
  1. package/LICENSE +21 -0
  2. package/dist/es/index.js +1100 -0
  3. package/dist/index.js +1419 -0
  4. package/dist/index.js.flow +2 -0
  5. package/docs.md +1 -0
  6. package/package.json +35 -0
  7. package/src/__tests__/__snapshots__/custom-snapshot.test.js.snap +1349 -0
  8. package/src/__tests__/__snapshots__/generated-snapshot.test.js.snap +6126 -0
  9. package/src/__tests__/custom-snapshot.test.js +66 -0
  10. package/src/__tests__/generated-snapshot.test.js +654 -0
  11. package/src/components/__tests__/checkbox-group.test.js +84 -0
  12. package/src/components/__tests__/field-heading.test.js +182 -0
  13. package/src/components/__tests__/labeled-text-field.test.js +442 -0
  14. package/src/components/__tests__/radio-group.test.js +84 -0
  15. package/src/components/__tests__/text-field.test.js +424 -0
  16. package/src/components/checkbox-core.js +201 -0
  17. package/src/components/checkbox-group.js +161 -0
  18. package/src/components/checkbox-group.md +200 -0
  19. package/src/components/checkbox.js +94 -0
  20. package/src/components/checkbox.md +134 -0
  21. package/src/components/choice-internal.js +206 -0
  22. package/src/components/choice.js +104 -0
  23. package/src/components/field-heading.js +157 -0
  24. package/src/components/field-heading.md +43 -0
  25. package/src/components/group-styles.js +35 -0
  26. package/src/components/labeled-text-field.js +265 -0
  27. package/src/components/labeled-text-field.md +535 -0
  28. package/src/components/labeled-text-field.stories.js +359 -0
  29. package/src/components/radio-core.js +176 -0
  30. package/src/components/radio-group.js +142 -0
  31. package/src/components/radio-group.md +129 -0
  32. package/src/components/radio.js +93 -0
  33. package/src/components/radio.md +26 -0
  34. package/src/components/text-field.js +326 -0
  35. package/src/components/text-field.md +770 -0
  36. package/src/components/text-field.stories.js +513 -0
  37. package/src/index.js +18 -0
  38. package/src/util/types.js +77 -0
@@ -0,0 +1,66 @@
1
+ // @flow
2
+ import React from "react";
3
+ import renderer from "react-test-renderer";
4
+
5
+ import CheckboxCore from "../components/checkbox-core.js";
6
+ import RadioCore from "../components/radio-core.js";
7
+
8
+ const states = ["default", "error", "disabled"];
9
+ const clickableStates = ["default", "hovered", "pressed"];
10
+ const checkedStates = [false, true];
11
+
12
+ describe("CheckboxCore", () => {
13
+ states.forEach((state) => {
14
+ clickableStates.forEach((clickableState) => {
15
+ checkedStates.forEach((checked) => {
16
+ test(`type:${state} state:${clickableState} checked:${String(
17
+ checked,
18
+ )}`, () => {
19
+ const disabled = state === "disabled";
20
+ const tree = renderer
21
+ .create(
22
+ <CheckboxCore
23
+ checked={checked}
24
+ disabled={disabled}
25
+ error={state === "error"}
26
+ hovered={clickableState === "hovered"}
27
+ pressed={clickableState === "pressed"}
28
+ focused={clickableState === "focused"}
29
+ waiting={false}
30
+ />,
31
+ )
32
+ .toJSON();
33
+ expect(tree).toMatchSnapshot();
34
+ });
35
+ });
36
+ });
37
+ });
38
+ });
39
+
40
+ describe("RadioCore", () => {
41
+ states.forEach((state) => {
42
+ clickableStates.forEach((clickableState) => {
43
+ checkedStates.forEach((checked) => {
44
+ test(`type:${state} state:${clickableState} checked:${String(
45
+ checked,
46
+ )}`, () => {
47
+ const disabled = state === "disabled";
48
+ const tree = renderer
49
+ .create(
50
+ <RadioCore
51
+ checked={checked}
52
+ disabled={disabled}
53
+ error={state === "error"}
54
+ hovered={clickableState === "hovered"}
55
+ pressed={clickableState === "pressed"}
56
+ focused={clickableState === "focused"}
57
+ waiting={false}
58
+ />,
59
+ )
60
+ .toJSON();
61
+ expect(tree).toMatchSnapshot();
62
+ });
63
+ });
64
+ });
65
+ });
66
+ });