From 261ffb7f20ccad12ee4ef4262572d3eba12b9515 Mon Sep 17 00:00:00 2001 From: Paul Hawxby Date: Fri, 11 May 2018 18:42:46 +0100 Subject: [PATCH] fix: added test case for viewBox --- test/dom-to-react.js | 10 ++++++++++ test/helpers/mocks.json | 3 ++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/test/dom-to-react.js b/test/dom-to-react.js index c3450fef..55497805 100644 --- a/test/dom-to-react.js +++ b/test/dom-to-react.js @@ -128,4 +128,14 @@ describe('dom-to-react parser', function() { ); }); + + it('handles svg\'s with a viewBox', function() { + var html = mocks.html.svg; + var reactElement = domToReact(htmlToDOM(html)); + + assert.deepEqual( + reactElement, + React.createElement('svg', { viewBox: '0 0 512 512', id: 'foo' }, 'Inner') + ); + }); }); diff --git a/test/helpers/mocks.json b/test/helpers/mocks.json index d18ec1d6..3a977d87 100644 --- a/test/helpers/mocks.json +++ b/test/helpers/mocks.json @@ -11,7 +11,8 @@ "img": "\"Image\"/", "void": "

", "comment": "", - "doctype": "" + "doctype": "", + "svg": "Inner" }, "svg": { "complex": "AYour browser does not support inline SVG."