Skip to content

Commit 97ea7b4

Browse files
committed
percy improvements
1 parent c6a79ec commit 97ea7b4

File tree

5 files changed

+34
-21
lines changed

5 files changed

+34
-21
lines changed

dev/percy/histogram.json

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,9 @@
77
"x": [
88
1,
99
2,
10-
3,
11-
4,
12-
5,
13-
6
10+
3
1411
],
15-
"xsrc": "ints",
12+
"xsrc": "x1",
1613
"autobinx": true,
1714
"xbins": {
1815
"start": -0.5,
@@ -21,13 +18,10 @@
2118
},
2219
"y": [
2320
2,
24-
1,
2521
3,
26-
5,
27-
4,
28-
6
22+
4
2923
],
30-
"ysrc": "jagged ints",
24+
"ysrc": "y1",
3125
"error_x": {
3226
"visible": true,
3327
"symmetric": true

dev/percy/histogram2d.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
2,
1010
3
1111
],
12-
"xsrc": "ints",
12+
"xsrc": "x1",
1313
"y": [
14-
1,
1514
2,
16-
3
15+
3,
16+
4
1717
],
18-
"ysrc": "ints",
18+
"ysrc": "y1",
1919
"autobinx": false,
2020
"xbins": {
2121
"start": 0.5,

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)