diff --git a/package.json b/package.json index c3765f65..6f81d9d4 100644 --- a/package.json +++ b/package.json @@ -11,10 +11,10 @@ "types" ], "scripts": { - "prebuild": "rm -rf cjs esm types", + "build:clean": "rimraf cjs esm types", "build:es": "rollup --config --bundleConfigAsCjs", "build:ts": "tsc --declaration --declarationDir types --emitDeclarationOnly", - "build": "yarn run build:es && yarn run build:ts", + "build": "yarn run build:clean && yarn run build:es && yarn run build:ts", "validate": "yarn run lint && yarn run typecheck && yarn run test", "test": "jest", "test:watch": "jest --watch", @@ -103,7 +103,7 @@ "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "eslint-plugin-storybook": "^0.6.15", - "eslint-plugin-testing-library": "^6.2.0", + "eslint-plugin-testing-library": "^6.2.2", "identity-obj-proxy": "^3.0.0", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", @@ -116,6 +116,7 @@ "react-hotkeys": "^2.0.0", "react-is": "^18.2.0", "require-from-string": "^2.0.2", + "rimraf": "^6.0.1", "rollup": "^4.9.6", "rollup-plugin-peer-deps-external": "^2.2.4", "rollup-plugin-styles": "^4.0.0", diff --git a/src/Select/Select.test.tsx b/src/Select/Select.test.tsx new file mode 100644 index 00000000..c968ed76 --- /dev/null +++ b/src/Select/Select.test.tsx @@ -0,0 +1,22 @@ +// TODO remove when we can upgrade to @testing-library/user-event:14, which currently does not work in this test +/* eslint-disable @typescript-eslint/await-thenable */ +import { render, screen } from '@testing-library/react'; +import userEvent from '@testing-library/user-event'; +import React from 'react'; + +import { Select } from './index'; + +describe('); + + await userEvent.click(screen.getByRole('combobox')); + await userEvent.click(screen.getByText(labelA)); + expect(onChange).toHaveBeenCalledWith(valueA, optionA); + }); +}); diff --git a/src/Select/index.tsx b/src/Select/index.tsx index b5cde4a1..94cdf254 100644 --- a/src/Select/index.tsx +++ b/src/Select/index.tsx @@ -64,8 +64,8 @@ function SelectInner< return ( ref={ref} - {...props} dropdownRender={styledDropdownRender} + {...props} > {children} diff --git a/yarn.lock b/yarn.lock index f3f78f37..797c99ba 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2471,7 +2471,7 @@ __metadata: eslint-plugin-react: "npm:^7.33.2" eslint-plugin-react-hooks: "npm:^4.6.0" eslint-plugin-storybook: "npm:^0.6.15" - eslint-plugin-testing-library: "npm:^6.2.0" + eslint-plugin-testing-library: "npm:^6.2.2" identity-obj-proxy: "npm:^3.0.0" jest: "npm:^29.7.0" jest-environment-jsdom: "npm:^29.7.0" @@ -2486,6 +2486,7 @@ __metadata: react-image-size: "npm:^2.0.0" react-is: "npm:^18.2.0" require-from-string: "npm:^2.0.2" + rimraf: "npm:^6.0.1" rollup: "npm:^4.9.6" rollup-plugin-peer-deps-external: "npm:^2.2.4" rollup-plugin-styles: "npm:^4.0.0" @@ -9608,14 +9609,14 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-testing-library@npm:^6.2.0": - version: 6.2.0 - resolution: "eslint-plugin-testing-library@npm:6.2.0" +"eslint-plugin-testing-library@npm:^6.2.2": + version: 6.2.2 + resolution: "eslint-plugin-testing-library@npm:6.2.2" dependencies: "@typescript-eslint/utils": "npm:^5.58.0" peerDependencies: eslint: ^7.5.0 || ^8.0.0 - checksum: 10c0/00ed418670f5842151d8a195315aaaf36f4b19e62d539c67be40edf634914a95cc0f65bdb30a4e7a078aafecd5bae423dd4d1f96b2879e72bb9cb80d09a3916c + checksum: 10c0/f7dd5ba10ea448438f32f240958d183d0e52738c140670657b8adc5b95787fb7bb9e3b88d885be130a91c10a2f8c346f603bddabd6ac93813ca2224bedfd49f0 languageName: node linkType: hard @@ -10645,6 +10646,22 @@ __metadata: languageName: node linkType: hard +"glob@npm:^11.0.0": + version: 11.0.0 + resolution: "glob@npm:11.0.0" + dependencies: + foreground-child: "npm:^3.1.0" + jackspeak: "npm:^4.0.1" + minimatch: "npm:^10.0.0" + minipass: "npm:^7.1.2" + package-json-from-dist: "npm:^1.0.0" + path-scurry: "npm:^2.0.0" + bin: + glob: dist/esm/bin.mjs + checksum: 10c0/419866015d8795258a8ac51de5b9d1a99c72634fc3ead93338e4da388e89773ab21681e494eac0fbc4250b003451ca3110bb4f1c9393d15d14466270094fdb4e + languageName: node + linkType: hard + "glob@npm:^7.0.0, glob@npm:^7.1.3, glob@npm:^7.1.4": version: 7.2.3 resolution: "glob@npm:7.2.3" @@ -11902,6 +11919,19 @@ __metadata: languageName: node linkType: hard +"jackspeak@npm:^4.0.1": + version: 4.0.1 + resolution: "jackspeak@npm:4.0.1" + dependencies: + "@isaacs/cliui": "npm:^8.0.2" + "@pkgjs/parseargs": "npm:^0.11.0" + dependenciesMeta: + "@pkgjs/parseargs": + optional: true + checksum: 10c0/c87997d9c9c5b7366259b1f2a444ef148692f8eedad5307caca939babbb60af2b47d306e5c63bf9d5fefbab2ab48d4da275188c3de525d0e716cc21b784bbccb + languageName: node + linkType: hard + "jake@npm:^10.8.5": version: 10.8.7 resolution: "jake@npm:10.8.7" @@ -13113,6 +13143,13 @@ __metadata: languageName: node linkType: hard +"lru-cache@npm:^11.0.0": + version: 11.0.0 + resolution: "lru-cache@npm:11.0.0" + checksum: 10c0/827ff0e0739f9b0f30f92f5a5fc97c6a2bd3ae32c0452bc58cb7411d6c589d49536073027293f2d1f02d0c2e72b63b162f238df7e9ff6f4cc0345f92afec4d1d + languageName: node + linkType: hard + "lru-cache@npm:^5.1.1": version: 5.1.1 resolution: "lru-cache@npm:5.1.1" @@ -13431,6 +13468,15 @@ __metadata: languageName: node linkType: hard +"minimatch@npm:^10.0.0": + version: 10.0.1 + resolution: "minimatch@npm:10.0.1" + dependencies: + brace-expansion: "npm:^2.0.1" + checksum: 10c0/e6c29a81fe83e1877ad51348306be2e8aeca18c88fdee7a99df44322314279e15799e41d7cb274e4e8bb0b451a3bc622d6182e157dfa1717d6cda75e9cd8cd5d + languageName: node + linkType: hard + "minimatch@npm:^3.0.2, minimatch@npm:^3.0.4, minimatch@npm:^3.0.5, minimatch@npm:^3.1.1, minimatch@npm:^3.1.2": version: 3.1.2 resolution: "minimatch@npm:3.1.2" @@ -13542,10 +13588,10 @@ __metadata: languageName: node linkType: hard -"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3, minipass@npm:^7.0.4": - version: 7.0.4 - resolution: "minipass@npm:7.0.4" - checksum: 10c0/6c7370a6dfd257bf18222da581ba89a5eaedca10e158781232a8b5542a90547540b4b9b7e7f490e4cda43acfbd12e086f0453728ecf8c19e0ef6921bc5958ac5 +"minipass@npm:^5.0.0 || ^6.0.2 || ^7.0.0, minipass@npm:^7.0.2, minipass@npm:^7.0.3, minipass@npm:^7.0.4, minipass@npm:^7.1.2": + version: 7.1.2 + resolution: "minipass@npm:7.1.2" + checksum: 10c0/b0fd20bb9fb56e5fa9a8bfac539e8915ae07430a619e4b86ff71f5fc757ef3924b23b2c4230393af1eda647ed3d75739e4e0acb250a6b1eb277cf7f8fe449557 languageName: node linkType: hard @@ -14430,6 +14476,13 @@ __metadata: languageName: node linkType: hard +"package-json-from-dist@npm:^1.0.0": + version: 1.0.0 + resolution: "package-json-from-dist@npm:1.0.0" + checksum: 10c0/e3ffaf6ac1040ab6082a658230c041ad14e72fabe99076a2081bb1d5d41210f11872403fc09082daf4387fc0baa6577f96c9c0e94c90c394fd57794b66aa4033 + languageName: node + linkType: hard + "pacote@npm:^17.0.0, pacote@npm:^17.0.4": version: 17.0.4 resolution: "pacote@npm:17.0.4" @@ -14655,6 +14708,16 @@ __metadata: languageName: node linkType: hard +"path-scurry@npm:^2.0.0": + version: 2.0.0 + resolution: "path-scurry@npm:2.0.0" + dependencies: + lru-cache: "npm:^11.0.0" + minipass: "npm:^7.1.2" + checksum: 10c0/3da4adedaa8e7ef8d6dc4f35a0ff8f05a9b4d8365f2b28047752b62d4c1ad73eec21e37b1579ef2d075920157856a3b52ae8309c480a6f1a8bbe06ff8e52b33c + languageName: node + linkType: hard + "path-to-regexp@npm:0.1.7": version: 0.1.7 resolution: "path-to-regexp@npm:0.1.7" @@ -17122,6 +17185,18 @@ __metadata: languageName: node linkType: hard +"rimraf@npm:^6.0.1": + version: 6.0.1 + resolution: "rimraf@npm:6.0.1" + dependencies: + glob: "npm:^11.0.0" + package-json-from-dist: "npm:^1.0.0" + bin: + rimraf: dist/esm/bin.mjs + checksum: 10c0/b30b6b072771f0d1e73b4ca5f37bb2944ee09375be9db5f558fcd3310000d29dfcfa93cf7734d75295ad5a7486dc8e40f63089ced1722a664539ffc0c3ece8c6 + languageName: node + linkType: hard + "rimraf@npm:~2.6.2": version: 2.6.3 resolution: "rimraf@npm:2.6.3"