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`] = `
<DocumentFragment>
<svg
height={20}
style={
Object {
"backgroundColor": "#fff",
}
}
height="20"
style="background-color: rgb(255, 255, 255);"
viewBox="0 0 100 20"
width={100}
width="100"
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>",
}
}
<metadata>
<rdf:rdf>
<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 { shallow } from 'enzyme';
import { render } from 'react-testing-library';
import SVG, { layout } from 'rendering/SVG';
describe('SVG', () => {
test('rendering', () => {
const component = shallow(
const { asFragment } = render(
<SVG width={ 100 } height={ 20 }>Content</SVG>
);
expect(component).toMatchSnapshot();
expect(asFragment()).toMatchSnapshot();
});
test('layout', () => {