Skip to content

Commit

Permalink
add default block HTML for code-block type
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Briggs committed Aug 4, 2021
1 parent 5abc02f commit 819b4a9
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/default/defaultBlockHTML.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default {
'header-four': <h4 />,
'header-five': <h5 />,
'header-six': <h6 />,
'code-block': <pre />,
blockquote: <blockquote />,
'unordered-list-item': {
element: <li />,
Expand Down
11 changes: 11 additions & 0 deletions test/spec/convertToHTML-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,17 @@ describe('convertToHTML', () => {
expect(result).toBe('<p>test paragraph</p>');
});

it('applies code block styles', () => {
const contentState = buildContentState([
{
type: 'code-block',
text: 'test code block',
},
]);
const result = convertToHTML(contentState);
expect(result).toBe('<pre>test code block</pre>');
});

it('applies style to multiple blocks', () => {
const contentState = buildContentState([
{
Expand Down

0 comments on commit 819b4a9

Please sign in to comment.