From 819b4a9383d8e9df33a8ee35f573a0e4b0ac31da Mon Sep 17 00:00:00 2001 From: Ben Briggs Date: Wed, 4 Aug 2021 15:16:14 -0400 Subject: [PATCH] add default block HTML for code-block type --- src/default/defaultBlockHTML.js | 1 + test/spec/convertToHTML-test.js | 11 +++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/default/defaultBlockHTML.js b/src/default/defaultBlockHTML.js index a1707ea..f416717 100644 --- a/src/default/defaultBlockHTML.js +++ b/src/default/defaultBlockHTML.js @@ -12,6 +12,7 @@ export default { 'header-four':

, 'header-five':

, 'header-six':
, + 'code-block':
,
   blockquote: 
, 'unordered-list-item': { element:
  • , diff --git a/test/spec/convertToHTML-test.js b/test/spec/convertToHTML-test.js index b82aa77..f70c334 100644 --- a/test/spec/convertToHTML-test.js +++ b/test/spec/convertToHTML-test.js @@ -110,6 +110,17 @@ describe('convertToHTML', () => { expect(result).toBe('

    test paragraph

    '); }); + it('applies code block styles', () => { + const contentState = buildContentState([ + { + type: 'code-block', + text: 'test code block', + }, + ]); + const result = convertToHTML(contentState); + expect(result).toBe('
    test code block
    '); + }); + it('applies style to multiple blocks', () => { const contentState = buildContentState([ {