Last active
September 1, 2021 20:59
-
-
Save ryelle/221233ba154225475300649dc485f3e0 to your computer and use it in GitHub Desktop.
Demo of `test-unit-js` failure for Gutenberg issue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { __ } from '@wordpress/i18n'; | |
import { useBlockProps } from '@wordpress/block-editor'; | |
/** | |
* The edit function describes the structure of your block in the context of the | |
* editor. This represents what the editor will render when the block is used. | |
* | |
* @see https://developer.wordpress.org/block-editor/developers/block-api/block-edit-save/#edit | |
* | |
* @return {WPElement} Element to render. | |
*/ | |
export default function Edit() { | |
return ( | |
<p { ...useBlockProps() }> | |
{ __( 'Test Example – hello from the editor!', 'test-example' ) } | |
</p> | |
); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* External dependencies | |
*/ | |
import renderer from 'react-test-renderer'; | |
/** | |
* Internal dependencies | |
*/ | |
import { Edit } from './edit'; | |
describe( 'Edit', () => { | |
test( 'should render a component.', () => { | |
const component = renderer.create( <Edit /> ); | |
expect( component.toJSON() ).toMatchSnapshot(); | |
} ); | |
} ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "test-example", | |
"version": "0.1.0", | |
"description": "Example block written with ESNext standard and JSX support – build step required.", | |
"author": "The WordPress Contributors", | |
"license": "GPL-2.0-or-later", | |
"main": "build/index.js", | |
"scripts": { | |
"build": "wp-scripts build", | |
"format": "wp-scripts format", | |
"lint:css": "wp-scripts lint-style", | |
"lint:js": "wp-scripts lint-js", | |
"start": "wp-scripts start", | |
"test": "wp-scripts test-unit-js", | |
"packages-update": "wp-scripts packages-update" | |
}, | |
"dependencies": { | |
"@wordpress/block-editor": "^7.0.1", | |
"@wordpress/blocks": "^11.0.1", | |
"@wordpress/i18n": "^4.2.1" | |
}, | |
"devDependencies": { | |
"@wordpress/scripts": "^18.0.0" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment