Skip to content

Commit 74e9c3d

Browse files
committed
percy improvements
1 parent 87e3d36 commit 74e9c3d

File tree

3 files changed

+26
-7
lines changed

3 files changed

+26
-7
lines changed

dev/percy/panelTest.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"transforms": [
1717
{
1818
"type": "aggregate",
19+
"enabled": true,
1920
"groups": [
2021
1,
2122
2,
@@ -105,15 +106,19 @@
105106
"transforms": [
106107
{
107108
"type": "groupby",
108-
"groupssrc": "ints"
109+
"groupssrc": "ints",
110+
"groups": [],
111+
"enabled": true
109112
},
110113
{
114+
"enabled": true,
111115
"type": "filter",
116+
"target": "x",
112117
"targetsrc": "ints",
113118
"operation": "[]",
114119
"value": [
115120
"0",
116-
""
121+
"1"
117122
]
118123
}
119124
]

src/__percy__/panels.percy.js

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import React from 'react';
2-
import {TestEditor, plotly, setupGraphDiv} from 'lib/test-utils';
1+
import {TestEditor, setupGraphDiv, fixtures, plotly} from 'lib/test-utils';
32

43
import {PanelMenuWrapper} from '../components';
54

@@ -19,10 +18,25 @@ const panelsToTest = {
1918
histogram2d: ['GraphCreatePanel', 'StyleTracesPanel'],
2019
};
2120

22-
const panelFixture = (Panel, group, name, data) => {
21+
window.URL.createObjectURL = function() {
22+
return null;
23+
};
24+
25+
const panelFixture = (Panel, group, name, figure) => {
26+
const gd = setupGraphDiv(figure);
27+
gd._context = plotly.setPlotConfig();
28+
gd._context.setBackground = () => {
29+
return null;
30+
};
31+
2332
return (
2433
<div className="plotly_editor">
25-
<TestEditor plotly={plotly} graphDiv={setupGraphDiv(data)}>
34+
<TestEditor
35+
plotly={plotly}
36+
graphDiv={gd}
37+
dataSources={fixtures.scatter().dataSources}
38+
dataSourceOptions={fixtures.scatter().dataSourceOptions}
39+
>
2640
<PanelMenuWrapper>
2741
<Panel group={group} name={name} />
2842
</PanelMenuWrapper>

src/lib/test-utils.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import plotly from 'plotly.js/dist/plotly-basic';
1+
import plotly from 'plotly.js/dist/plotly-cartesian';
22
import {extendDeep} from 'plotly.js/src/lib/extend';
33
import EditorControls from '../EditorControls';
44
import {configure, mount, shallow} from 'enzyme';

0 commit comments

Comments
 (0)