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`] = `
<DocumentFragment>
<svg <svg
height={20} height="20"
style={ style="background-color: rgb(255, 255, 255);"
Object {
"backgroundColor": "#fff",
}
}
viewBox="0 0 100 20" viewBox="0 0 100 20"
width={100} width="100"
xmlns="http://www.w3.org/2000/svg" xmlns="http://www.w3.org/2000/svg"
xmlns:cc="http://creativecommons.org/ns#" xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
> >
<metadata <metadata>
dangerouslySetInnerHTML={ <rdf:rdf>
Object {
"__html": "<rdf:rdf>
<cc:license rdf:about=\\"http://creativecommons.org/licenses/by/3.0/\\"> <cc:license
<cc:permits rdf:resource=\\"http://creativecommons.org/ns#Reproduction\\"></cc:permits> rdf:about="http://creativecommons.org/licenses/by/3.0/"
<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:permits
</cc:license> rdf:resource="http://creativecommons.org/ns#Reproduction"
</rdf:rdf>",
}
}
/> />
<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 <g
transform="translate(10 10)" transform="translate(10 10)"
> >
Content Content
</g> </g>
</svg> </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', () => {