@khanacademy/math-input 10.0.1 → 10.1.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 (41) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/keypad/keypad.d.ts +1 -0
  3. package/dist/components/keypad/mobile-keypad.d.ts +8 -0
  4. package/dist/components/keypad/navigation-button.d.ts +8 -0
  5. package/dist/components/keypad/navigation-pad.d.ts +6 -0
  6. package/dist/components/keypad/shared-keys.d.ts +2 -3
  7. package/dist/components/keypad/utils.d.ts +1 -0
  8. package/dist/components/keypad-legacy/two-page-keypad.d.ts +2 -2
  9. package/dist/components/tabbar/icons.d.ts +2 -2
  10. package/dist/components/tabbar/index.d.ts +0 -1
  11. package/dist/components/tabbar/item.d.ts +2 -2
  12. package/dist/components/tabbar/tabbar.d.ts +4 -4
  13. package/dist/es/index.js +485 -190
  14. package/dist/es/index.js.map +1 -1
  15. package/dist/index.js +489 -190
  16. package/dist/index.js.map +1 -1
  17. package/dist/types.d.ts +1 -0
  18. package/package.json +1 -1
  19. package/src/components/keypad/__tests__/__snapshots__/keypad.test.tsx.snap +1855 -0
  20. package/src/components/keypad/__tests__/keypad.test.tsx +94 -0
  21. package/src/components/keypad/button-assets.tsx +233 -160
  22. package/src/components/keypad/keypad-button.tsx +1 -1
  23. package/src/components/keypad/keypad.stories.tsx +4 -0
  24. package/src/components/keypad/keypad.tsx +87 -58
  25. package/src/components/keypad/mobile-keypad.tsx +59 -4
  26. package/src/components/keypad/navigation-button.tsx +127 -0
  27. package/src/components/keypad/navigation-pad.stories.tsx +25 -0
  28. package/src/components/keypad/navigation-pad.tsx +67 -0
  29. package/src/components/keypad/shared-keys.tsx +2 -3
  30. package/src/components/keypad/utils.ts +4 -0
  31. package/src/components/keypad-legacy/keypad-button.tsx +2 -1
  32. package/src/components/keypad-legacy/two-page-keypad.tsx +2 -2
  33. package/src/components/tabbar/icons.tsx +2 -2
  34. package/src/components/tabbar/index.ts +0 -1
  35. package/src/components/tabbar/item.tsx +2 -2
  36. package/src/components/tabbar/tabbar.stories.tsx +3 -3
  37. package/src/components/tabbar/tabbar.tsx +4 -4
  38. package/src/types.ts +8 -0
  39. package/tsconfig-build.tsbuildinfo +1 -1
  40. package/dist/components/tabbar/types.d.ts +0 -1
  41. package/src/components/tabbar/types.ts +0 -7
@@ -46,6 +46,42 @@ describe("keypad", () => {
46
46
  });
47
47
  });
48
48
 
49
+ it("should snapshot unexpanded", () => {
50
+ // Arrange
51
+ // Act
52
+ const {container} = render(
53
+ <Keypad
54
+ onClickKey={() => {}}
55
+ preAlgebra
56
+ trigonometry
57
+ extraKeys={["PI"]}
58
+ onAnalyticsEvent={async () => {}}
59
+ expandedView={false}
60
+ />,
61
+ );
62
+
63
+ // Assert
64
+ expect(container).toMatchSnapshot("first render");
65
+ });
66
+
67
+ it("should snapshot expanded", () => {
68
+ // Arrange
69
+ // Act
70
+ const {container} = render(
71
+ <Keypad
72
+ onClickKey={() => {}}
73
+ preAlgebra
74
+ trigonometry
75
+ extraKeys={["PI"]}
76
+ onAnalyticsEvent={async () => {}}
77
+ expandedView={true}
78
+ />,
79
+ );
80
+
81
+ // Assert
82
+ expect(container).toMatchSnapshot("first render");
83
+ });
84
+
49
85
  it(`shows optional dismiss button`, () => {
50
86
  // Arrange
51
87
  // Act
@@ -122,4 +158,62 @@ describe("keypad", () => {
122
158
  // Assert
123
159
  expect(onClickKey).toHaveBeenCalledTimes(tabs.length);
124
160
  });
161
+
162
+ it(`does not show navigation pad with expanded view turned off`, () => {
163
+ // Arrange
164
+ // Act
165
+ render(
166
+ <Keypad
167
+ onClickKey={() => {}}
168
+ preAlgebra
169
+ trigonometry
170
+ extraKeys={["PI"]}
171
+ onAnalyticsEvent={async () => {}}
172
+ expandedView={false}
173
+ />,
174
+ );
175
+
176
+ // Assert
177
+ expect(
178
+ screen.queryByRole("button", {name: "Up arrow"}),
179
+ ).not.toBeInTheDocument();
180
+ expect(
181
+ screen.queryByRole("button", {name: "Right arrow"}),
182
+ ).not.toBeInTheDocument();
183
+ expect(
184
+ screen.queryByRole("button", {name: "Down arrow"}),
185
+ ).not.toBeInTheDocument();
186
+ expect(
187
+ screen.queryByRole("button", {name: "Left arrow"}),
188
+ ).not.toBeInTheDocument();
189
+ });
190
+
191
+ it(`shows navigation pad in expanded view`, () => {
192
+ // Arrange
193
+ // Act
194
+ render(
195
+ <Keypad
196
+ onClickKey={() => {}}
197
+ preAlgebra
198
+ trigonometry
199
+ extraKeys={["PI"]}
200
+ onAnalyticsEvent={async () => {}}
201
+ expandedView={true}
202
+ />,
203
+ );
204
+
205
+ // Assert
206
+ expect(
207
+ screen.getByRole("button", {name: "Up arrow"}),
208
+ ).toBeInTheDocument();
209
+ expect(
210
+ screen.getByRole("button", {name: "Right arrow"}),
211
+ ).toBeInTheDocument();
212
+ expect(
213
+ screen.getByRole("button", {name: "Down arrow"}),
214
+ ).toBeInTheDocument();
215
+ expect(
216
+ screen.getByRole("button", {name: "Left arrow"}),
217
+ ).toBeInTheDocument();
218
+ });
125
219
  });