@@ -3,7 +3,7 @@ import { Calendar } from './calendar';
3
3
import { prettyDOM , render } from '@testing-library/react' ;
4
4
import user from '@testing-library/user-event' ;
5
5
import '@testing-library/jest-dom' ;
6
- import { CalendarSpectrum } from './Calendar -spectrum' ;
6
+ import { CalendarSpectrum } from './calendar -spectrum' ;
7
7
import { screenTest } from '../screen' ;
8
8
9
9
function freshFn ( ) {
@@ -22,50 +22,50 @@ describe('Calendar', () => {
22
22
} ) ;
23
23
24
24
it ( 'has previous button' , ( ) => {
25
- expect ( screenTest ( Calendar . previousButton ( ) ) ) . toBeVisible ( ) ;
25
+ expect ( screenTest ( Calendar . PreviousButton ( ) ) ) . toBeVisible ( ) ;
26
26
} ) ;
27
27
28
28
it ( 'can click previous button' , async ( ) => {
29
- await screenTest . wait ( Calendar . previousButton ( ) . click ) ;
29
+ await screenTest . wait ( Calendar . PreviousButton ( ) . click ) ;
30
30
expect (
31
- await screenTest . wait ( Calendar . grid ( 'Audition Date, January 2020' ) )
31
+ await screenTest . wait ( Calendar . Grid ( 'Audition Date, January 2020' ) )
32
32
) . toBeVisible ( ) ;
33
33
} ) ;
34
34
35
35
it ( 'has next button' , ( ) => {
36
36
// Spectrum has two Next button, one for the next month, one for tabbing.
37
- expect ( screenTest ( Calendar . nextButton ( ) . all ) [ 0 ] ) . toBeVisible ( ) ;
37
+ expect ( screenTest ( Calendar . NextButton ( ) . all ) [ 0 ] ) . toBeVisible ( ) ;
38
38
} ) ;
39
39
40
40
it ( 'has grid' , ( ) => {
41
- expect ( screenTest ( Calendar . grid ( ) ) ) . toBeVisible ( ) ;
41
+ expect ( screenTest ( Calendar . Grid ( ) ) ) . toBeVisible ( ) ;
42
42
} ) ;
43
43
44
44
it ( 'has named grid' , ( ) => {
45
45
expect (
46
- screenTest ( Calendar . grid ( 'Audition Date, February 2020' ) )
46
+ screenTest ( Calendar . Grid ( 'Audition Date, February 2020' ) )
47
47
) . toBeVisible ( ) ;
48
48
} ) ;
49
49
50
50
it ( 'has week rows' , ( ) => {
51
- expect ( screenTest ( Calendar . weekRow ( ) . all ) ) . toHaveLength ( 5 ) ;
51
+ expect ( screenTest ( Calendar . WeekRow ( ) . all ) ) . toHaveLength ( 5 ) ;
52
52
} ) ;
53
53
54
54
it ( 'has day gridcells' , ( ) => {
55
- expect ( screenTest ( Calendar . dayGridCell ( ) . all ) ) . toHaveLength ( 5 * 7 ) ;
55
+ expect ( screenTest ( Calendar . DayGridCell ( ) . all ) ) . toHaveLength ( 5 * 7 ) ;
56
56
} ) ;
57
57
58
58
it ( 'has selected day gridcell' , ( ) => {
59
- const selectedDay = screenTest ( Calendar . dayGridCell ( ) . selected ) ;
59
+ const selectedDay = screenTest ( Calendar . DayGridCell ( ) . selected ) ;
60
60
expect (
61
- screenTest ( Calendar . dayButton ( / F e b r u a r y 3 , 2 0 2 0 / ) , selectedDay )
61
+ screenTest ( Calendar . DayButton ( / F e b r u a r y 3 , 2 0 2 0 / ) , selectedDay )
62
62
) . toBeVisible ( ) ;
63
63
} ) ;
64
64
65
65
describe . skip ( 'when particular day is clicked' , ( ) => {
66
66
beforeEach ( async ( ) => {
67
- console . log ( prettyDOM ( screenTest ( Calendar . grid ( ) ) ) ) ;
68
- await screenTest . wait ( Calendar . dayButton ( '20 February 2020' ) . click ) ;
67
+ console . log ( prettyDOM ( screenTest ( Calendar . Grid ( ) ) ) ) ;
68
+ await screenTest . wait ( Calendar . DayButton ( '20 February 2020' ) . click ) ;
69
69
} ) ;
70
70
71
71
it ( 'dispatches' , ( ) => {
@@ -81,43 +81,43 @@ describe('Calendar', () => {
81
81
} ) ;
82
82
83
83
it ( 'focuses on selected day' , ( ) => {
84
- const selectedDay = screenTest ( Calendar . dayGridCell ( ) . selected ) ;
85
- expect ( screenTest ( Calendar . dayButton ( ) , selectedDay ) ) . toHaveFocus ( ) ;
84
+ const selectedDay = screenTest ( Calendar . DayGridCell ( ) . selected ) ;
85
+ expect ( screenTest ( Calendar . DayButton ( ) , selectedDay ) ) . toHaveFocus ( ) ;
86
86
} ) ;
87
87
88
88
it ( 'can go left' , async ( ) => {
89
89
await user . keyboard ( '{ArrowLeft}' ) ;
90
90
expect (
91
- screenTest ( Calendar . dayButton ( / F e b r u a r y 2 , 2 0 2 0 / ) )
91
+ screenTest ( Calendar . DayButton ( / F e b r u a r y 2 , 2 0 2 0 / ) )
92
92
) . toHaveFocus ( ) ;
93
93
} ) ;
94
94
95
95
it ( 'can go right' , async ( ) => {
96
96
await user . keyboard ( '{ArrowRight}' ) ;
97
97
expect (
98
- screenTest ( Calendar . dayButton ( / F e b r u a r y 4 , 2 0 2 0 / ) )
98
+ screenTest ( Calendar . DayButton ( / F e b r u a r y 4 , 2 0 2 0 / ) )
99
99
) . toHaveFocus ( ) ;
100
100
} ) ;
101
101
102
102
it ( 'can select left with Enter key' , async ( ) => {
103
103
await user . keyboard ( '{ArrowLeft}{Enter}' ) ;
104
- const selectedDay = screenTest ( Calendar . dayGridCell ( ) . selected ) ;
104
+ const selectedDay = screenTest ( Calendar . DayGridCell ( ) . selected ) ;
105
105
expect (
106
- screenTest ( Calendar . dayButton ( / F e b r u a r y 2 , 2 0 2 0 / ) , selectedDay )
106
+ screenTest ( Calendar . DayButton ( / F e b r u a r y 2 , 2 0 2 0 / ) , selectedDay )
107
107
) . toHaveFocus ( ) ;
108
108
} ) ;
109
109
110
110
it ( 'can select right with Enter key' , async ( ) => {
111
111
await user . keyboard ( '{ArrowRight}{Enter}' ) ;
112
112
expect (
113
- screenTest ( Calendar . dayButton ( / F e b r u a r y 4 , 2 0 2 0 / ) )
113
+ screenTest ( Calendar . DayButton ( / F e b r u a r y 4 , 2 0 2 0 / ) )
114
114
) . toHaveFocus ( ) ;
115
115
} ) ;
116
116
117
117
it ( 'focuses next week after pressing right arrow 7 times' , async ( ) => {
118
118
await user . keyboard ( new Array ( 7 ) . fill ( '{ArrowRight}' ) . join ( '' ) ) ;
119
119
expect (
120
- screenTest ( Calendar . dayButton ( / F e b r u a r y 1 0 , 2 0 2 0 / ) )
120
+ screenTest ( Calendar . DayButton ( / F e b r u a r y 1 0 , 2 0 2 0 / ) )
121
121
) . toHaveFocus ( ) ;
122
122
} ) ;
123
123
} ) ;
0 commit comments