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

Add block description component #1555

Merged
merged 2 commits into from
Jun 30, 2017
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions blocks/block-description/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Internal dependencies
*/
import './style.scss';

export default function BlockDescription( { children } ) {
return (
<div className="components-block-description">
{ children }
</div>
);
}
12 changes: 12 additions & 0 deletions blocks/block-description/style.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.components-block-description {
&:not(:last-child):after {
content: '';
display: block;
border-bottom: 1px solid $light-gray-500;
margin: 1.5em 0;
}

p {
font-style: italic;
}
}
21 changes: 21 additions & 0 deletions blocks/block-description/test/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/**
* External dependencies
*/
import { expect } from 'chai';
import { shallow } from 'enzyme';

/**
* Internal dependencies
*/
import BlockDescription from '../';

describe( 'BlockDescription', () => {
describe( 'basic rendering', () => {
it( 'should render a <p> element with some content', () => {
const blockDescription = shallow( <BlockDescription><p>Hello World</p></BlockDescription> );
expect( blockDescription.hasClass( 'components-block-description' ) ).to.be.true();
expect( blockDescription.type() ).to.equal( 'div' );
expect( blockDescription.text() ).to.equal( 'Hello World' );
} );
} );
} );
1 change: 1 addition & 0 deletions blocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@ import './library';
export * from './api';
export { default as AlignmentToolbar } from './alignment-toolbar';
export { default as BlockControls } from './block-controls';
export { default as BlockDescription } from './block-description';
export { default as Editable } from './editable';
export { default as MediaUploadButton } from './media-upload-button';