From 3e867c3c03017d4432b81195771857f52eb86157 Mon Sep 17 00:00:00 2001 From: Matthias Dietrich Date: Thu, 17 May 2018 14:40:56 +0200 Subject: [PATCH] Fix Prism import order (fixes #526) --- src/components/__snapshots__/code-pane.test.js.snap | 6 +++--- src/components/code-pane.js | 2 +- src/components/code-pane.test.js | 13 +++++++++++++ src/utils/prism-import.js | 2 -- 4 files changed, 17 insertions(+), 6 deletions(-) diff --git a/src/components/__snapshots__/code-pane.test.js.snap b/src/components/__snapshots__/code-pane.test.js.snap index a7d1994cc..f1f7afc3d 100644 --- a/src/components/__snapshots__/code-pane.test.js.snap +++ b/src/components/__snapshots__/code-pane.test.js.snap @@ -51,7 +51,7 @@ exports[` should render correctly. 1`] = ` syntaxStyles={Object {}} > props.styles); const StyledEditor = styled(({ syntaxStyles: _, prismTheme: __, ...rest }) => )` diff --git a/src/components/code-pane.test.js b/src/components/code-pane.test.js index 693d47d9b..59fb2c4ce 100644 --- a/src/components/code-pane.test.js +++ b/src/components/code-pane.test.js @@ -21,4 +21,17 @@ describe('', () => { const wrapper = mount(, { context }); expect(wrapper).toMatchSnapshot(); }); + + test('should handle languages', () => { + const context = { + styles: { + components: { codePane: {}, syntax: {} }, + prism: { light: 'light;', dark: 'dark;' } + } + }; + const source = `import org.apache.commons.lang3.StringUtils;`; + expect(() => { + mount(, { context }); + }).not.toThrow(); + }); }); diff --git a/src/utils/prism-import.js b/src/utils/prism-import.js index 8b47f456d..d62b1163e 100644 --- a/src/utils/prism-import.js +++ b/src/utils/prism-import.js @@ -1,5 +1,3 @@ -import 'prismjs/components/prism-core'; - // NOTE: This includes a "slim" list of some components of prism, but not all // For more, see: https://github.com/PrismJS/prism/blob/1fd690dd8a652dee375acb78b6034c3fc2db687c/components.js // and: https://github.com/PrismJS/prism/tree/gh-pages/components