Skip to content

Commit

Permalink
Enable the verse block for mobile (#21883)
Browse files Browse the repository at this point in the history
Enable the verse block for production

* Remove the devOnly flag to make the verse block not only available on debug builds, but also in production builds.
* Add unit test for verse block
  • Loading branch information
guarani authored May 18, 2020
1 parent 365bb27 commit c2f6025
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/block-library/src/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ export const registerCoreBlocks = () => {
shortcode,
buttons,
latestPosts,
devOnly( verse ),
verse,
cover,
pullquote,
].forEach( registerBlock );
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/verse/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function VerseEdit( {
</BlockControls>
<RichText
tagName={ Block.pre }
identifier="content"
preserveWhiteSpace
value={ content }
onChange={ ( nextContent ) => {
Expand Down
34 changes: 34 additions & 0 deletions packages/block-library/src/verse/test/edit.native.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* External dependencies
*/
import renderer from 'react-test-renderer';

/**
* Internal dependencies
*/
import Verse from '../edit';

/**
* WordPress dependencies
*/
import { RichText } from '@wordpress/block-editor';

describe( 'Verse Block', () => {
it( 'renders without crashing', () => {
const component = renderer.create(
<Verse attributes={ { content: '' } } />
);
const rendered = component.toJSON();
expect( rendered ).toBeTruthy();
} );

it( 'renders given text without crashing', () => {
const component = renderer.create(
<Verse attributes={ { content: 'sample text' } } />
);
const testInstance = component.root;
const richText = testInstance.findByType( RichText );
expect( richText ).toBeTruthy();
expect( richText.props.value ).toBe( 'sample text' );
} );
} );

0 comments on commit c2f6025

Please sign in to comment.