@khanacademy/wonder-blocks-birthday-picker 1.2.12 → 1.2.13

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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @khanacademy/wonder-blocks-birthday-picker
2
2
 
3
+ ## 1.2.13
4
+
5
+ ### Patch Changes
6
+
7
+ - ee6fc773: Added keyboard support to search items when the dropdown is focused, included "Enter" as a key to trigger actions with the "option" role
8
+ - Updated dependencies [ee6fc773]
9
+ - @khanacademy/wonder-blocks-dropdown@2.8.0
10
+
3
11
  ## 1.2.12
4
12
 
5
13
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@khanacademy/wonder-blocks-birthday-picker",
3
- "version": "1.2.12",
3
+ "version": "1.2.13",
4
4
  "design": "v1",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -13,10 +13,10 @@
13
13
  "test": "echo \"Error: no test specified\" && exit 1"
14
14
  },
15
15
  "dependencies": {
16
- "@babel/runtime": "^7.16.3",
16
+ "@babel/runtime": "^7.18.6",
17
17
  "@khanacademy/wonder-blocks-color": "^1.1.20",
18
18
  "@khanacademy/wonder-blocks-core": "^4.3.2",
19
- "@khanacademy/wonder-blocks-dropdown": "^2.7.6",
19
+ "@khanacademy/wonder-blocks-dropdown": "^2.8.0",
20
20
  "@khanacademy/wonder-blocks-icon": "^1.2.29",
21
21
  "@khanacademy/wonder-blocks-layout": "^1.4.10",
22
22
  "@khanacademy/wonder-blocks-spacing": "^3.0.5",
@@ -495,4 +495,37 @@ describe("BirthdayPicker", () => {
495
495
  ).toBeInTheDocument();
496
496
  });
497
497
  });
498
+
499
+ describe("keyboard", () => {
500
+ beforeEach(() => {
501
+ jest.useFakeTimers();
502
+ });
503
+
504
+ it("should find and select an item using the keyboard", () => {
505
+ // Arrange
506
+ const onChange = jest.fn();
507
+
508
+ render(<BirthdayPicker onChange={onChange} />);
509
+
510
+ // Act
511
+ // Focus on the month selector
512
+ userEvent.tab();
513
+ userEvent.keyboard("Jul");
514
+ jest.advanceTimersByTime(501);
515
+
516
+ // Focus on the day selector
517
+ userEvent.tab();
518
+ userEvent.keyboard("5");
519
+ jest.advanceTimersByTime(501);
520
+
521
+ // Focus on the year selector
522
+ userEvent.tab();
523
+ // It should focus on the first occurrence (2022)
524
+ userEvent.keyboard("20");
525
+ jest.advanceTimersByTime(501);
526
+
527
+ // Assert
528
+ expect(onChange).toHaveBeenCalledWith("2022-07-05");
529
+ });
530
+ });
498
531
  });