@@ -21,6 +21,15 @@ describe('V2ThemeContext', () => {
2121 const mockLightColors = { 400 : '#000000' , '100' : '#be3434' , '200' : '#2f63be' } ;
2222 const mockDarkColors = { 400 : '#a31a1a' , '100' : '#3464be' , '200' : '#76be2f' } ;
2323
24+ beforeEach ( ( ) => {
25+ jest . useFakeTimers ( ) ;
26+ jest . clearAllMocks ( ) ;
27+ } ) ;
28+
29+ afterEach ( ( ) => {
30+ jest . clearAllTimers ( ) ;
31+ } ) ;
32+
2433 describe ( 'createColorShades' , ( ) => {
2534 it ( 'should customized the theme color shades' , ( ) => {
2635 const colors = createColorShades ( {
@@ -427,11 +436,11 @@ describe('V2ThemeContext', () => {
427436
428437 const startLine = getByTestId ( startLineTestId ) ;
429438 const startLineFlattenStyles = StyleSheet . flatten ( startLine . props . style ) ;
430- expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'green' } ) ) ;
439+ expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'green' } ) ) ;
431440
432441 const endLine = getByTestId ( endLineTestId ) ;
433442 const endLineFlattenStyles = StyleSheet . flatten ( endLine . props . style ) ;
434- expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'green' } ) ) ;
443+ expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'green' } ) ) ;
435444 } ) ;
436445
437446 it ( 'should adopted the theme gray color' , ( ) => {
@@ -443,11 +452,11 @@ describe('V2ThemeContext', () => {
443452
444453 const startLine = getByTestId ( startLineTestId ) ;
445454 const startLineFlattenStyles = StyleSheet . flatten ( startLine . props . style ) ;
446- expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'gray' } ) ) ;
455+ expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'gray' } ) ) ;
447456
448457 const endLine = getByTestId ( endLineTestId ) ;
449458 const endLineFlattenStyles = StyleSheet . flatten ( endLine . props . style ) ;
450- expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'gray' } ) ) ;
459+ expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'gray' } ) ) ;
451460 } ) ;
452461
453462 it ( 'should adopted the theme warning color' , ( ) => {
@@ -459,11 +468,11 @@ describe('V2ThemeContext', () => {
459468
460469 const startLine = getByTestId ( startLineTestId ) ;
461470 const startLineFlattenStyles = StyleSheet . flatten ( startLine . props . style ) ;
462- expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'pink' } ) ) ;
471+ expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'pink' } ) ) ;
463472
464473 const endLine = getByTestId ( endLineTestId ) ;
465474 const endLineFlattenStyles = StyleSheet . flatten ( endLine . props . style ) ;
466- expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'pink' } ) ) ;
475+ expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'pink' } ) ) ;
467476 } ) ;
468477
469478 it ( 'should adopted the theme info color' , ( ) => {
@@ -475,11 +484,11 @@ describe('V2ThemeContext', () => {
475484
476485 const startLine = getByTestId ( startLineTestId ) ;
477486 const startLineFlattenStyles = StyleSheet . flatten ( startLine . props . style ) ;
478- expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'white' } ) ) ;
487+ expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'white' } ) ) ;
479488
480489 const endLine = getByTestId ( endLineTestId ) ;
481490 const endLineFlattenStyles = StyleSheet . flatten ( endLine . props . style ) ;
482- expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'white' } ) ) ;
491+ expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'white' } ) ) ;
483492 } ) ;
484493
485494 it ( 'should adopted the theme error color' , ( ) => {
@@ -491,11 +500,11 @@ describe('V2ThemeContext', () => {
491500
492501 const startLine = getByTestId ( startLineTestId ) ;
493502 const startLineFlattenStyles = StyleSheet . flatten ( startLine . props . style ) ;
494- expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'blue' } ) ) ;
503+ expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'blue' } ) ) ;
495504
496505 const endLine = getByTestId ( endLineTestId ) ;
497506 const endLineFlattenStyles = StyleSheet . flatten ( endLine . props . style ) ;
498- expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'blue' } ) ) ;
507+ expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'blue' } ) ) ;
499508 } ) ;
500509
501510 it ( 'should adopted the theme success color' , ( ) => {
@@ -507,11 +516,11 @@ describe('V2ThemeContext', () => {
507516
508517 const startLine = getByTestId ( startLineTestId ) ;
509518 const startLineFlattenStyles = StyleSheet . flatten ( startLine . props . style ) ;
510- expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'pink' } ) ) ;
519+ expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'pink' } ) ) ;
511520
512521 const endLine = getByTestId ( endLineTestId ) ;
513522 const endLineFlattenStyles = StyleSheet . flatten ( endLine . props . style ) ;
514- expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'pink' } ) ) ;
523+ expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'pink' } ) ) ;
515524 } ) ;
516525
517526 it ( 'should adopted the theme primary color' , ( ) => {
@@ -523,11 +532,11 @@ describe('V2ThemeContext', () => {
523532
524533 const startLine = getByTestId ( startLineTestId ) ;
525534 const startLineFlattenStyles = StyleSheet . flatten ( startLine . props . style ) ;
526- expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'green' } ) ) ;
535+ expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'green' } ) ) ;
527536
528537 const endLine = getByTestId ( endLineTestId ) ;
529538 const endLineFlattenStyles = StyleSheet . flatten ( endLine . props . style ) ;
530- expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'green' } ) ) ;
539+ expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'green' } ) ) ;
531540 } ) ;
532541
533542 it ( 'should adopted the theme secondary color' , ( ) => {
@@ -539,11 +548,11 @@ describe('V2ThemeContext', () => {
539548
540549 const startLine = getByTestId ( startLineTestId ) ;
541550 const startLineFlattenStyles = StyleSheet . flatten ( startLine . props . style ) ;
542- expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'red' } ) ) ;
551+ expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'red' } ) ) ;
543552
544553 const endLine = getByTestId ( endLineTestId ) ;
545554 const endLineFlattenStyles = StyleSheet . flatten ( endLine . props . style ) ;
546- expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'red' } ) ) ;
555+ expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'red' } ) ) ;
547556 } ) ;
548557
549558 it ( 'should adopted the theme startLineStyles' , ( ) => {
@@ -600,34 +609,34 @@ describe('V2ThemeContext', () => {
600609
601610 it ( 'should adopted the theme borderColor' , ( ) => {
602611 const { getByTestId } = themeRender (
603- < ThemeProvider components = { { dividerProps : { borderColor : 'red' } } } >
612+ < ThemeProvider components = { { dividerProps : { backgroundColor : 'red' } } } >
604613 < Divider startLineTestId = { startLineTestId } endLineTestId = { endLineTestId } />
605614 </ ThemeProvider > ,
606615 ) ;
607616
608617 const startLine = getByTestId ( startLineTestId ) ;
609618 const startLineFlattenStyles = StyleSheet . flatten ( startLine . props . style ) ;
610- expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'red' } ) ) ;
619+ expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'red' } ) ) ;
611620
612621 const endLine = getByTestId ( endLineTestId ) ;
613622 const endLineFlattenStyles = StyleSheet . flatten ( endLine . props . style ) ;
614- expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'red' } ) ) ;
623+ expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'red' } ) ) ;
615624 } ) ;
616625
617626 it ( 'should override the theme borderColor' , ( ) => {
618627 const { getByTestId } = themeRender (
619- < ThemeProvider components = { { dividerProps : { borderColor : 'red' } } } >
620- < Divider borderColor = "green" startLineTestId = { startLineTestId } endLineTestId = { endLineTestId } />
628+ < ThemeProvider components = { { dividerProps : { backgroundColor : 'red' } } } >
629+ < Divider backgroundColor = "green" startLineTestId = { startLineTestId } endLineTestId = { endLineTestId } />
621630 </ ThemeProvider > ,
622631 ) ;
623632
624633 const startLine = getByTestId ( startLineTestId ) ;
625634 const startLineFlattenStyles = StyleSheet . flatten ( startLine . props . style ) ;
626- expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'green' } ) ) ;
635+ expect ( startLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'green' } ) ) ;
627636
628637 const endLine = getByTestId ( endLineTestId ) ;
629638 const endLineFlattenStyles = StyleSheet . flatten ( startLine . props . style ) ;
630- expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { borderColor : 'green' } ) ) ;
639+ expect ( endLineFlattenStyles ) . toEqual ( expect . objectContaining ( { backgroundColor : 'green' } ) ) ;
631640 } ) ;
632641
633642 it ( 'should adopted the theme styles' , ( ) => {
0 commit comments