@lumx/react 3.10.1-alpha.6 → 3.10.1-alpha.7
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 +15 -26
- package/index.js.map +1 -1
- package/package.json +3 -3
- package/src/utils/className.test.js +41 -0
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.10.1-alpha.
|
|
10
|
-
"@lumx/icons": "^3.10.1-alpha.
|
|
9
|
+
"@lumx/core": "^3.10.1-alpha.7",
|
|
10
|
+
"@lumx/icons": "^3.10.1-alpha.7",
|
|
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.10.1-alpha.
|
|
113
|
+
"version": "3.10.1-alpha.7"
|
|
114
114
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { getBasicClass, handleBasicClasses } from './className';
|
|
2
|
+
|
|
3
|
+
describe(getBasicClass, () => {
|
|
4
|
+
it('should generate boolean modifier name with boolean prefix', () => {
|
|
5
|
+
expect(getBasicClass({ prefix: 'prefix', type: 'foo', value: true })).toEqual('prefix--is-foo');
|
|
6
|
+
});
|
|
7
|
+
it('should generate boolean modifier name keeping the existing boolean prefix', () => {
|
|
8
|
+
expect(getBasicClass({ prefix: 'prefix', type: 'isFoo', value: true })).toEqual('prefix--is-foo');
|
|
9
|
+
expect(getBasicClass({ prefix: 'prefix', type: 'hasFoo', value: true })).toEqual('prefix--has-foo');
|
|
10
|
+
});
|
|
11
|
+
it(`should generate string modifier name`, () => {
|
|
12
|
+
expect(getBasicClass({ prefix: 'prefix', type: 'foo', value: 'bar' })).toEqual('prefix--foo-bar');
|
|
13
|
+
});
|
|
14
|
+
it(`should generate number modifier name`, () => {
|
|
15
|
+
expect(getBasicClass({ prefix: 'prefix', type: 'foo', value: 2 })).toEqual('prefix--foo-2');
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
describe(handleBasicClasses, () => {
|
|
20
|
+
it('should use prefix if there is no modifier', () => {
|
|
21
|
+
expect(
|
|
22
|
+
handleBasicClasses({
|
|
23
|
+
prefix: 'prefix',
|
|
24
|
+
}),
|
|
25
|
+
).toEqual('prefix');
|
|
26
|
+
});
|
|
27
|
+
it('should filter falsy modifiers', () => {
|
|
28
|
+
expect(
|
|
29
|
+
handleBasicClasses({
|
|
30
|
+
prefix: 'prefix',
|
|
31
|
+
theme: 'dark',
|
|
32
|
+
isModifier: true,
|
|
33
|
+
isEmpty: '',
|
|
34
|
+
isNull: null,
|
|
35
|
+
isUndefined: undefined,
|
|
36
|
+
isZero: 0,
|
|
37
|
+
isNumberNotZero: 2,
|
|
38
|
+
}),
|
|
39
|
+
).toEqual('prefix prefix--theme-dark prefix--is-modifier prefix--is-number-not-zero-2');
|
|
40
|
+
});
|
|
41
|
+
});
|