@instructure/ui-date-time-input 8.53.2 → 8.53.3-pr-snapshot-8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -23,17 +23,17 @@
23
23
  */
24
24
 
25
25
  import React from 'react'
26
- import { fireEvent, render, screen } from '@testing-library/react'
26
+ import { render } from '@testing-library/react'
27
27
  import '@testing-library/jest-dom'
28
- import { userEvent } from '@testing-library/user-event'
28
+ // import { userEvent } from '@testing-library/user-event'
29
29
  import DateTimeInput from '../index'
30
30
 
31
31
  describe('<DateTimeInput />', () => {
32
- it("should change value of TimeSelect to initialTimeForNewDate prop's value", async () => {
32
+ it('should render', async () => {
33
33
  const locale = 'en-US'
34
34
  const timezone = 'US/Eastern'
35
35
 
36
- render(
36
+ const { container } = render(
37
37
  <DateTimeInput
38
38
  description="date time"
39
39
  prevMonthLabel="Previous month"
@@ -47,98 +47,119 @@ describe('<DateTimeInput />', () => {
47
47
  />
48
48
  )
49
49
 
50
- const input = screen.getAllByRole('combobox')[0]
50
+ expect(container.firstChild).toBeInTheDocument()
51
+ })
51
52
 
52
- fireEvent.click(input)
53
+ // it("should change value of TimeSelect to initialTimeForNewDate prop's value", async () => {
54
+ // const locale = 'en-US'
55
+ // const timezone = 'US/Eastern'
53
56
 
54
- const firstDay = screen.getByText('15')
57
+ // render(
58
+ // <DateTimeInput
59
+ // description="date time"
60
+ // prevMonthLabel="Previous month"
61
+ // nextMonthLabel="Next month"
62
+ // dateRenderLabel="date"
63
+ // timeRenderLabel="time"
64
+ // invalidDateTimeMessage="whoops"
65
+ // locale={locale}
66
+ // timezone={timezone}
67
+ // initialTimeForNewDate="05:05"
68
+ // />
69
+ // )
55
70
 
56
- await userEvent.click(firstDay)
71
+ // const input = screen.getAllByRole('combobox')[0]
57
72
 
58
- const allInputs = screen.getAllByRole('combobox')
59
- const targetInput = allInputs.find(
60
- (input) => (input as HTMLInputElement).value === '5:05 AM'
61
- )
62
- expect(targetInput).toBeInTheDocument()
63
- })
73
+ // fireEvent.click(input)
64
74
 
65
- it("should throw warning if initialTimeForNewDate prop's value is not HH:MM", async () => {
66
- const locale = 'en-US'
67
- const timezone = 'US/Eastern'
75
+ // const firstDay = screen.getByText('15')
68
76
 
69
- const consoleError = jest
70
- .spyOn(console, 'error')
71
- .mockImplementation(() => {})
77
+ // await userEvent.click(firstDay)
72
78
 
73
- const initialTimeForNewDate = 'WRONG_FORMAT'
79
+ // const allInputs = screen.getAllByRole('combobox')
80
+ // const targetInput = allInputs.find(
81
+ // (input) => (input as HTMLInputElement).value === '5:05 AM'
82
+ // )
83
+ // expect(targetInput).toBeInTheDocument()
84
+ // })
74
85
 
75
- render(
76
- <DateTimeInput
77
- description="date time"
78
- prevMonthLabel="Previous month"
79
- nextMonthLabel="Next month"
80
- dateRenderLabel="date"
81
- timeRenderLabel="time"
82
- invalidDateTimeMessage="whoops"
83
- locale={locale}
84
- timezone={timezone}
85
- initialTimeForNewDate={initialTimeForNewDate}
86
- />
87
- )
86
+ // it("should throw warning if initialTimeForNewDate prop's value is not HH:MM", async () => {
87
+ // const locale = 'en-US'
88
+ // const timezone = 'US/Eastern'
88
89
 
89
- expect(consoleError.mock.calls[0][2]).toContain(
90
- `Invalid prop \`initialTimeForNewDate\` \`${initialTimeForNewDate}\` supplied to \`DateTimeInput\`, expected a HH:MM formatted string.`
91
- )
90
+ // const consoleError = jest
91
+ // .spyOn(console, 'error')
92
+ // .mockImplementation(() => {})
92
93
 
93
- const input = screen.getAllByRole('combobox')[0]
94
+ // const initialTimeForNewDate = 'WRONG_FORMAT'
94
95
 
95
- fireEvent.click(input)
96
+ // render(
97
+ // <DateTimeInput
98
+ // description="date time"
99
+ // prevMonthLabel="Previous month"
100
+ // nextMonthLabel="Next month"
101
+ // dateRenderLabel="date"
102
+ // timeRenderLabel="time"
103
+ // invalidDateTimeMessage="whoops"
104
+ // locale={locale}
105
+ // timezone={timezone}
106
+ // initialTimeForNewDate={initialTimeForNewDate}
107
+ // />
108
+ // )
96
109
 
97
- const firstDay = screen.getByText('15')
110
+ // expect(consoleError.mock.calls[0][2]).toContain(
111
+ // `Invalid prop \`initialTimeForNewDate\` \`${initialTimeForNewDate}\` supplied to \`DateTimeInput\`, expected a HH:MM formatted string.`
112
+ // )
98
113
 
99
- await userEvent.click(firstDay)
114
+ // const input = screen.getAllByRole('combobox')[0]
100
115
 
101
- expect(consoleError.mock.calls[1][0]).toBe(
102
- `Warning: [DateTimeInput] initialTimeForNewDate prop is not in the correct format. Please use HH:MM format.`
103
- )
104
- })
116
+ // fireEvent.click(input)
105
117
 
106
- it('should throw warning if initialTimeForNewDate prop hour and minute values are not in interval', async () => {
107
- const locale = 'en-US'
108
- const timezone = 'US/Eastern'
118
+ // const firstDay = screen.getByText('15')
109
119
 
110
- const consoleError = jest
111
- .spyOn(console, 'error')
112
- .mockImplementation(() => {})
120
+ // await userEvent.click(firstDay)
113
121
 
114
- const initialTimeForNewDate = '99:99'
122
+ // expect(consoleError.mock.calls[1][0]).toBe(
123
+ // `Warning: [DateTimeInput] initialTimeForNewDate prop is not in the correct format. Please use HH:MM format.`
124
+ // )
125
+ // })
115
126
 
116
- render(
117
- <DateTimeInput
118
- description="date time"
119
- prevMonthLabel="Previous month"
120
- nextMonthLabel="Next month"
121
- dateRenderLabel="date"
122
- timeRenderLabel="time"
123
- invalidDateTimeMessage="whoops"
124
- locale={locale}
125
- timezone={timezone}
126
- initialTimeForNewDate={initialTimeForNewDate}
127
- />
128
- )
127
+ // it('should throw warning if initialTimeForNewDate prop hour and minute values are not in interval', async () => {
128
+ // const locale = 'en-US'
129
+ // const timezone = 'US/Eastern'
129
130
 
130
- const input = screen.getAllByRole('combobox')[0]
131
+ // const consoleError = jest
132
+ // .spyOn(console, 'error')
133
+ // .mockImplementation(() => {})
131
134
 
132
- fireEvent.click(input)
135
+ // const initialTimeForNewDate = '99:99'
133
136
 
134
- const firstDay = screen.getByText('15')
137
+ // render(
138
+ // <DateTimeInput
139
+ // description="date time"
140
+ // prevMonthLabel="Previous month"
141
+ // nextMonthLabel="Next month"
142
+ // dateRenderLabel="date"
143
+ // timeRenderLabel="time"
144
+ // invalidDateTimeMessage="whoops"
145
+ // locale={locale}
146
+ // timezone={timezone}
147
+ // initialTimeForNewDate={initialTimeForNewDate}
148
+ // />
149
+ // )
135
150
 
136
- await userEvent.click(firstDay)
151
+ // const input = screen.getAllByRole('combobox')[0]
137
152
 
138
- expect(consoleError.mock.calls[0][0]).toContain(
139
- `Warning: [DateTimeInput] 0 <= hour < 24 and 0 <= minute < 60 for initialTimeForNewDate prop.`
140
- )
141
- })
153
+ // fireEvent.click(input)
154
+
155
+ // const firstDay = screen.getByText('15')
156
+
157
+ // await userEvent.click(firstDay)
158
+
159
+ // expect(consoleError.mock.calls[0][0]).toContain(
160
+ // `Warning: [DateTimeInput] 0 <= hour < 24 and 0 <= minute < 60 for initialTimeForNewDate prop.`
161
+ // )
162
+ // })
142
163
 
143
164
  /*
144
165
  * TODO write this test with Cypress
@@ -205,7 +226,7 @@ describe('<DateTimeInput />', () => {
205
226
  // // )
206
227
  // })
207
228
 
208
- afterEach(() => {
209
- jest.resetAllMocks()
210
- })
229
+ // afterEach(() => {
230
+ // jest.resetAllMocks()
231
+ // })
211
232
  })