Updating SVG render to use react-testing-library

This commit is contained in:
Jeff Avallone 2019-03-24 14:38:44 -04:00
parent f11c41b05e
commit 84fd88f1d0
2 changed files with 58 additions and 36 deletions

View File

@ -24,38 +24,60 @@ Object {
`; `;
exports[`SVG rendering 1`] = ` exports[`SVG rendering 1`] = `
<svg <DocumentFragment>
height={20} <svg
style={ height="20"
Object { style="background-color: rgb(255, 255, 255);"
"backgroundColor": "#fff", viewBox="0 0 100 20"
} width="100"
} xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 100 20" xmlns:cc="http://creativecommons.org/ns#"
width={100} xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns="http://www.w3.org/2000/svg"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
>
<metadata
dangerouslySetInnerHTML={
Object {
"__html": "<rdf:rdf>
<cc:license rdf:about=\\"http://creativecommons.org/licenses/by/3.0/\\">
<cc:permits rdf:resource=\\"http://creativecommons.org/ns#Reproduction\\"></cc:permits>
<cc:permits rdf:resource=\\"http://creativecommons.org/ns#Distribution\\"></cc:permits>
<cc:requires rdf:resource=\\"http://creativecommons.org/ns#Notice\\"></cc:requires>
<cc:requires rdf:resource=\\"http://creativecommons.org/ns#Attribution\\"></cc:requires>
<cc:permits rdf:resource=\\"http://creativecommons.org/ns#DerivativeWorks\\"></cc:permits>
</cc:license>
</rdf:rdf>",
}
}
/>
<g
transform="translate(10 10)"
> >
Content <metadata>
</g> <rdf:rdf>
</svg>
<cc:license
rdf:about="http://creativecommons.org/licenses/by/3.0/"
>
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction"
/>
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution"
/>
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice"
/>
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution"
/>
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks"
/>
</cc:license>
</rdf:rdf>
</metadata>
<g
transform="translate(10 10)"
>
Content
</g>
</svg>
</DocumentFragment>
`; `;

View File

@ -1,14 +1,14 @@
import React from 'react'; import React from 'react';
import { shallow } from 'enzyme'; import { render } from 'react-testing-library';
import SVG, { layout } from 'rendering/SVG'; import SVG, { layout } from 'rendering/SVG';
describe('SVG', () => { describe('SVG', () => {
test('rendering', () => { test('rendering', () => {
const component = shallow( const { asFragment } = render(
<SVG width={ 100 } height={ 20 }>Content</SVG> <SVG width={ 100 } height={ 20 }>Content</SVG>
); );
expect(component).toMatchSnapshot(); expect(asFragment()).toMatchSnapshot();
}); });
test('layout', () => { test('layout', () => {