@@ -12,6 +12,72 @@ import './stories.css';
12
12
13
13
import React from 'react' ;
14
14
import { storiesOf } from '@storybook/react' ;
15
+ export const customConfigTest = {
16
+ visibility_rules : {
17
+ blacklist : [
18
+ { type : 'attrName' , regex_match : 'font.family' } ,
19
+ { type : 'attrName' , regex_match : 'font.size' } ,
20
+ {
21
+ type : 'attrName' ,
22
+ regex_match : 'color' ,
23
+ exceptions : [
24
+ {
25
+ type : 'attrName' ,
26
+ regex_match : 'colorbar' ,
27
+ exceptions : [
28
+ { type : 'attrName' , regex_match : 'colorbar.bgcolor' } ,
29
+ { type : 'attrName' , regex_match : 'colorbar.tickfont.color' } ,
30
+ { type : 'attrName' , regex_match : 'colorbar.title.font.color' } ,
31
+ { type : 'attrName' , regex_match : 'colorbar.outlinecolor' } ,
32
+ { type : 'attrName' , regex_match : 'colorbar.bordercolor' } ,
33
+ { type : 'attrName' , regex_match : 'colorbar.tickcolor' } ,
34
+ ] ,
35
+ } ,
36
+ {
37
+ type : 'attrName' ,
38
+ regex_match : 'coloraxis' ,
39
+ exceptions : [
40
+ { type : 'attrName' , regex_match : 'coloraxis.colorscale' } ,
41
+ { type : 'attrName' , regex_match : 'coloraxis.colorbar.outlinecolor' } ,
42
+ { type : 'attrName' , regex_match : 'coloraxis.colorbar.bordercolor' } ,
43
+ { type : 'attrName' , regex_match : 'coloraxis.colorbar.bgcolor' } ,
44
+ { type : 'attrName' , regex_match : 'coloraxis.colorbar.tickcolor' } ,
45
+ { type : 'attrName' , regex_match : 'coloraxis.colorbar.tickfont.color' } ,
46
+ { type : 'attrName' , regex_match : 'coloraxis.colorbar.title.font.color' } ,
47
+ ] ,
48
+ } ,
49
+ {
50
+ type : 'attrName' ,
51
+ regex_match : 'colorscales' ,
52
+ exceptions : [
53
+ {
54
+ type : 'attrName' ,
55
+ regex_match : 'colorscales.items.concentrationscales.colorscale' ,
56
+ } ,
57
+ ] ,
58
+ } ,
59
+ { type : 'attrName' , regex_match : 'autocolorscale' } ,
60
+ { type : 'attrName' , regex_match : 'usecolormap' } ,
61
+ { type : 'attrName' , regex_match : 'bundlecolors' } ,
62
+ {
63
+ type : 'attrName' ,
64
+ regex_match : 'marker.color' ,
65
+ exceptions : [
66
+ { type : 'controlType' , regex_match : '^UnconnectedMultiColorPicker$' } ,
67
+ { type : 'controlType' , regex_match : '^UnconnectedColorscalePicker$' } ,
68
+ { type : 'attrName' , regex_match : 'marker.colorbar.outlinecolor' } ,
69
+ { type : 'attrName' , regex_match : 'marker.colorbar.bordercolor' } ,
70
+ { type : 'attrName' , regex_match : 'marker.colorbar.bgcolor' } ,
71
+ { type : 'attrName' , regex_match : 'marker.colorbar.tickcolor' } ,
72
+ { type : 'attrName' , regex_match : 'marker.colorbar.tickfont.color' } ,
73
+ { type : 'attrName' , regex_match : 'marker.colorbar.title.font.color' } ,
74
+ ] ,
75
+ } ,
76
+ ] ,
77
+ } ,
78
+ ] ,
79
+ } ,
80
+ } ;
15
81
16
82
/**
17
83
* To add more Percy tests - add a mock file to /dev/percy, add it to /dev/percy/index.js
@@ -34,7 +100,7 @@ window.URL.createObjectURL = function() {
34
100
return null ;
35
101
} ;
36
102
37
- const panelFixture = ( Panel , group , name , figure ) => {
103
+ const panelFixture = ( Panel , group , name , figure , customConfig ) => {
38
104
const gd = setupGraphDiv ( figure , plotly ) ;
39
105
gd . _context = plotly . setPlotConfig ( ) ;
40
106
gd . _context . setBackground = ( ) => {
@@ -48,6 +114,7 @@ const panelFixture = (Panel, group, name, figure) => {
48
114
graphDiv = { gd }
49
115
dataSources = { fixtures . scatter ( ) . dataSources }
50
116
dataSourceOptions = { fixtures . scatter ( ) . dataSourceOptions }
117
+ customConfig = { customConfig || { } }
51
118
>
52
119
< PanelMenuWrapper >
53
120
< Panel group = { group } name = { name } />
@@ -67,8 +134,10 @@ Object.keys(mocks).forEach(m => {
67
134
const panelGroup = words [ 0 ] ;
68
135
const panelName = words . slice ( 1 , - 1 ) . join ( ' ' ) ;
69
136
70
- stories = stories . add ( `${ m } _${ p } ` , ( ) =>
71
- panelFixture ( panels [ p ] , panelGroup , panelName , mocks [ m ] )
72
- ) ;
137
+ stories = stories
138
+ . add ( `${ m } _${ p } ` , ( ) => panelFixture ( panels [ p ] , panelGroup , panelName , mocks [ m ] ) )
139
+ . add ( `${ m } _${ p } _withCustomConfig` , ( ) =>
140
+ panelFixture ( panels [ p ] , panelGroup , panelName , mocks [ m ] , customConfigTest )
141
+ ) ;
73
142
} ) ;
74
143
} ) ;
0 commit comments