@blaze-cms/react-page-builder 0.146.0-node18-tooltips.28 → 0.146.0-node18-core-styles-tooltips.26
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 +60 -38
- package/lib/components/Menu/Menu.js +4 -1
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/MenuContext.js +2 -1
- package/lib/components/Menu/MenuContext.js.map +1 -1
- package/lib/components/MenuItem/MenuItemRender.js +27 -12
- package/lib/components/MenuItem/MenuItemRender.js.map +1 -1
- package/lib/components/MenuItem/helpers/has-active-child.js +19 -0
- package/lib/components/MenuItem/helpers/has-active-child.js.map +1 -0
- package/lib/components/MenuItem/helpers/index.js +14 -0
- package/lib/components/MenuItem/helpers/index.js.map +1 -1
- package/lib/components/MenuItem/helpers/isUrlPathMatch.js +18 -0
- package/lib/components/MenuItem/helpers/isUrlPathMatch.js.map +1 -0
- package/lib-es/components/Menu/Menu.js +4 -1
- package/lib-es/components/Menu/Menu.js.map +1 -1
- package/lib-es/components/Menu/MenuContext.js +2 -1
- package/lib-es/components/Menu/MenuContext.js.map +1 -1
- package/lib-es/components/MenuItem/MenuItemRender.js +25 -11
- package/lib-es/components/MenuItem/MenuItemRender.js.map +1 -1
- package/lib-es/components/MenuItem/helpers/has-active-child.js +5 -0
- package/lib-es/components/MenuItem/helpers/has-active-child.js.map +1 -0
- package/lib-es/components/MenuItem/helpers/index.js +3 -1
- package/lib-es/components/MenuItem/helpers/index.js.map +1 -1
- package/lib-es/components/MenuItem/helpers/isUrlPathMatch.js +8 -0
- package/lib-es/components/MenuItem/helpers/isUrlPathMatch.js.map +1 -0
- package/package.json +10 -10
- package/src/components/Menu/Menu.js +3 -1
- package/src/components/Menu/MenuContext.js +1 -1
- package/src/components/MenuItem/MenuItemRender.js +40 -12
- package/src/components/MenuItem/helpers/has-active-child.js +10 -0
- package/src/components/MenuItem/helpers/index.js +3 -1
- package/src/components/MenuItem/helpers/isUrlPathMatch.js +10 -0
- package/tests/unit/src/components/MenuItem/MenuItem.test.js +5 -0
- package/tests/unit/src/components/MenuItem/MenuItemRender.test.js +11 -3
- package/tests/unit/src/components/MenuItem/helpers/constants.js +73 -0
- package/tests/unit/src/components/MenuItem/helpers/has-active-child.test.js +35 -0
- package/tests/unit/src/components/MenuItem/helpers/is-url-path-match.test.js +53 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import '@testing-library/jest-dom/extend-expect';
|
|
2
|
+
import { isUrlPathMatch } from '../../../../../../src/components/MenuItem/helpers';
|
|
3
|
+
|
|
4
|
+
describe('isUrlPathMatch', () => {
|
|
5
|
+
it('should return true since path and itemUrl match', () => {
|
|
6
|
+
const path = '/button';
|
|
7
|
+
const itemUrl = 'button';
|
|
8
|
+
const result = isUrlPathMatch(path, itemUrl);
|
|
9
|
+
expect(result).toBeTruthy();
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
it('should match since path and itemUrl do not match', () => {
|
|
13
|
+
const path = '/card';
|
|
14
|
+
const itemUrl = 'button';
|
|
15
|
+
const result = isUrlPathMatch(path, itemUrl);
|
|
16
|
+
expect(result).toBeFalsy();
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should not match since path and itemUrl is a partial match', () => {
|
|
20
|
+
const path = '/button-card';
|
|
21
|
+
const itemUrl = 'button';
|
|
22
|
+
const result = isUrlPathMatch(path, itemUrl);
|
|
23
|
+
expect(result).toBeFalsy();
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
it('should not match since nested path and itemUrl is a partial match', () => {
|
|
27
|
+
const path = '/button/child';
|
|
28
|
+
const itemUrl = 'button';
|
|
29
|
+
const result = isUrlPathMatch(path, itemUrl);
|
|
30
|
+
expect(result).toBeFalsy();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
it('should match with uri-with-fragment', () => {
|
|
34
|
+
const path = '/button#dark';
|
|
35
|
+
const itemUrl = 'button';
|
|
36
|
+
const result = isUrlPathMatch(path, itemUrl);
|
|
37
|
+
expect(result).toBeTruthy();
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
it('should match with uri-with-parameters', () => {
|
|
41
|
+
const path = '/button?paramater=value';
|
|
42
|
+
const itemUrl = 'button';
|
|
43
|
+
const result = isUrlPathMatch(path, itemUrl);
|
|
44
|
+
expect(result).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should not match with empty itemUrl', () => {
|
|
48
|
+
const path = '/';
|
|
49
|
+
const itemUrl = null;
|
|
50
|
+
const result = isUrlPathMatch(path, itemUrl);
|
|
51
|
+
expect(result).toBeFalsy();
|
|
52
|
+
});
|
|
53
|
+
});
|