Skip to content

Commit

Permalink
Editor: Test that consecutive edits to the same attribute after savin…
Browse files Browse the repository at this point in the history
…g are considered "persistent".
  • Loading branch information
epiqueras committed Nov 21, 2019
1 parent d0e3c26 commit 0219122
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 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,44 @@ 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
await Promise.all( [
page.waitForSelector( '.editor-post-saved-state.is-saved' ),
pressKeyWithModifier( 'primary', 'S' ),
] );

await assertIsDirty( false );

// 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"]' );

await assertIsDirty( true );

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

await assertIsDirty( false );

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

await assertIsDirty( true );
} );
} );

0 comments on commit 0219122

Please sign in to comment.