File tree Expand file tree Collapse file tree 3 files changed +12
-7
lines changed
example/src/blocks/post-meta Expand file tree Collapse file tree 3 files changed +12
-7
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ context('Post Meta', () => {
2525 // Author
2626 cy . get ( '.wp-block-example-post-meta .block-editor-block-variation-picker__variation' ) . first ( ) . click ( ) ;
2727
28- cy . get ( '.wp-block-example-post-meta .block-editor-rich-text__editable[metakey="author"] ' ) . focus ( ) . clear ( ) . type ( 'This is a test' ) ;
29- cy . get ( '.wp-block-example-post-meta .block-editor-rich-text__editable[metakey="author"] ' ) . should ( 'have.text' , 'This is a test' ) ;
28+ cy . get ( '.wp-block-example-post-meta .block-editor-rich-text__editable' ) . focus ( ) . clear ( ) . type ( 'This is a test' ) ;
29+ cy . get ( '.wp-block-example-post-meta .block-editor-rich-text__editable' ) . should ( 'have.text' , 'This is a test' ) ;
3030 } )
3131
3232 it ( 'Allows a number to be entered into the post meta field' , ( ) => {
@@ -49,7 +49,7 @@ context('Post Meta', () => {
4949 it ( 'Saves the data into post meta' , ( ) => {
5050 // Author
5151 cy . get ( '.wp-block-example-post-meta .block-editor-block-variation-picker__variation' ) . first ( ) . click ( ) ;
52- cy . get ( '.wp-block-example-post-meta .block-editor-rich-text__editable[metakey="author"] ' ) . focus ( ) . clear ( ) . type ( 'This is a test' ) ;
52+ cy . get ( '.wp-block-example-post-meta .block-editor-rich-text__editable' ) . focus ( ) . clear ( ) . type ( 'This is a test' ) ;
5353
5454 // Reset
5555 cy . get ( '.block-editor-block-breadcrumb__button' ) . contains ( 'Book' ) . click ( ) ;
Original file line number Diff line number Diff line change @@ -82,9 +82,14 @@ Cypress.Commands.add('savePost', () => {
8282} ) ;
8383
8484Cypress . Commands . add ( 'insertBlock' , ( blockName ) => {
85- cy . get ( 'button[aria-label="Add block"]' ) . first ( ) . click ( ) ;
86- cy . focused ( ) . type ( blockName ) ;
87- cy . get ( '.block-editor-inserter__quick-inserter-results button' ) . contains ( blockName ) . click ( ) ;
85+ cy . get ( 'button[aria-label="Toggle block inserter"]' ) . first ( ) . then ( $button => {
86+ if ( $button . attr ( 'aria-pressed' ) !== 'true' ) {
87+ cy . wrap ( $button ) . click ( ) ;
88+ }
89+ } ) ;
90+ cy . get ( '.components-input-control__input' ) . first ( ) . clear ( ) ;
91+ cy . get ( '.components-input-control__input' ) . first ( ) . type ( blockName ) ;
92+ cy . get ( '.block-editor-block-types-list__item' ) . contains ( blockName ) . click ( ) ;
8893} ) ;
8994
9095Cypress . Commands . add ( 'openSettingsSidebar' , ( ) => {
Original file line number Diff line number Diff line change @@ -48,7 +48,7 @@ export const BlockEdit = (props) => {
4848
4949 return (
5050 < div { ...blockProps } >
51- < PostContext postId = { postId } postType = { postType } >
51+ < PostContext postId = { postId } postType = { postType } isEditable = { true } >
5252 < PostMeta metaKey = { metaKey } placeholder = "Meta Value" />
5353 </ PostContext >
5454 </ div >
You can’t perform that action at this time.
0 commit comments