Skip to content

Commit

Permalink
Fix file formatting for e2e test plugin (#28266)
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan authored Jan 18, 2021
1 parent 9f7d9e7 commit 24224c5
Showing 1 changed file with 37 additions and 36 deletions.
73 changes: 37 additions & 36 deletions packages/e2e-tests/plugins/inner-blocks-templates/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function () {
( function () {
var registerBlockType = wp.blocks.registerBlockType;
var createBlock = wp.blocks.createBlock;
var el = wp.element.createElement;
Expand Down Expand Up @@ -42,39 +42,39 @@
];

var save = function () {
return el(InnerBlocks.Content);
return el( InnerBlocks.Content );
};

registerBlockType('test/test-inner-blocks-no-locking', {
registerBlockType( 'test/test-inner-blocks-no-locking', {
title: 'Test Inner Blocks no locking',
icon: 'cart',
category: 'text',

edit: function (props) {
return el(InnerBlocks, {
edit: function ( props ) {
return el( InnerBlocks, {
template: TEMPLATE,
});
} );
},

save,
});
} );

registerBlockType('test/test-inner-blocks-locking-all', {
registerBlockType( 'test/test-inner-blocks-locking-all', {
title: 'Test InnerBlocks locking all',
icon: 'cart',
category: 'text',

edit: function (props) {
return el(InnerBlocks, {
edit: function ( props ) {
return el( InnerBlocks, {
template: TEMPLATE,
templateLock: 'all',
});
} );
},

save,
});
} );

registerBlockType('test/test-inner-blocks-update-locked-template', {
registerBlockType( 'test/test-inner-blocks-update-locked-template', {
title: 'Test Inner Blocks update locked template',
icon: 'cart',
category: 'text',
Expand All @@ -86,44 +86,45 @@
},
},

edit: function (props) {
edit: function ( props ) {
const hasUpdatedTemplated = props.attributes.hasUpdatedTemplate;
return el(
'div',
null,
[
el('button', {
onClick() {
props.setAttributes({ hasUpdatedTemplate: true })
}
}, 'Update template'),
el(InnerBlocks, {
el( 'button', {
onClick: function () {
props.setAttributes( { hasUpdatedTemplate: true } )
},
}, 'Update template' ),
el( InnerBlocks, {
template: hasUpdatedTemplated ? TEMPLATE_TWO_PARAGRAPHS : TEMPLATE,
templateLock: 'all',
})
} ),
]
);
},

save,
});
} );

registerBlockType('test/test-inner-blocks-paragraph-placeholder', {

registerBlockType( 'test/test-inner-blocks-paragraph-placeholder', {
title: 'Test Inner Blocks Paragraph Placeholder',
icon: 'cart',
category: 'text',

edit: function (props) {
return el(InnerBlocks, {
edit: function ( props ) {
return el( InnerBlocks, {
template: TEMPLATE_PARAGRAPH_PLACEHOLDER,
templateInsertUpdatesSelection: true,
});
} );
},

save,
});
} );

registerBlockType('test/test-inner-blocks-transformer-target', {
registerBlockType( 'test/test-inner-blocks-transformer-target', {
title: 'Test Inner Blocks transformer target',
icon: 'cart',
category: 'text',
Expand All @@ -138,7 +139,7 @@
'test/test-inner-blocks-locking-all',
'test/test-inner-blocks-paragraph-placeholder',
],
transform: function (attributes, innerBlocks) {
transform: function ( attributes, innerBlocks ) {
return createBlock(
'test/test-inner-blocks-transformer-target',
attributes,
Expand All @@ -150,8 +151,8 @@
to: [
{
type: 'block',
blocks: ['test/i-dont-exist'],
transform: function (attributes, innerBlocks) {
blocks: [ 'test/i-dont-exist' ],
transform: function ( attributes, innerBlocks ) {
return createBlock(
'test/test-inner-blocks-transformer-target',
attributes,
Expand All @@ -162,12 +163,12 @@
],
},

edit: function (props) {
return el(InnerBlocks, {
edit: function ( props ) {
return el( InnerBlocks, {
template: TEMPLATE,
});
} );
},

save,
});
})();
} );
} )();

0 comments on commit 24224c5

Please sign in to comment.