@wordpress/interface 4.0.1-next.5df0cd52b7.0 → 4.1.2
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 +6 -0
- package/README.md +66 -1
- package/build/components/index.js +16 -0
- package/build/components/index.js.map +1 -1
- package/build/components/interface-skeleton/index.js +7 -6
- package/build/components/interface-skeleton/index.js.map +1 -1
- package/build/components/more-menu-dropdown/index.js +52 -0
- package/build/components/more-menu-dropdown/index.js.map +1 -0
- package/build/components/more-menu-feature-toggle/index.js +63 -0
- package/build/components/more-menu-feature-toggle/index.js.map +1 -0
- package/build/index.js +2 -2
- package/build/index.js.map +1 -1
- package/build/store/actions.js +57 -0
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +4 -2
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +64 -2
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +20 -0
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/index.js +2 -0
- package/build-module/components/index.js.map +1 -1
- package/build-module/components/interface-skeleton/index.js +7 -7
- package/build-module/components/interface-skeleton/index.js.map +1 -1
- package/build-module/components/more-menu-dropdown/index.js +39 -0
- package/build-module/components/more-menu-dropdown/index.js.map +1 -0
- package/build-module/components/more-menu-feature-toggle/index.js +50 -0
- package/build-module/components/more-menu-feature-toggle/index.js.map +1 -0
- package/build-module/index.js +1 -1
- package/build-module/index.js.map +1 -1
- package/build-module/store/actions.js +51 -0
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +4 -2
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +61 -1
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +18 -0
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +47 -2
- package/build-style/style.css +47 -2
- package/package.json +12 -11
- package/src/components/complementary-area/style.scss +10 -2
- package/src/components/complementary-area-header/style.scss +8 -0
- package/src/components/index.js +2 -0
- package/src/components/interface-skeleton/index.js +5 -5
- package/src/components/more-menu-dropdown/README.md +78 -0
- package/src/components/more-menu-dropdown/index.js +46 -0
- package/src/components/more-menu-dropdown/style.scss +35 -0
- package/src/components/more-menu-feature-toggle/README.md +59 -0
- package/src/components/more-menu-feature-toggle/index.js +53 -0
- package/src/index.js +1 -1
- package/src/store/actions.js +48 -0
- package/src/store/index.js +4 -2
- package/src/store/reducer.js +55 -0
- package/src/store/selectors.js +20 -0
- package/src/store/test/selectors.js +107 -0
- package/src/style.scss +1 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal dependencies
|
|
3
|
+
*/
|
|
4
|
+
import { isFeatureActive } from '../selectors';
|
|
5
|
+
|
|
6
|
+
describe( 'selectors', () => {
|
|
7
|
+
describe( 'isFeatureActive', () => {
|
|
8
|
+
it( 'returns false if the there is no state for the feature', () => {
|
|
9
|
+
const emptyState = {
|
|
10
|
+
preferenceDefaults: {
|
|
11
|
+
features: {},
|
|
12
|
+
},
|
|
13
|
+
preferences: {
|
|
14
|
+
features: {},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
expect(
|
|
19
|
+
isFeatureActive( emptyState, 'test-scope', 'testFeatureName' )
|
|
20
|
+
).toBe( false );
|
|
21
|
+
} );
|
|
22
|
+
|
|
23
|
+
it( 'returns false if the the default for a feature is false and there is no preference state', () => {
|
|
24
|
+
const emptyState = {
|
|
25
|
+
preferenceDefaults: {
|
|
26
|
+
features: {
|
|
27
|
+
'test-scope': {
|
|
28
|
+
testFeatureName: false,
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
preferences: {
|
|
33
|
+
features: {},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
expect(
|
|
38
|
+
isFeatureActive( emptyState, 'test-scope', 'testFeatureName' )
|
|
39
|
+
).toBe( false );
|
|
40
|
+
} );
|
|
41
|
+
|
|
42
|
+
it( 'returns true if the the default for a feature is true and there is no preference state', () => {
|
|
43
|
+
const emptyState = {
|
|
44
|
+
preferenceDefaults: {
|
|
45
|
+
features: {
|
|
46
|
+
'test-scope': {
|
|
47
|
+
testFeatureName: true,
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
preferences: {
|
|
52
|
+
features: {},
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
expect(
|
|
57
|
+
isFeatureActive( emptyState, 'test-scope', 'testFeatureName' )
|
|
58
|
+
).toBe( true );
|
|
59
|
+
} );
|
|
60
|
+
|
|
61
|
+
it( 'returns true if the the default for a feature is false but the preference is true', () => {
|
|
62
|
+
const emptyState = {
|
|
63
|
+
preferenceDefaults: {
|
|
64
|
+
features: {
|
|
65
|
+
'test-scope': {
|
|
66
|
+
testFeatureName: false,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
preferences: {
|
|
71
|
+
features: {
|
|
72
|
+
'test-scope': {
|
|
73
|
+
testFeatureName: true,
|
|
74
|
+
},
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
expect(
|
|
80
|
+
isFeatureActive( emptyState, 'test-scope', 'testFeatureName' )
|
|
81
|
+
).toBe( true );
|
|
82
|
+
} );
|
|
83
|
+
|
|
84
|
+
it( 'returns false if the the default for a feature is true but the preference is false', () => {
|
|
85
|
+
const emptyState = {
|
|
86
|
+
preferenceDefaults: {
|
|
87
|
+
features: {
|
|
88
|
+
'test-scope': {
|
|
89
|
+
testFeatureName: true,
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
preferences: {
|
|
94
|
+
features: {
|
|
95
|
+
'test-scope': {
|
|
96
|
+
testFeatureName: false,
|
|
97
|
+
},
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
expect(
|
|
103
|
+
isFeatureActive( emptyState, 'test-scope', 'testFeatureName' )
|
|
104
|
+
).toBe( false );
|
|
105
|
+
} );
|
|
106
|
+
} );
|
|
107
|
+
} );
|
package/src/style.scss
CHANGED