@@ -12,6 +12,72 @@ import './stories.css';
1212
1313import React from 'react' ;
1414import { 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+ } ;
1581
1682/**
1783 * 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() {
34100 return null ;
35101} ;
36102
37- const panelFixture = ( Panel , group , name , figure ) => {
103+ const panelFixture = ( Panel , group , name , figure , customConfig ) => {
38104 const gd = setupGraphDiv ( figure , plotly ) ;
39105 gd . _context = plotly . setPlotConfig ( ) ;
40106 gd . _context . setBackground = ( ) => {
@@ -48,6 +114,7 @@ const panelFixture = (Panel, group, name, figure) => {
48114 graphDiv = { gd }
49115 dataSources = { fixtures . scatter ( ) . dataSources }
50116 dataSourceOptions = { fixtures . scatter ( ) . dataSourceOptions }
117+ customConfig = { customConfig || { } }
51118 >
52119 < PanelMenuWrapper >
53120 < Panel group = { group } name = { name } />
@@ -67,8 +134,10 @@ Object.keys(mocks).forEach(m => {
67134 const panelGroup = words [ 0 ] ;
68135 const panelName = words . slice ( 1 , - 1 ) . join ( ' ' ) ;
69136
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+ ) ;
73142 } ) ;
74143} ) ;
0 commit comments