Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Editor: Test that consecutive edits to the same attribute after saving are considered "persistent". #17917

Merged
merged 3 commits into from
Nov 22, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions packages/e2e-tests/specs/editor/various/change-detection.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,4 +352,42 @@ describe( 'Change detection', () => {

expect( isCurrentURL( '/wp-admin/edit.php', `post_type=post&ids=${ postId }` ) ).toBe( true );
} );

it( 'consecutive edits to the same attribute should mark the post as dirty after a save', async () => {
// Open the sidebar block settings.
await openDocumentSettingsSidebar();
await page.click( '.edit-post-sidebar__panel-tab[data-label="Block"]' );

// Insert a paragraph.
await clickBlockAppender();
await page.keyboard.type( 'Hello, World!' );

// Save and wait till the post is clean.
await Promise.all( [
page.waitForSelector( '.editor-post-saved-state.is-saved' ),
pressKeyWithModifier( 'primary', 'S' ),
] );

// Increase the paragraph's font size.
await page.click( '[data-type="core/paragraph"]' );
await page.select( '.components-select-control__input', 'large' );
await page.click( '[data-type="core/paragraph"]' );

// Check that the post is dirty.
await page.waitForSelector( '.editor-post-save-draft' );

// Save and wait till the post is clean.
await Promise.all( [
page.waitForSelector( '.editor-post-saved-state.is-saved' ),
pressKeyWithModifier( 'primary', 'S' ),
] );

// Increase the paragraph's font size again.
await page.click( '[data-type="core/paragraph"]' );
await page.select( '.components-select-control__input', 'larger' );
await page.click( '[data-type="core/paragraph"]' );

// Check that the post is dirty.
await page.waitForSelector( '.editor-post-save-draft' );
} );
} );