@wordpress/components 23.6.0 → 23.7.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.
- package/CHANGELOG.md +32 -4
- package/build/angle-picker-control/angle-circle.js +1 -4
- package/build/angle-picker-control/angle-circle.js.map +1 -1
- package/build/angle-picker-control/index.js +10 -22
- package/build/angle-picker-control/index.js.map +1 -1
- package/build/angle-picker-control/styles/angle-picker-control-styles.js +24 -15
- package/build/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build/animate/index.js +27 -19
- package/build/animate/index.js.map +1 -1
- package/build/animate/types.js.map +1 -0
- package/build/box-control/axial-input-controls.js.map +1 -1
- package/build/color-picker/color-input.js +0 -4
- package/build/color-picker/color-input.js.map +1 -1
- package/build/color-picker/component.js +5 -4
- package/build/color-picker/component.js.map +1 -1
- package/build/color-picker/hex-input.js.map +1 -1
- package/build/color-picker/hsl-input.js.map +1 -1
- package/build/color-picker/input-with-slider.js.map +1 -1
- package/build/color-picker/legacy-adapter.js.map +1 -1
- package/build/color-picker/picker.js.map +1 -1
- package/build/color-picker/rgb-input.js.map +1 -1
- package/build/color-picker/use-deprecated-props.js.map +1 -1
- package/build/custom-gradient-picker/constants.js +1 -1
- package/build/custom-gradient-picker/constants.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/control-points.js +9 -5
- package/build/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/index.js +14 -9
- package/build/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build/custom-gradient-picker/gradient-bar/utils.js +34 -54
- package/build/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build/custom-gradient-picker/index.js +45 -16
- package/build/custom-gradient-picker/index.js.map +1 -1
- package/build/custom-gradient-picker/serializer.js +14 -4
- package/build/custom-gradient-picker/serializer.js.map +1 -1
- package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
- package/build/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
- package/build/custom-gradient-picker/types.js +6 -0
- package/build/custom-gradient-picker/types.js.map +1 -0
- package/build/custom-gradient-picker/utils.js +17 -12
- package/build/custom-gradient-picker/utils.js.map +1 -1
- package/build/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
- package/build/duotone-picker/color-list-picker/index.js.map +1 -0
- package/build/duotone-picker/color-list-picker/types.js +6 -0
- package/build/duotone-picker/color-list-picker/types.js.map +1 -0
- package/build/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build/duotone-picker/duotone-picker.js +39 -2
- package/build/duotone-picker/duotone-picker.js.map +1 -1
- package/build/duotone-picker/duotone-swatch.js.map +1 -1
- package/build/duotone-picker/index.js.map +1 -1
- package/build/duotone-picker/types.js +6 -0
- package/build/duotone-picker/types.js.map +1 -0
- package/build/duotone-picker/utils.js +13 -11
- package/build/duotone-picker/utils.js.map +1 -1
- package/build/form-token-field/index.js +9 -3
- package/build/form-token-field/index.js.map +1 -1
- package/build/gradient-picker/index.js +61 -9
- package/build/gradient-picker/index.js.map +1 -1
- package/build/gradient-picker/types.js +6 -0
- package/build/gradient-picker/types.js.map +1 -0
- package/build/palette-edit/index.js +1 -2
- package/build/palette-edit/index.js.map +1 -1
- package/build/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build/sandbox/index.native.js +80 -67
- package/build/sandbox/index.native.js.map +1 -1
- package/build/tab-panel/index.js +1 -1
- package/build/tab-panel/index.js.map +1 -1
- package/build/tools-panel/tools-panel/hook.js +45 -6
- package/build/tools-panel/tools-panel/hook.js.map +1 -1
- package/build/utils/input/input-control.js +1 -1
- package/build/utils/input/input-control.js.map +1 -1
- package/build-module/angle-picker-control/angle-circle.js +1 -4
- package/build-module/angle-picker-control/angle-circle.js.map +1 -1
- package/build-module/angle-picker-control/index.js +12 -21
- package/build-module/angle-picker-control/index.js.map +1 -1
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js +20 -13
- package/build-module/angle-picker-control/styles/angle-picker-control-styles.js.map +1 -1
- package/build-module/animate/index.js +25 -17
- package/build-module/animate/index.js.map +1 -1
- package/build-module/box-control/axial-input-controls.js.map +1 -1
- package/build-module/color-picker/color-input.js +0 -4
- package/build-module/color-picker/color-input.js.map +1 -1
- package/build-module/color-picker/component.js +3 -3
- package/build-module/color-picker/component.js.map +1 -1
- package/build-module/color-picker/hex-input.js.map +1 -1
- package/build-module/color-picker/hsl-input.js.map +1 -1
- package/build-module/color-picker/input-with-slider.js.map +1 -1
- package/build-module/color-picker/legacy-adapter.js.map +1 -1
- package/build-module/color-picker/picker.js +4 -0
- package/build-module/color-picker/picker.js.map +1 -1
- package/build-module/color-picker/rgb-input.js.map +1 -1
- package/build-module/color-picker/use-deprecated-props.js.map +1 -1
- package/build-module/custom-gradient-picker/constants.js +1 -1
- package/build-module/custom-gradient-picker/constants.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/constants.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js +9 -4
- package/build-module/custom-gradient-picker/gradient-bar/control-points.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/index.js +14 -8
- package/build-module/custom-gradient-picker/gradient-bar/index.js.map +1 -1
- package/build-module/custom-gradient-picker/gradient-bar/utils.js +34 -54
- package/build-module/custom-gradient-picker/gradient-bar/utils.js.map +1 -1
- package/build-module/custom-gradient-picker/index.js +44 -17
- package/build-module/custom-gradient-picker/index.js.map +1 -1
- package/build-module/custom-gradient-picker/serializer.js +14 -4
- package/build-module/custom-gradient-picker/serializer.js.map +1 -1
- package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js +6 -6
- package/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js.map +1 -1
- package/build-module/custom-gradient-picker/types.js +2 -0
- package/build-module/custom-gradient-picker/utils.js +17 -12
- package/build-module/custom-gradient-picker/utils.js.map +1 -1
- package/build-module/{color-list-picker → duotone-picker/color-list-picker}/index.js +5 -5
- package/build-module/duotone-picker/color-list-picker/index.js.map +1 -0
- package/build-module/duotone-picker/color-list-picker/types.js +2 -0
- package/build-module/duotone-picker/color-list-picker/types.js.map +1 -0
- package/build-module/duotone-picker/custom-duotone-bar.js.map +1 -1
- package/build-module/duotone-picker/duotone-picker.js +38 -2
- package/build-module/duotone-picker/duotone-picker.js.map +1 -1
- package/build-module/duotone-picker/duotone-swatch.js.map +1 -1
- package/build-module/duotone-picker/index.js.map +1 -1
- package/build-module/duotone-picker/types.js +2 -0
- package/build-module/duotone-picker/types.js.map +1 -0
- package/build-module/duotone-picker/utils.js +17 -11
- package/build-module/duotone-picker/utils.js.map +1 -1
- package/build-module/form-token-field/index.js +9 -4
- package/build-module/form-token-field/index.js.map +1 -1
- package/build-module/gradient-picker/index.js +61 -10
- package/build-module/gradient-picker/index.js.map +1 -1
- package/build-module/gradient-picker/types.js +2 -0
- package/build-module/gradient-picker/types.js.map +1 -0
- package/build-module/palette-edit/index.js +1 -2
- package/build-module/palette-edit/index.js.map +1 -1
- package/build-module/resizable-box/resize-tooltip/utils.js.map +1 -1
- package/build-module/sandbox/index.native.js +70 -58
- package/build-module/sandbox/index.native.js.map +1 -1
- package/build-module/tab-panel/index.js +2 -2
- package/build-module/tab-panel/index.js.map +1 -1
- package/build-module/tools-panel/tools-panel/hook.js +45 -6
- package/build-module/tools-panel/tools-panel/hook.js.map +1 -1
- package/build-module/utils/input/input-control.js +1 -1
- package/build-module/utils/input/input-control.js.map +1 -1
- package/build-style/style-rtl.css +40 -28
- package/build-style/style.css +42 -28
- package/build-types/angle-picker-control/angle-circle.d.ts.map +1 -1
- package/build-types/angle-picker-control/index.d.ts.map +1 -1
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts +5 -0
- package/build-types/angle-picker-control/styles/angle-picker-control-styles.d.ts.map +1 -1
- package/build-types/animate/index.d.ts +27 -22
- package/build-types/animate/index.d.ts.map +1 -1
- package/build-types/animate/stories/index.d.ts +18 -0
- package/build-types/animate/stories/index.d.ts.map +1 -0
- package/build-types/animate/types.d.ts +30 -0
- package/build-types/animate/types.d.ts.map +1 -0
- package/build-types/color-picker/color-input.d.ts +1 -11
- package/build-types/color-picker/color-input.d.ts.map +1 -1
- package/build-types/color-picker/component.d.ts +8 -9
- package/build-types/color-picker/component.d.ts.map +1 -1
- package/build-types/color-picker/hex-input.d.ts +1 -10
- package/build-types/color-picker/hex-input.d.ts.map +1 -1
- package/build-types/color-picker/hsl-input.d.ts +1 -10
- package/build-types/color-picker/hsl-input.d.ts.map +1 -1
- package/build-types/color-picker/input-with-slider.d.ts +1 -9
- package/build-types/color-picker/input-with-slider.d.ts.map +1 -1
- package/build-types/color-picker/legacy-adapter.d.ts +1 -3
- package/build-types/color-picker/legacy-adapter.d.ts.map +1 -1
- package/build-types/color-picker/picker.d.ts +4 -7
- package/build-types/color-picker/picker.d.ts.map +1 -1
- package/build-types/color-picker/rgb-input.d.ts +1 -10
- package/build-types/color-picker/rgb-input.d.ts.map +1 -1
- package/build-types/color-picker/stories/index.d.ts +19 -0
- package/build-types/color-picker/stories/index.d.ts.map +1 -0
- package/build-types/color-picker/test/index.d.ts +2 -0
- package/build-types/color-picker/test/index.d.ts.map +1 -0
- package/build-types/color-picker/types.d.ts +105 -1
- package/build-types/color-picker/types.d.ts.map +1 -1
- package/build-types/color-picker/use-deprecated-props.d.ts +1 -44
- package/build-types/color-picker/use-deprecated-props.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/constants.d.ts +8 -8
- package/build-types/custom-gradient-picker/constants.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts +7 -7
- package/build-types/custom-gradient-picker/gradient-bar/constants.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts +5 -22
- package/build-types/custom-gradient-picker/gradient-bar/control-points.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/index.d.ts +3 -9
- package/build-types/custom-gradient-picker/gradient-bar/index.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts +2 -0
- package/build-types/custom-gradient-picker/gradient-bar/test/utils.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts +44 -92
- package/build-types/custom-gradient-picker/gradient-bar/utils.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/index.d.ts +27 -6
- package/build-types/custom-gradient-picker/index.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/serializer.d.ts +13 -16
- package/build-types/custom-gradient-picker/serializer.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/stories/index.d.ts +12 -0
- package/build-types/custom-gradient-picker/stories/index.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts +3 -2
- package/build-types/custom-gradient-picker/styles/custom-gradient-picker-styles.d.ts.map +1 -1
- package/build-types/custom-gradient-picker/test/serializer.d.ts +2 -0
- package/build-types/custom-gradient-picker/test/serializer.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/types.d.ts +120 -0
- package/build-types/custom-gradient-picker/types.d.ts.map +1 -0
- package/build-types/custom-gradient-picker/utils.d.ts +12 -4
- package/build-types/custom-gradient-picker/utils.d.ts.map +1 -1
- package/build-types/duotone-picker/color-list-picker/index.d.ts.map +1 -0
- package/build-types/{color-list-picker → duotone-picker/color-list-picker}/types.d.ts +2 -2
- package/build-types/duotone-picker/color-list-picker/types.d.ts.map +1 -0
- package/build-types/duotone-picker/custom-duotone-bar.d.ts +6 -0
- package/build-types/duotone-picker/custom-duotone-bar.d.ts.map +1 -0
- package/build-types/duotone-picker/duotone-picker.d.ts +38 -0
- package/build-types/duotone-picker/duotone-picker.d.ts.map +1 -0
- package/build-types/duotone-picker/duotone-swatch.d.ts +5 -0
- package/build-types/duotone-picker/duotone-swatch.d.ts.map +1 -0
- package/build-types/duotone-picker/index.d.ts +3 -0
- package/build-types/duotone-picker/index.d.ts.map +1 -0
- package/build-types/duotone-picker/stories/duotone-picker.d.ts +12 -0
- package/build-types/duotone-picker/stories/duotone-picker.d.ts.map +1 -0
- package/build-types/duotone-picker/stories/duotone-swatch.d.ts +14 -0
- package/build-types/duotone-picker/stories/duotone-swatch.d.ts.map +1 -0
- package/build-types/duotone-picker/types.d.ts +60 -0
- package/build-types/duotone-picker/types.d.ts.map +1 -0
- package/build-types/duotone-picker/utils.d.ts +52 -0
- package/build-types/duotone-picker/utils.d.ts.map +1 -0
- package/build-types/form-token-field/index.d.ts.map +1 -1
- package/build-types/form-token-field/types.d.ts +6 -0
- package/build-types/form-token-field/types.d.ts.map +1 -1
- package/build-types/gradient-picker/index.d.ts +49 -11
- package/build-types/gradient-picker/index.d.ts.map +1 -1
- package/build-types/gradient-picker/stories/index.d.ts +14 -0
- package/build-types/gradient-picker/stories/index.d.ts.map +1 -0
- package/build-types/gradient-picker/types.d.ts +87 -0
- package/build-types/gradient-picker/types.d.ts.map +1 -0
- package/build-types/palette-edit/index.d.ts.map +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts +1 -1
- package/build-types/resizable-box/resize-tooltip/utils.d.ts.map +1 -1
- package/build-types/tab-panel/index.d.ts.map +1 -1
- package/build-types/tools-panel/tools-panel/hook.d.ts.map +1 -1
- package/build-types/tools-panel/types.d.ts +1 -0
- package/build-types/tools-panel/types.d.ts.map +1 -1
- package/build-types/utils/input/input-control.d.ts.map +1 -1
- package/package.json +19 -19
- package/src/angle-picker-control/angle-circle.tsx +0 -1
- package/src/angle-picker-control/index.tsx +14 -27
- package/src/angle-picker-control/styles/angle-picker-control-styles.tsx +16 -9
- package/src/animate/index.tsx +75 -0
- package/src/animate/stories/index.tsx +102 -0
- package/src/animate/types.ts +32 -0
- package/src/border-box-control/stories/index.tsx +1 -1
- package/src/box-control/axial-input-controls.tsx +1 -1
- package/src/circular-option-picker/style.scss +10 -0
- package/src/color-indicator/style.scss +1 -0
- package/src/color-picker/README.md +2 -2
- package/src/color-picker/color-input.tsx +1 -12
- package/src/color-picker/component.tsx +9 -18
- package/src/color-picker/hex-input.tsx +2 -7
- package/src/color-picker/hsl-input.tsx +2 -7
- package/src/color-picker/input-with-slider.tsx +1 -9
- package/src/color-picker/legacy-adapter.tsx +1 -2
- package/src/color-picker/picker.tsx +5 -6
- package/src/color-picker/rgb-input.tsx +2 -7
- package/src/color-picker/stories/index.tsx +51 -0
- package/src/color-picker/test/{index.js → index.tsx} +36 -18
- package/src/color-picker/types.ts +128 -1
- package/src/color-picker/use-deprecated-props.ts +2 -53
- package/src/combobox-control/stories/index.tsx +1 -1
- package/src/custom-gradient-picker/{constants.js → constants.ts} +2 -2
- package/src/custom-gradient-picker/gradient-bar/{control-points.js → control-points.tsx} +171 -134
- package/src/custom-gradient-picker/gradient-bar/{index.js → index.tsx} +32 -10
- package/src/custom-gradient-picker/gradient-bar/test/{utils.js → utils.ts} +58 -31
- package/src/custom-gradient-picker/gradient-bar/utils.ts +193 -0
- package/src/custom-gradient-picker/{index.js → index.tsx} +63 -22
- package/src/custom-gradient-picker/serializer.ts +82 -0
- package/src/custom-gradient-picker/stories/index.tsx +45 -0
- package/src/custom-gradient-picker/style.scss +25 -4
- package/src/custom-gradient-picker/test/{serializer.js → serializer.ts} +39 -33
- package/src/custom-gradient-picker/types.ts +137 -0
- package/src/custom-gradient-picker/{utils.js → utils.ts} +37 -22
- package/src/custom-select-control/test/index.js +6 -4
- package/src/{color-list-picker → duotone-picker/color-list-picker}/index.tsx +7 -6
- package/src/{color-list-picker → duotone-picker/color-list-picker}/types.ts +2 -2
- package/src/duotone-picker/{custom-duotone-bar.js → custom-duotone-bar.tsx} +7 -1
- package/src/duotone-picker/{duotone-picker.js → duotone-picker.tsx} +39 -2
- package/src/duotone-picker/{duotone-swatch.js → duotone-swatch.tsx} +2 -1
- package/src/duotone-picker/stories/{duotone-picker.js → duotone-picker.tsx} +15 -8
- package/src/duotone-picker/stories/{duotone-swatch.js → duotone-swatch.tsx} +9 -3
- package/src/duotone-picker/types.ts +61 -0
- package/src/duotone-picker/{utils.js → utils.ts} +29 -14
- package/src/flex/flex-item/README.md +1 -1
- package/src/form-token-field/README.md +1 -0
- package/src/form-token-field/index.tsx +10 -3
- package/src/form-token-field/style.scss +0 -7
- package/src/form-token-field/test/index.tsx +1 -0
- package/src/form-token-field/types.ts +6 -0
- package/src/gradient-picker/README.md +16 -23
- package/src/gradient-picker/{index.js → index.tsx} +70 -16
- package/src/gradient-picker/stories/{index.js → index.tsx} +19 -8
- package/src/gradient-picker/types.ts +89 -0
- package/src/item-group/test/index.js +5 -3
- package/src/palette-edit/index.tsx +4 -5
- package/src/resizable-box/resize-tooltip/utils.ts +1 -1
- package/src/sandbox/index.native.js +71 -78
- package/src/slot-fill/test/slot.js +8 -6
- package/src/style.scss +1 -1
- package/src/tab-panel/index.tsx +7 -2
- package/src/tools-panel/test/index.tsx +86 -0
- package/src/tools-panel/tools-panel/hook.ts +44 -4
- package/src/tools-panel/types.ts +1 -0
- package/src/tooltip/test/index.js +251 -301
- package/src/utils/input/input-control.js +1 -0
- package/tsconfig.json +1 -2
- package/tsconfig.tsbuildinfo +1 -1
- package/build/color-list-picker/index.js.map +0 -1
- package/build-module/color-list-picker/index.js.map +0 -1
- package/build-types/color-list-picker/index.d.ts.map +0 -1
- package/build-types/color-list-picker/types.d.ts.map +0 -1
- package/src/animate/index.js +0 -60
- package/src/animate/stories/index.js +0 -53
- package/src/color-picker/stories/index.js +0 -41
- package/src/custom-gradient-picker/gradient-bar/utils.js +0 -189
- package/src/custom-gradient-picker/serializer.js +0 -48
- package/src/custom-gradient-picker/stories/index.js +0 -33
- /package/build/{color-list-picker → animate}/types.js +0 -0
- /package/build-module/{color-list-picker → animate}/types.js +0 -0
- /package/build-module/{color-list-picker → animate}/types.js.map +0 -0
- /package/{build/color-list-picker → build-module/custom-gradient-picker}/types.js.map +0 -0
- /package/build-types/{color-list-picker → duotone-picker/color-list-picker}/index.d.ts +0 -0
- /package/src/custom-gradient-picker/gradient-bar/{constants.js → constants.ts} +0 -0
- /package/src/custom-gradient-picker/styles/{custom-gradient-picker-styles.js → custom-gradient-picker-styles.tsx} +0 -0
- /package/src/{color-list-picker → duotone-picker/color-list-picker}/style.scss +0 -0
- /package/src/duotone-picker/{index.js → index.ts} +0 -0
|
@@ -1,373 +1,323 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { render, screen,
|
|
4
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Internal dependencies
|
|
9
9
|
*/
|
|
10
10
|
import Tooltip from '../';
|
|
11
|
+
import Button from '../../button';
|
|
12
|
+
import { TOOLTIP_DELAY } from '../index.js';
|
|
13
|
+
|
|
11
14
|
/**
|
|
12
15
|
* WordPress dependencies
|
|
13
16
|
*/
|
|
14
|
-
import {
|
|
17
|
+
import { shortcutAriaLabel } from '@wordpress/keycodes';
|
|
15
18
|
|
|
16
|
-
|
|
19
|
+
const props = {
|
|
20
|
+
text: 'tooltip text',
|
|
21
|
+
delay: TOOLTIP_DELAY,
|
|
22
|
+
};
|
|
17
23
|
|
|
18
24
|
function getWrappingPopoverElement( element ) {
|
|
19
25
|
return element.closest( '.components-popover' );
|
|
20
26
|
}
|
|
21
27
|
|
|
22
28
|
describe( 'Tooltip', () => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
render(
|
|
26
|
-
<Tooltip text="Help text">
|
|
27
|
-
<button>Button 1</button>
|
|
28
|
-
<button>Button 2</button>
|
|
29
|
-
</Tooltip>
|
|
30
|
-
);
|
|
29
|
+
it( 'should not render the tooltip if multiple children are passed', async () => {
|
|
30
|
+
const user = userEvent.setup();
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
render(
|
|
33
|
+
<Tooltip { ...props }>
|
|
34
|
+
<Button>Button 1</Button>
|
|
35
|
+
<Button>Button 2</Button>
|
|
36
|
+
</Tooltip>
|
|
37
|
+
);
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
render(
|
|
39
|
-
<Tooltip text="Help text">
|
|
40
|
-
<button>Hover Me!</button>
|
|
41
|
-
</Tooltip>
|
|
42
|
-
);
|
|
39
|
+
await user.tab();
|
|
43
40
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
).toBeVisible();
|
|
47
|
-
expect( screen.queryByText( 'Help text' ) ).not.toBeInTheDocument();
|
|
48
|
-
} );
|
|
41
|
+
expect( screen.queryByText( 'tooltip text' ) ).not.toBeInTheDocument();
|
|
42
|
+
} );
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
|
|
44
|
+
it( 'should not render the tooltip if there is no focus', () => {
|
|
45
|
+
render(
|
|
46
|
+
<Tooltip { ...props }>
|
|
47
|
+
<Button>Hover Me!</Button>
|
|
48
|
+
</Tooltip>
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
expect(
|
|
52
|
+
screen.getByRole( 'button', { name: 'Hover Me!' } )
|
|
53
|
+
).toBeVisible();
|
|
54
|
+
expect( screen.queryByText( 'tooltip text' ) ).not.toBeInTheDocument();
|
|
55
|
+
} );
|
|
52
56
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<button onFocus={ mockOnFocus }>Hover Me!</button>
|
|
56
|
-
</Tooltip>
|
|
57
|
-
);
|
|
58
|
-
|
|
59
|
-
const button = screen.getByRole( 'button', { name: 'Hover Me!' } );
|
|
60
|
-
expect( button ).toBeVisible();
|
|
61
|
-
|
|
62
|
-
// Before focus, the tooltip is not shown.
|
|
63
|
-
expect( screen.queryByText( 'Help text' ) ).not.toBeInTheDocument();
|
|
64
|
-
|
|
65
|
-
act( () => button.focus() );
|
|
66
|
-
|
|
67
|
-
// Tooltip is shown after focusing the anchor.
|
|
68
|
-
const tooltip = screen.getByText( 'Help text' );
|
|
69
|
-
expect( tooltip ).toBeVisible();
|
|
70
|
-
expect( mockOnFocus ).toHaveBeenCalledWith(
|
|
71
|
-
expect.objectContaining( {
|
|
72
|
-
type: 'focus',
|
|
73
|
-
} )
|
|
74
|
-
);
|
|
75
|
-
|
|
76
|
-
// Wait for the tooltip element to be positioned (aligned with the button)
|
|
77
|
-
await waitFor( () =>
|
|
78
|
-
expect(
|
|
79
|
-
getWrappingPopoverElement( tooltip )
|
|
80
|
-
).toBePositionedPopover()
|
|
81
|
-
);
|
|
82
|
-
} );
|
|
83
|
-
|
|
84
|
-
it( 'should render children with additional tooltip when hovered', async () => {
|
|
85
|
-
const user = userEvent.setup( {
|
|
86
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
87
|
-
} );
|
|
88
|
-
|
|
89
|
-
render(
|
|
90
|
-
<Tooltip text="Help text">
|
|
91
|
-
<button>Hover Me!</button>
|
|
92
|
-
</Tooltip>
|
|
93
|
-
);
|
|
57
|
+
it( 'should render the tooltip when focusing the tooltip anchor via tab', async () => {
|
|
58
|
+
const user = userEvent.setup();
|
|
94
59
|
|
|
95
|
-
|
|
96
|
-
|
|
60
|
+
render(
|
|
61
|
+
<Tooltip { ...props }>
|
|
62
|
+
<Button>Hover Me!</Button>
|
|
63
|
+
</Tooltip>
|
|
64
|
+
);
|
|
97
65
|
|
|
98
|
-
|
|
66
|
+
await user.tab();
|
|
99
67
|
|
|
100
|
-
|
|
101
|
-
|
|
68
|
+
expect(
|
|
69
|
+
screen.getByRole( 'button', { name: /Hover me!/i } )
|
|
70
|
+
).toHaveFocus();
|
|
102
71
|
|
|
103
|
-
|
|
72
|
+
await waitFor( () =>
|
|
73
|
+
expect( screen.getByText( 'tooltip text' ) ).toBeVisible()
|
|
74
|
+
);
|
|
104
75
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
expect(
|
|
76
|
+
// Wait for the tooltip element to be positioned (aligned with the button)
|
|
77
|
+
await waitFor( () =>
|
|
78
|
+
expect(
|
|
79
|
+
getWrappingPopoverElement( screen.getByText( 'tooltip text' ) )
|
|
80
|
+
).toBePositionedPopover()
|
|
81
|
+
);
|
|
82
|
+
} );
|
|
108
83
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
expect(
|
|
112
|
-
getWrappingPopoverElement( tooltip )
|
|
113
|
-
).toBePositionedPopover()
|
|
114
|
-
);
|
|
115
|
-
} );
|
|
84
|
+
it( 'should render the tooltip when the tooltip anchor is hovered', async () => {
|
|
85
|
+
const user = userEvent.setup();
|
|
116
86
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
87
|
+
render(
|
|
88
|
+
<Tooltip { ...props }>
|
|
89
|
+
<Button>Hover Me!</Button>
|
|
90
|
+
</Tooltip>
|
|
91
|
+
);
|
|
122
92
|
|
|
123
|
-
|
|
124
|
-
<Tooltip text="Help text">
|
|
125
|
-
<button onFocus={ mockOnFocus }>Hover Me!</button>
|
|
126
|
-
</Tooltip>
|
|
127
|
-
);
|
|
93
|
+
const button = screen.getByRole( 'button', { name: 'Hover Me!' } );
|
|
128
94
|
|
|
129
|
-
|
|
130
|
-
expect( button ).toBeVisible();
|
|
95
|
+
await user.hover( button );
|
|
131
96
|
|
|
132
|
-
|
|
97
|
+
await waitFor( () =>
|
|
98
|
+
expect( screen.getByText( 'tooltip text' ) ).toBeVisible()
|
|
99
|
+
);
|
|
133
100
|
|
|
134
|
-
|
|
135
|
-
|
|
101
|
+
// Wait for the tooltip element to be positioned (aligned with the button)
|
|
102
|
+
await waitFor( () =>
|
|
103
|
+
expect(
|
|
104
|
+
getWrappingPopoverElement( screen.getByText( 'tooltip text' ) )
|
|
105
|
+
).toBePositionedPopover()
|
|
106
|
+
);
|
|
136
107
|
|
|
137
|
-
|
|
108
|
+
await user.unhover( button );
|
|
138
109
|
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
expect( mockOnFocus ).toHaveBeenCalledWith(
|
|
142
|
-
expect.objectContaining( {
|
|
143
|
-
type: 'focus',
|
|
144
|
-
} )
|
|
145
|
-
);
|
|
146
|
-
} );
|
|
110
|
+
expect( screen.queryByText( 'tooltip text' ) ).not.toBeInTheDocument();
|
|
111
|
+
} );
|
|
147
112
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
151
|
-
} );
|
|
113
|
+
it( 'should not show tooltip on focus as result of mouse click', async () => {
|
|
114
|
+
const user = userEvent.setup();
|
|
152
115
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
116
|
+
render(
|
|
117
|
+
<Tooltip { ...props }>
|
|
118
|
+
<Button>Hover Me!</Button>
|
|
119
|
+
</Tooltip>
|
|
120
|
+
);
|
|
156
121
|
|
|
157
|
-
|
|
158
|
-
<Tooltip text="Help text" delay={ TEST_DELAY }>
|
|
159
|
-
<button
|
|
160
|
-
onMouseEnter={ mockOnMouseEnter }
|
|
161
|
-
onFocus={ mockOnFocus }
|
|
162
|
-
>
|
|
163
|
-
<span>Hover Me!</span>
|
|
164
|
-
</button>
|
|
165
|
-
</Tooltip>
|
|
166
|
-
);
|
|
122
|
+
await user.click( screen.getByRole( 'button', { text: 'Hover Me!' } ) );
|
|
167
123
|
|
|
168
|
-
|
|
169
|
-
|
|
124
|
+
expect( screen.queryByText( 'tooltip text' ) ).not.toBeInTheDocument();
|
|
125
|
+
} );
|
|
170
126
|
|
|
171
|
-
|
|
127
|
+
it( 'should respect custom delay prop when showing tooltip', async () => {
|
|
128
|
+
const user = userEvent.setup( { delay: TOOLTIP_DELAY } );
|
|
129
|
+
const CUSTOM_DELAY = TOOLTIP_DELAY + 25;
|
|
172
130
|
|
|
173
|
-
|
|
174
|
-
|
|
131
|
+
render(
|
|
132
|
+
<Tooltip { ...props } delay={ CUSTOM_DELAY }>
|
|
133
|
+
<Button>Hover Me!</Button>
|
|
134
|
+
</Tooltip>
|
|
135
|
+
);
|
|
175
136
|
|
|
176
|
-
|
|
177
|
-
act( () => jest.advanceTimersByTime( TOOLTIP_DELAY ) );
|
|
137
|
+
const button = screen.getByRole( 'button', { name: 'Hover Me!' } );
|
|
178
138
|
|
|
179
|
-
|
|
180
|
-
expect( screen.queryByText( 'Help text' ) ).not.toBeInTheDocument();
|
|
139
|
+
await user.hover( button );
|
|
181
140
|
|
|
182
|
-
|
|
183
|
-
act( () => jest.advanceTimersByTime( TEST_DELAY - TOOLTIP_DELAY ) );
|
|
141
|
+
expect( screen.queryByText( 'tooltip text' ) ).not.toBeInTheDocument();
|
|
184
142
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
143
|
+
await waitFor( () =>
|
|
144
|
+
expect( screen.getByText( 'tooltip text' ) ).toBeVisible()
|
|
145
|
+
);
|
|
188
146
|
|
|
189
|
-
|
|
147
|
+
// Wait for the tooltip element to be positioned (aligned with the button)
|
|
148
|
+
await waitFor( () =>
|
|
149
|
+
expect(
|
|
150
|
+
getWrappingPopoverElement( screen.getByText( 'tooltip text' ) )
|
|
151
|
+
).toBePositionedPopover()
|
|
152
|
+
);
|
|
153
|
+
} );
|
|
190
154
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
expect(
|
|
194
|
-
getWrappingPopoverElement( tooltip )
|
|
195
|
-
).toBePositionedPopover()
|
|
196
|
-
);
|
|
197
|
-
} );
|
|
155
|
+
it( 'should show tooltip when an element is disabled', async () => {
|
|
156
|
+
const user = userEvent.setup();
|
|
198
157
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
158
|
+
render(
|
|
159
|
+
<Tooltip { ...props }>
|
|
160
|
+
<Button disabled>Click me</Button>
|
|
161
|
+
</Tooltip>
|
|
162
|
+
);
|
|
203
163
|
|
|
204
|
-
|
|
205
|
-
<Tooltip text="Show helpful text here">
|
|
206
|
-
<button disabled>Click me</button>
|
|
207
|
-
</Tooltip>
|
|
208
|
-
);
|
|
164
|
+
const button = screen.getByRole( 'button', { name: /Click me/i } );
|
|
209
165
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
expect( button ).toBeDisabled();
|
|
166
|
+
expect( button ).toBeVisible();
|
|
167
|
+
expect( button ).toBeDisabled();
|
|
213
168
|
|
|
214
|
-
|
|
215
|
-
// but couldn't find a better way.
|
|
216
|
-
const buttonRect = button.getBoundingClientRect();
|
|
217
|
-
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
|
|
218
|
-
const eventCatcher = container.querySelector( '.event-catcher' );
|
|
219
|
-
const eventCatcherRect = eventCatcher.getBoundingClientRect();
|
|
220
|
-
expect( buttonRect ).toEqual( eventCatcherRect );
|
|
169
|
+
await user.hover( button );
|
|
221
170
|
|
|
222
|
-
|
|
171
|
+
await waitFor( () =>
|
|
172
|
+
expect( screen.getByText( 'tooltip text' ) ).toBeVisible()
|
|
173
|
+
);
|
|
223
174
|
|
|
224
|
-
|
|
175
|
+
// Wait for the tooltip element to be positioned (aligned with the button)
|
|
176
|
+
await waitFor( () =>
|
|
225
177
|
expect(
|
|
226
|
-
screen.
|
|
227
|
-
).
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
} )
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
178
|
+
getWrappingPopoverElement( screen.getByText( 'tooltip text' ) )
|
|
179
|
+
).toBePositionedPopover()
|
|
180
|
+
);
|
|
181
|
+
} );
|
|
182
|
+
|
|
183
|
+
it( 'should not emit events back to children when they are disabled', async () => {
|
|
184
|
+
const user = userEvent.setup();
|
|
185
|
+
const onClickMock = jest.fn();
|
|
186
|
+
|
|
187
|
+
const { container } = render(
|
|
188
|
+
<Tooltip { ...props }>
|
|
189
|
+
<Button disabled onClick={ onClickMock }>
|
|
190
|
+
Click me
|
|
191
|
+
</Button>
|
|
192
|
+
</Tooltip>
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
// Note: this is testing for implementation details,
|
|
196
|
+
// but couldn't find a better way.
|
|
197
|
+
const buttonRect = screen
|
|
198
|
+
.getByRole( 'button', { name: 'Click me' } )
|
|
199
|
+
.getBoundingClientRect();
|
|
200
|
+
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
|
|
201
|
+
const eventCatcher = container.querySelector( '.event-catcher' );
|
|
202
|
+
await user.click( eventCatcher );
|
|
203
|
+
expect( onClickMock ).not.toHaveBeenCalled();
|
|
204
|
+
|
|
205
|
+
const eventCatcherRect = eventCatcher.getBoundingClientRect();
|
|
206
|
+
expect( buttonRect ).toEqual( eventCatcherRect );
|
|
207
|
+
} );
|
|
208
|
+
|
|
209
|
+
it( 'should not show tooltip if the mouse leaves the tooltip anchor before set delay', async () => {
|
|
210
|
+
const user = userEvent.setup();
|
|
211
|
+
const onMouseEnterMock = jest.fn();
|
|
212
|
+
const onMouseLeaveMock = jest.fn();
|
|
213
|
+
const MOUSE_LEAVE_DELAY = TOOLTIP_DELAY - 200;
|
|
214
|
+
|
|
215
|
+
render(
|
|
216
|
+
<>
|
|
217
|
+
<Tooltip { ...props }>
|
|
218
|
+
<Button
|
|
219
|
+
onMouseEnter={ onMouseEnterMock }
|
|
220
|
+
onMouseLeave={ onMouseLeaveMock }
|
|
221
|
+
>
|
|
222
|
+
Hover Me!
|
|
223
|
+
</Button>
|
|
254
224
|
</Tooltip>
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
} );
|
|
262
|
-
|
|
263
|
-
it( 'should not show tooltip if the mouse leaves the anchor before the tooltip has shown', async () => {
|
|
264
|
-
const user = userEvent.setup( {
|
|
265
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
266
|
-
} );
|
|
267
|
-
|
|
268
|
-
const MOUSE_LEAVE_DELAY = TOOLTIP_DELAY - 200;
|
|
269
|
-
const onMouseEnterMock = jest.fn();
|
|
270
|
-
const onMouseLeaveMock = jest.fn();
|
|
271
|
-
|
|
272
|
-
render(
|
|
273
|
-
<>
|
|
274
|
-
<Tooltip text="Help text">
|
|
275
|
-
<button
|
|
276
|
-
onMouseEnter={ onMouseEnterMock }
|
|
277
|
-
onMouseLeave={ onMouseLeaveMock }
|
|
278
|
-
>
|
|
279
|
-
Hover Me!
|
|
280
|
-
</button>
|
|
281
|
-
</Tooltip>
|
|
282
|
-
<button>Hover me instead!</button>
|
|
283
|
-
</>
|
|
284
|
-
);
|
|
285
|
-
|
|
286
|
-
const externalButton = screen.getByRole( 'button', {
|
|
287
|
-
name: 'Hover me instead!',
|
|
288
|
-
} );
|
|
289
|
-
const tooltipButton = screen.getByRole( 'button', {
|
|
225
|
+
<Button>Hover me instead!</Button>
|
|
226
|
+
</>
|
|
227
|
+
);
|
|
228
|
+
|
|
229
|
+
await user.hover(
|
|
230
|
+
screen.getByRole( 'button', {
|
|
290
231
|
name: 'Hover Me!',
|
|
291
|
-
} )
|
|
232
|
+
} )
|
|
233
|
+
);
|
|
292
234
|
|
|
293
|
-
|
|
235
|
+
// Tooltip hasn't appeared yet
|
|
236
|
+
expect( screen.queryByText( 'tooltip text' ) ).not.toBeInTheDocument();
|
|
237
|
+
expect( onMouseEnterMock ).toHaveBeenCalledTimes( 1 );
|
|
294
238
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
239
|
+
// Advance time by MOUSE_LEAVE_DELAY time
|
|
240
|
+
await new Promise( ( resolve ) =>
|
|
241
|
+
setTimeout( resolve, MOUSE_LEAVE_DELAY )
|
|
242
|
+
);
|
|
298
243
|
|
|
299
|
-
|
|
300
|
-
act( () => jest.advanceTimersByTime( MOUSE_LEAVE_DELAY ) );
|
|
244
|
+
expect( screen.queryByText( 'tooltip text' ) ).not.toBeInTheDocument();
|
|
301
245
|
|
|
302
|
-
|
|
303
|
-
|
|
246
|
+
// Hover the other button, meaning that the mouse will leave the tooltip anchor
|
|
247
|
+
await user.hover(
|
|
248
|
+
screen.getByRole( 'button', {
|
|
249
|
+
name: 'Hover me instead!',
|
|
250
|
+
} )
|
|
251
|
+
);
|
|
304
252
|
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
253
|
+
// Tooltip still hasn't appeared yet
|
|
254
|
+
expect( screen.queryByText( 'tooltip text' ) ).not.toBeInTheDocument();
|
|
255
|
+
expect( onMouseEnterMock ).toHaveBeenCalledTimes( 1 );
|
|
256
|
+
expect( onMouseLeaveMock ).toHaveBeenCalledTimes( 1 );
|
|
309
257
|
|
|
310
|
-
|
|
311
|
-
|
|
258
|
+
// Advance time again, so that we reach the full TOOLTIP_DELAY time
|
|
259
|
+
await new Promise( ( resolve ) =>
|
|
260
|
+
setTimeout( resolve, TOOLTIP_DELAY )
|
|
261
|
+
);
|
|
312
262
|
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
263
|
+
// Tooltip won't show, since the mouse has left the tooltip anchor
|
|
264
|
+
expect( screen.queryByText( 'tooltip text' ) ).not.toBeInTheDocument();
|
|
265
|
+
} );
|
|
316
266
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
320
|
-
} );
|
|
267
|
+
it( 'should render the shortcut display text when a string is passed as the shortcut', async () => {
|
|
268
|
+
const user = userEvent.setup();
|
|
321
269
|
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
const button = screen.getByRole( 'button', { name: 'Hover Me!' } );
|
|
329
|
-
await user.hover( button );
|
|
330
|
-
|
|
331
|
-
const tooltip = await screen.findByText( 'shortcut text' );
|
|
332
|
-
expect( tooltip ).toBeVisible();
|
|
333
|
-
|
|
334
|
-
// Wait for the tooltip element to be positioned (aligned with the button)
|
|
335
|
-
await waitFor( () =>
|
|
336
|
-
expect(
|
|
337
|
-
getWrappingPopoverElement( tooltip )
|
|
338
|
-
).toBePositionedPopover()
|
|
339
|
-
);
|
|
340
|
-
} );
|
|
341
|
-
|
|
342
|
-
it( 'should render the shortcut display text and aria-label when an object is passed as the shortcut with the correct properties', async () => {
|
|
343
|
-
const user = userEvent.setup( {
|
|
344
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
345
|
-
} );
|
|
346
|
-
|
|
347
|
-
render(
|
|
348
|
-
<Tooltip
|
|
349
|
-
text="Help text"
|
|
350
|
-
shortcut={ {
|
|
351
|
-
display: 'shortcut text',
|
|
352
|
-
ariaLabel: 'shortcut label',
|
|
353
|
-
} }
|
|
354
|
-
>
|
|
355
|
-
<button>Hover Me!</button>
|
|
356
|
-
</Tooltip>
|
|
357
|
-
);
|
|
270
|
+
render(
|
|
271
|
+
<Tooltip { ...props } shortcut="shortcut text">
|
|
272
|
+
<Button>Hover Me!</Button>
|
|
273
|
+
</Tooltip>
|
|
274
|
+
);
|
|
358
275
|
|
|
359
|
-
|
|
360
|
-
await user.hover( button );
|
|
276
|
+
await user.hover( screen.getByRole( 'button', { name: 'Hover Me!' } ) );
|
|
361
277
|
|
|
362
|
-
|
|
363
|
-
expect(
|
|
278
|
+
await waitFor( () =>
|
|
279
|
+
expect( screen.getByText( 'shortcut text' ) ).toBeVisible()
|
|
280
|
+
);
|
|
364
281
|
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
282
|
+
// Wait for the tooltip element to be positioned (aligned with the button)
|
|
283
|
+
await waitFor( () =>
|
|
284
|
+
expect(
|
|
285
|
+
getWrappingPopoverElement( screen.getByText( 'shortcut text' ) )
|
|
286
|
+
).toBePositionedPopover()
|
|
287
|
+
);
|
|
288
|
+
} );
|
|
289
|
+
|
|
290
|
+
it( 'should render the shortcut display text and aria-label when an object is passed as the shortcut with the correct properties', async () => {
|
|
291
|
+
const user = userEvent.setup();
|
|
292
|
+
|
|
293
|
+
render(
|
|
294
|
+
<Tooltip
|
|
295
|
+
{ ...props }
|
|
296
|
+
shortcut={ {
|
|
297
|
+
display: '⇧⌘,',
|
|
298
|
+
ariaLabel: shortcutAriaLabel.primaryShift( ',' ),
|
|
299
|
+
} }
|
|
300
|
+
>
|
|
301
|
+
<Button>Hover Me!</Button>
|
|
302
|
+
</Tooltip>
|
|
303
|
+
);
|
|
304
|
+
|
|
305
|
+
await user.hover( screen.getByRole( 'button', { name: 'Hover Me!' } ) );
|
|
306
|
+
|
|
307
|
+
await waitFor( () =>
|
|
308
|
+
expect( screen.getByText( '⇧⌘,' ) ).toBeVisible()
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
expect( screen.getByText( '⇧⌘,' ) ).toHaveAttribute(
|
|
312
|
+
'aria-label',
|
|
313
|
+
'Control + Shift + Comma'
|
|
314
|
+
);
|
|
315
|
+
|
|
316
|
+
// Wait for the tooltip element to be positioned (aligned with the button)
|
|
317
|
+
await waitFor( () =>
|
|
318
|
+
expect(
|
|
319
|
+
getWrappingPopoverElement( screen.getByText( '⇧⌘,' ) )
|
|
320
|
+
).toBePositionedPopover()
|
|
321
|
+
);
|
|
372
322
|
} );
|
|
373
323
|
} );
|
package/tsconfig.json
CHANGED
|
@@ -44,7 +44,6 @@
|
|
|
44
44
|
"src/**/react-native-*",
|
|
45
45
|
"src/**/stories/**/*.js", // only exclude js files, tsx files should be checked
|
|
46
46
|
"src/**/test/**/*.js", // only exclude js files, ts{x} files should be checked
|
|
47
|
-
"src/index.js"
|
|
48
|
-
"src/duotone-picker"
|
|
47
|
+
"src/index.js"
|
|
49
48
|
]
|
|
50
49
|
}
|