11/* eslint-env browser */
22
3- import React from 'react' ;
4-
53import isChromatic from '../isChromatic' ;
6- import AComponent from './a' ;
74
85export default {
96 title : 'Tests' ,
@@ -12,66 +9,23 @@ export default {
129
1310export const WithViewports = {
1411 render : ( ) => {
15- let bg ;
1612 if ( window . matchMedia ( '(max-width: 400px)' ) . matches ) {
17- bg = 'cyan ';
13+ return 'A ';
1814 } else if ( window . matchMedia ( '(max-width: 800px)' ) . matches ) {
19- bg = 'orange ';
15+ return 'B ';
2016 }
21- return (
22- < AComponent backgroundColor = { bg } thing = { ( ) => { } } >
23- Contents
24- </ AComponent >
25- ) ;
17+ return 'C' ;
2618 } ,
2719
2820 parameters : { chromatic : { viewports : [ 320 , 600 , 1200 ] } } ,
2921} ;
3022
3123export const WithDelay = {
32- render : ( ) => < AComponent thing = { ( ) => { } } > { isChromatic ( ) ? 'Chromatic' : 'Second' } </ AComponent > ,
33-
24+ render : ( ) => ( isChromatic ( ) ? 'Chromatic' : 'Second' ) ,
3425 parameters : { chromatic : { delay : 1000 } } ,
3526} ;
3627
3728export const DisabledStory = {
38- render : ( ) => < AComponent thing = { ( ) => { } } > Disabled story</ AComponent > ,
29+ render : ( ) => ' Disabled story' ,
3930 parameters : { chromatic : { disable : true } } ,
4031} ;
41-
42- export const IgnoredElements = ( ) => (
43- < div >
44- < img
45- alt = ""
46- src = "http://fpoimg.com/100x100?text=foozbar"
47- data-chromatic = "ignore"
48- style = { { border : '2px solid orangered' } }
49- />
50- < img
51- alt = ""
52- src = "http://fpoimg.com/100x100?text=foozbar"
53- className = "chromatic-ignore"
54- style = { { border : '2px solid orangered' } }
55- />
56- < img
57- alt = ""
58- src = "http://fpoimg.com/100x100?text=foozbar"
59- style = { { border : '2px solid green' } }
60- />
61- </ div >
62- ) ;
63-
64- export const RightToLeftBody = ( ) => {
65- React . useEffect ( ( ) => {
66- const { dir } = document . body ;
67- document . body . dir = 'rtl' ;
68- return ( ) => {
69- document . body . dir = dir ;
70- } ;
71- } , [ ] ) ;
72- return < div > Content</ div > ;
73- } ;
74-
75- export const RightToLeftContainer = ( ) => {
76- return < div dir = "rtl" > Content</ div > ;
77- } ;
0 commit comments