Skip to content

Commit

Permalink
fix: raf for react
Browse files Browse the repository at this point in the history
  • Loading branch information
privatenumber committed Dec 3, 2021
1 parent 6c94992 commit 1e2e4d4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion lib/get-artifacts/artifacts/react/test.ts
@@ -1,8 +1,12 @@
import 'jsdom-global/register.js';
import assert from 'assert';
import jsdom from 'jsdom-global';
import { render } from 'react-dom';
import { defineTest } from '../..';

jsdom(undefined, {
pretendToBeVisual: true,
});

export default defineTest({
preprocess(code) {
return code.replace(/console\.warn\(/g, '(');
Expand Down
6 changes: 5 additions & 1 deletion lib/get-artifacts/artifacts/victory/test.ts
@@ -1,9 +1,13 @@
import 'jsdom-global/register.js';
import assert from 'assert';
import jsdom from 'jsdom-global';
import { createElement } from 'react';
import { render } from 'react-dom';
import { defineTest } from '../..';

jsdom(undefined, {
pretendToBeVisual: true,
});

const snapshot = '<div style="height: 100%; width: 100%; user-select: none; pointer-events: none; position: relative;" class="VictoryContainer"><svg width="450" height="300" role="img" viewBox="0 0 450 300" style="pointer-events: all; width: 100%; height: 100%;"><g role="presentation"><line vector-effect="non-scaling-stroke" style="stroke: #252525; fill: transparent; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round;" role="presentation" shape-rendering="auto" x1="50" x2="400" y1="250" y2="250"></line><g role="presentation"><text direction="inherit" dx="0" x="120" y="272.97" id="chart-axis-0-tickLabels-0"><tspan x="120" dx="0" dy="0" text-anchor="middle" style="font-family: \'Gill Sans\', \'Seravek\', \'Trebuchet MS\', sans-serif; font-size: 14px; letter-spacing: normal; padding: 10px; fill: #252525; stroke: transparent;">0.2</tspan></text></g><g role="presentation"><text direction="inherit" dx="0" x="190" y="272.97" id="chart-axis-0-tickLabels-1"><tspan x="190" dx="0" dy="0" text-anchor="middle" style="font-family: \'Gill Sans\', \'Seravek\', \'Trebuchet MS\', sans-serif; font-size: 14px; letter-spacing: normal; padding: 10px; fill: #252525; stroke: transparent;">0.4</tspan></text></g><g role="presentation"><text direction="inherit" dx="0" x="260" y="272.97" id="chart-axis-0-tickLabels-2"><tspan x="260" dx="0" dy="0" text-anchor="middle" style="font-family: \'Gill Sans\', \'Seravek\', \'Trebuchet MS\', sans-serif; font-size: 14px; letter-spacing: normal; padding: 10px; fill: #252525; stroke: transparent;">0.6</tspan></text></g><g role="presentation"><text direction="inherit" dx="0" x="330" y="272.97" id="chart-axis-0-tickLabels-3"><tspan x="330" dx="0" dy="0" text-anchor="middle" style="font-family: \'Gill Sans\', \'Seravek\', \'Trebuchet MS\', sans-serif; font-size: 14px; letter-spacing: normal; padding: 10px; fill: #252525; stroke: transparent;">0.8</tspan></text></g><g role="presentation"><text direction="inherit" dx="0" x="400" y="272.97" id="chart-axis-0-tickLabels-4"><tspan x="400" dx="0" dy="0" text-anchor="middle" style="font-family: \'Gill Sans\', \'Seravek\', \'Trebuchet MS\', sans-serif; font-size: 14px; letter-spacing: normal; padding: 10px; fill: #252525; stroke: transparent;">1.0</tspan></text></g></g><g role="presentation"><line vector-effect="non-scaling-stroke" style="stroke: #252525; fill: transparent; stroke-width: 1; stroke-linecap: round; stroke-linejoin: round;" role="presentation" shape-rendering="auto" x1="50" x2="50" y1="50" y2="250"></line><g role="presentation"><text direction="inherit" dx="0" x="39" y="214.97" id="chart-axis-1-tickLabels-0"><tspan x="39" dx="0" dy="0" text-anchor="end" style="font-family: \'Gill Sans\', \'Seravek\', \'Trebuchet MS\', sans-serif; font-size: 14px; letter-spacing: normal; padding: 10px; fill: #252525; stroke: transparent;">0.2</tspan></text></g><g role="presentation"><text direction="inherit" dx="0" x="39" y="174.97" id="chart-axis-1-tickLabels-1"><tspan x="39" dx="0" dy="0" text-anchor="end" style="font-family: \'Gill Sans\', \'Seravek\', \'Trebuchet MS\', sans-serif; font-size: 14px; letter-spacing: normal; padding: 10px; fill: #252525; stroke: transparent;">0.4</tspan></text></g><g role="presentation"><text direction="inherit" dx="0" x="39" y="134.97" id="chart-axis-1-tickLabels-2"><tspan x="39" dx="0" dy="0" text-anchor="end" style="font-family: \'Gill Sans\', \'Seravek\', \'Trebuchet MS\', sans-serif; font-size: 14px; letter-spacing: normal; padding: 10px; fill: #252525; stroke: transparent;">0.6</tspan></text></g><g role="presentation"><text direction="inherit" dx="0" x="39" y="94.96999999999998" id="chart-axis-1-tickLabels-3"><tspan x="39" dx="0" dy="0" text-anchor="end" style="font-family: \'Gill Sans\', \'Seravek\', \'Trebuchet MS\', sans-serif; font-size: 14px; letter-spacing: normal; padding: 10px; fill: #252525; stroke: transparent;">0.8</tspan></text></g><g role="presentation"><text direction="inherit" dx="0" x="39" y="54.97" id="chart-axis-1-tickLabels-4"><tspan x="39" dx="0" dy="0" text-anchor="end" style="font-family: \'Gill Sans\', \'Seravek\', \'Trebuchet MS\', sans-serif; font-size: 14px; letter-spacing: normal; padding: 10px; fill: #252525; stroke: transparent;">1.0</tspan></text></g></g></svg><div style="z-index: 99; position: absolute; top: 0px; left: 0px; width: 100%; height: 100%;"><svg width="450" height="300" viewBox="0 0 450 300" style="overflow: visible; width: 100%; height: 100%;"></svg></div></div>';

export default defineTest({
Expand Down

0 comments on commit 1e2e4d4

Please sign in to comment.