@lumx/react 3.9.2-alpha.2 → 3.9.2-alpha.3
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/index.js +3 -1
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/tooltip/Tooltip.test.tsx +13 -0
- package/src/hooks/usePopper.ts +1 -1
package/package.json
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
"url": "https://github.com/lumapps/design-system/issues"
|
|
7
7
|
},
|
|
8
8
|
"dependencies": {
|
|
9
|
-
"@lumx/core": "^3.9.2-alpha.
|
|
10
|
-
"@lumx/icons": "^3.9.2-alpha.
|
|
9
|
+
"@lumx/core": "^3.9.2-alpha.3",
|
|
10
|
+
"@lumx/icons": "^3.9.2-alpha.3",
|
|
11
11
|
"@popperjs/core": "^2.5.4",
|
|
12
12
|
"body-scroll-lock": "^3.1.5",
|
|
13
13
|
"classnames": "^2.3.2",
|
|
@@ -110,5 +110,5 @@
|
|
|
110
110
|
"build:storybook": "storybook build"
|
|
111
111
|
},
|
|
112
112
|
"sideEffects": false,
|
|
113
|
-
"version": "3.9.2-alpha.
|
|
113
|
+
"version": "3.9.2-alpha.3"
|
|
114
114
|
}
|
|
@@ -48,10 +48,23 @@ describe(`<${Tooltip.displayName}>`, () => {
|
|
|
48
48
|
forceOpen: true,
|
|
49
49
|
});
|
|
50
50
|
expect(tooltip).toBeInTheDocument();
|
|
51
|
+
// Default placement
|
|
52
|
+
expect(tooltip).toHaveAttribute('data-popper-placement', 'bottom');
|
|
51
53
|
expect(anchorWrapper).toBeInTheDocument();
|
|
52
54
|
expect(anchorWrapper).toHaveAttribute('aria-describedby', tooltip?.id);
|
|
53
55
|
});
|
|
54
56
|
|
|
57
|
+
it('should render with custom placement', async () => {
|
|
58
|
+
const { tooltip } = await setup({
|
|
59
|
+
label: 'Tooltip label',
|
|
60
|
+
children: 'Anchor',
|
|
61
|
+
forceOpen: true,
|
|
62
|
+
placement: 'top',
|
|
63
|
+
});
|
|
64
|
+
// Custom placement
|
|
65
|
+
expect(tooltip).toHaveAttribute('data-popper-placement', 'top');
|
|
66
|
+
});
|
|
67
|
+
|
|
55
68
|
it('should wrap unknown children and not add aria-describedby when closed', async () => {
|
|
56
69
|
const { anchorWrapper } = await setup({
|
|
57
70
|
label: 'Tooltip label',
|
package/src/hooks/usePopper.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { IS_BROWSER } from '@lumx/react/constants';
|
|
|
3
3
|
|
|
4
4
|
/** Stub usePopper for use outside of browsers */
|
|
5
5
|
const useStubPopper: typeof usePopperHook = (_a, _p, { placement }: any) =>
|
|
6
|
-
({ attributes: { 'data-popper-placement': placement }, styles: {} }) as any;
|
|
6
|
+
({ attributes: { popper: { 'data-popper-placement': placement } }, styles: {} }) as any;
|
|
7
7
|
|
|
8
8
|
/** Switch hook implementation between environment */
|
|
9
9
|
export const usePopper: typeof usePopperHook = IS_BROWSER ? usePopperHook : useStubPopper;
|