-
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
52 lines (46 loc) · 1.34 KB
/
new-post-default-content.test.js
File metadata and controls
52 lines (46 loc) · 1.34 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
46
47
48
49
50
51
52
/**
* WordPress dependencies
*/
import {
activatePlugin,
createNewPost,
deactivatePlugin,
findSidebarPanelToggleButtonWithTitle,
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 summaryButton = await findSidebarPanelToggleButtonWithTitle(
'Summary'
);
if ( summaryButton ) {
await summaryButton.click( 'button' );
}
const excerpt = await page.$eval(
'.editor-post-excerpt p',
( 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' );
} );
} );