-
Notifications
You must be signed in to change notification settings - Fork 4.7k
Expand file tree
/
Copy pathnew-post-default-content.test.js
More file actions
45 lines (39 loc) · 1.18 KB
/
new-post-default-content.test.js
File metadata and controls
45 lines (39 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/**
* WordPress dependencies
*/
import {
activatePlugin,
createNewPost,
deactivatePlugin,
getEditedPostContent,
openDocumentSettingsSidebar,
} from '@wordpress/e2e-test-utils';
describe( 'new editor filtered state', () => {
beforeAll( async () => {
await activatePlugin( 'gutenberg-test-plugin-default-post-content' );
} );
beforeEach( async () => {
await createNewPost();
} );
afterAll( async () => {
await deactivatePlugin( 'gutenberg-test-plugin-default-post-content' );
} );
it( 'should respect default content', async () => {
// Get the values that should have their defaults changed.
const title = await page.$eval(
'.editor-post-title__input',
( element ) => element.innerHTML
);
const content = await getEditedPostContent();
// open the sidebar, we want to see the excerpt.
await openDocumentSettingsSidebar();
const excerpt = await page.$eval(
'*[aria-label="Editor settings"] *[aria-label="Add excerpt"]',
( element ) => element.innerHTML
);
// Assert they match what the plugin set.
expect( title ).toBe( 'My default title' );
expect( content ).toBe( 'My default content' );
expect( excerpt ).toBe( 'My default excerpt' );
} );
} );