@wordpress/edit-post 6.2.0 → 6.3.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 +2 -0
- package/build/components/sidebar/post-link/index.js +1 -1
- package/build/components/sidebar/post-link/index.js.map +1 -1
- package/build/components/visual-editor/index.js +3 -3
- package/build/components/visual-editor/index.js.map +1 -1
- package/build/editor.js +3 -2
- package/build/editor.js.map +1 -1
- package/build/index.js +3 -0
- package/build/index.js.map +1 -1
- package/build/index.native.js +3 -0
- package/build/index.native.js.map +1 -1
- package/build/store/actions.js +76 -49
- package/build/store/actions.js.map +1 -1
- package/build/store/index.js +7 -10
- package/build/store/index.js.map +1 -1
- package/build/store/reducer.js +0 -80
- package/build/store/reducer.js.map +1 -1
- package/build/store/selectors.js +86 -25
- package/build/store/selectors.js.map +1 -1
- package/build-module/components/sidebar/post-link/index.js +1 -1
- package/build-module/components/sidebar/post-link/index.js.map +1 -1
- package/build-module/components/visual-editor/index.js +3 -3
- package/build-module/components/visual-editor/index.js.map +1 -1
- package/build-module/editor.js +2 -2
- package/build-module/editor.js.map +1 -1
- package/build-module/index.js +3 -0
- package/build-module/index.js.map +1 -1
- package/build-module/index.native.js +3 -0
- package/build-module/index.native.js.map +1 -1
- package/build-module/store/actions.js +71 -45
- package/build-module/store/actions.js.map +1 -1
- package/build-module/store/index.js +7 -10
- package/build-module/store/index.js.map +1 -1
- package/build-module/store/reducer.js +1 -77
- package/build-module/store/reducer.js.map +1 -1
- package/build-module/store/selectors.js +82 -23
- package/build-module/store/selectors.js.map +1 -1
- package/build-style/style-rtl.css +0 -3
- package/build-style/style.css +0 -3
- package/package.json +27 -26
- package/src/components/sidebar/post-link/index.js +1 -1
- package/src/components/visual-editor/index.js +5 -3
- package/src/editor.js +3 -2
- package/src/index.js +3 -0
- package/src/index.native.js +3 -0
- package/src/store/actions.js +47 -15
- package/src/store/index.js +7 -11
- package/src/store/reducer.js +1 -74
- package/src/store/selectors.js +121 -51
- package/src/store/test/actions.js +30 -33
- package/src/store/test/reducer.js +0 -126
- package/src/store/test/selectors.js +0 -155
- package/src/style.scss +0 -4
- package/build/store/defaults.js +0 -15
- package/build/store/defaults.js.map +0 -1
- package/build-module/store/defaults.js +0 -8
- package/build-module/store/defaults.js.map +0 -1
- package/src/store/defaults.js +0 -7
|
@@ -7,48 +7,17 @@ import deepFreeze from 'deep-freeze';
|
|
|
7
7
|
* Internal dependencies
|
|
8
8
|
*/
|
|
9
9
|
import {
|
|
10
|
-
getPreference,
|
|
11
|
-
isEditorPanelOpened,
|
|
12
10
|
isModalActive,
|
|
13
11
|
hasMetaBoxes,
|
|
14
12
|
isSavingMetaBoxes,
|
|
15
13
|
getActiveMetaBoxLocations,
|
|
16
14
|
isMetaBoxLocationActive,
|
|
17
|
-
isEditorPanelEnabled,
|
|
18
15
|
isEditorPanelRemoved,
|
|
19
16
|
isInserterOpened,
|
|
20
17
|
isListViewOpened,
|
|
21
18
|
} from '../selectors';
|
|
22
19
|
|
|
23
20
|
describe( 'selectors', () => {
|
|
24
|
-
describe( 'getPreference', () => {
|
|
25
|
-
it( 'should return the preference value if set', () => {
|
|
26
|
-
const state = {
|
|
27
|
-
preferences: { chicken: true },
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
expect( getPreference( state, 'chicken' ) ).toBe( true );
|
|
31
|
-
} );
|
|
32
|
-
|
|
33
|
-
it( 'should return undefined if the preference is unset', () => {
|
|
34
|
-
const state = {
|
|
35
|
-
preferences: { chicken: true },
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
expect( getPreference( state, 'ribs' ) ).toBeUndefined();
|
|
39
|
-
} );
|
|
40
|
-
|
|
41
|
-
it( 'should return the default value if provided', () => {
|
|
42
|
-
const state = {
|
|
43
|
-
preferences: {},
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
expect( getPreference( state, 'ribs', 'chicken' ) ).toEqual(
|
|
47
|
-
'chicken'
|
|
48
|
-
);
|
|
49
|
-
} );
|
|
50
|
-
} );
|
|
51
|
-
|
|
52
21
|
describe( 'isModalActive', () => {
|
|
53
22
|
it( 'returns true if the provided name matches the value in the preferences activeModal property', () => {
|
|
54
23
|
const state = {
|
|
@@ -95,130 +64,6 @@ describe( 'selectors', () => {
|
|
|
95
64
|
} );
|
|
96
65
|
} );
|
|
97
66
|
|
|
98
|
-
describe( 'isEditorPanelEnabled', () => {
|
|
99
|
-
it( 'should return true by default', () => {
|
|
100
|
-
const state = {
|
|
101
|
-
preferences: {
|
|
102
|
-
panels: {},
|
|
103
|
-
},
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
expect( isEditorPanelEnabled( state, 'post-status' ) ).toBe( true );
|
|
107
|
-
} );
|
|
108
|
-
|
|
109
|
-
it( 'should return true when a panel has been enabled', () => {
|
|
110
|
-
const state = {
|
|
111
|
-
preferences: {
|
|
112
|
-
panels: {
|
|
113
|
-
'post-status': { enabled: true },
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
expect( isEditorPanelEnabled( state, 'post-status' ) ).toBe( true );
|
|
119
|
-
} );
|
|
120
|
-
|
|
121
|
-
it( 'should return false when a panel has been disabled', () => {
|
|
122
|
-
const state = {
|
|
123
|
-
preferences: {
|
|
124
|
-
panels: {
|
|
125
|
-
'post-status': { enabled: false },
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
expect( isEditorPanelEnabled( state, 'post-status' ) ).toBe(
|
|
131
|
-
false
|
|
132
|
-
);
|
|
133
|
-
} );
|
|
134
|
-
|
|
135
|
-
it( 'should return false when a panel is enabled but removed', () => {
|
|
136
|
-
const state = deepFreeze( {
|
|
137
|
-
preferences: {
|
|
138
|
-
panels: {
|
|
139
|
-
'post-status': {
|
|
140
|
-
enabled: true,
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
removedPanels: [ 'post-status' ],
|
|
145
|
-
} );
|
|
146
|
-
|
|
147
|
-
expect( isEditorPanelEnabled( state, 'post-status' ) ).toBe(
|
|
148
|
-
false
|
|
149
|
-
);
|
|
150
|
-
} );
|
|
151
|
-
} );
|
|
152
|
-
|
|
153
|
-
describe( 'isEditorPanelOpened', () => {
|
|
154
|
-
it( 'is tolerant to an undefined panels preference', () => {
|
|
155
|
-
// See: https://github.com/WordPress/gutenberg/issues/14580
|
|
156
|
-
const state = {
|
|
157
|
-
preferences: {},
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
expect( isEditorPanelOpened( state, 'post-status' ) ).toBe( false );
|
|
161
|
-
} );
|
|
162
|
-
|
|
163
|
-
it( 'should return false by default', () => {
|
|
164
|
-
const state = {
|
|
165
|
-
preferences: {
|
|
166
|
-
panels: {},
|
|
167
|
-
},
|
|
168
|
-
};
|
|
169
|
-
|
|
170
|
-
expect( isEditorPanelOpened( state, 'post-status' ) ).toBe( false );
|
|
171
|
-
} );
|
|
172
|
-
|
|
173
|
-
it( 'should return true when a panel has been opened', () => {
|
|
174
|
-
const state = {
|
|
175
|
-
preferences: {
|
|
176
|
-
panels: {
|
|
177
|
-
'post-status': { opened: true },
|
|
178
|
-
},
|
|
179
|
-
},
|
|
180
|
-
};
|
|
181
|
-
|
|
182
|
-
expect( isEditorPanelOpened( state, 'post-status' ) ).toBe( true );
|
|
183
|
-
} );
|
|
184
|
-
|
|
185
|
-
it( 'should return false when a panel has been closed', () => {
|
|
186
|
-
const state = {
|
|
187
|
-
preferences: {
|
|
188
|
-
panels: {
|
|
189
|
-
'post-status': { opened: false },
|
|
190
|
-
},
|
|
191
|
-
},
|
|
192
|
-
};
|
|
193
|
-
|
|
194
|
-
expect( isEditorPanelOpened( state, 'post-status' ) ).toBe( false );
|
|
195
|
-
} );
|
|
196
|
-
|
|
197
|
-
it( 'should return true when a panel has been legacy opened', () => {
|
|
198
|
-
const state = {
|
|
199
|
-
preferences: {
|
|
200
|
-
panels: {
|
|
201
|
-
'post-status': true,
|
|
202
|
-
},
|
|
203
|
-
},
|
|
204
|
-
};
|
|
205
|
-
|
|
206
|
-
expect( isEditorPanelOpened( state, 'post-status' ) ).toBe( true );
|
|
207
|
-
} );
|
|
208
|
-
|
|
209
|
-
it( 'should return false when a panel has been legacy closed', () => {
|
|
210
|
-
const state = {
|
|
211
|
-
preferences: {
|
|
212
|
-
panels: {
|
|
213
|
-
'post-status': false,
|
|
214
|
-
},
|
|
215
|
-
},
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
expect( isEditorPanelOpened( state, 'post-status' ) ).toBe( false );
|
|
219
|
-
} );
|
|
220
|
-
} );
|
|
221
|
-
|
|
222
67
|
describe( 'hasMetaBoxes', () => {
|
|
223
68
|
it( 'should return true if there are active meta boxes', () => {
|
|
224
69
|
const state = {
|
package/src/style.scss
CHANGED
package/build/store/defaults.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.PREFERENCES_DEFAULTS = void 0;
|
|
7
|
-
const PREFERENCES_DEFAULTS = {
|
|
8
|
-
panels: {
|
|
9
|
-
'post-status': {
|
|
10
|
-
opened: true
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
};
|
|
14
|
-
exports.PREFERENCES_DEFAULTS = PREFERENCES_DEFAULTS;
|
|
15
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/store/defaults.js"],"names":["PREFERENCES_DEFAULTS","panels","opened"],"mappings":";;;;;;AAAO,MAAMA,oBAAoB,GAAG;AACnCC,EAAAA,MAAM,EAAE;AACP,mBAAe;AACdC,MAAAA,MAAM,EAAE;AADM;AADR;AAD2B,CAA7B","sourcesContent":["export const PREFERENCES_DEFAULTS = {\n\tpanels: {\n\t\t'post-status': {\n\t\t\topened: true,\n\t\t},\n\t},\n};\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["@wordpress/edit-post/src/store/defaults.js"],"names":["PREFERENCES_DEFAULTS","panels","opened"],"mappings":"AAAA,OAAO,MAAMA,oBAAoB,GAAG;AACnCC,EAAAA,MAAM,EAAE;AACP,mBAAe;AACdC,MAAAA,MAAM,EAAE;AADM;AADR;AAD2B,CAA7B","sourcesContent":["export const PREFERENCES_DEFAULTS = {\n\tpanels: {\n\t\t'post-status': {\n\t\t\topened: true,\n\t\t},\n\t},\n};\n"]}
|