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

Restore Post Formats UI by fixing editorSettings variable reference #6879

Merged
merged 1 commit into from May 22, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions editor/components/post-format/check.js
Expand Up @@ -14,8 +14,11 @@ function PostFormatCheck( { disablePostFormats, ...props } ) {
}

export default withSelect(
( select ) => ( {
disablePostFormats: select( 'core/editor' ).getEditorSettings(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😅

} )
( select ) => {
const editorSettings = select( 'core/editor' ).getEditorSettings();
return {
disablePostFormats: editorSettings.disablePostFormats,
};
}
)( PostFormatCheck );

5 changes: 5 additions & 0 deletions test/e2e/specs/hello.test.js
Expand Up @@ -12,10 +12,15 @@ describe( 'hello', () => {

it( 'Should show the New Post Page in Gutenberg', async () => {
expect( page.url() ).toEqual( expect.stringContaining( 'post-new.php' ) );
// Should display the title.
const title = await page.$( '[placeholder="Add title"]' );
expect( title ).not.toBeNull();
// Should display the Preview button.
const postPreviewButton = await page.$( '.editor-post-preview.components-button' );
expect( postPreviewButton ).not.toBeNull();
// Should display the Post Formats UI.
const postFormatsUi = await page.$( '.editor-post-format' );
expect( postFormatsUi ).not.toBeNull();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the e2e test, I wonder if this test should be separate for clarity :)

Actually, even testing the preview button seems odd in this "hello world" test but I guess it's fine for now.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point I'd like to flesh out the e2e tests and make sure we have tests for every element.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally don't think we should have e2e tests for everything :). e2e have maintenability and debugging costs that sometimes I prefer more granular unit tests while keeping the e2e tests for the main regressions we want to prevent from.

} );

it( 'Should have no history', async () => {
Expand Down