@@ -72,20 +72,6 @@ describe('<CChart />', () => {
72
72
expect ( chart . config . type ) . toEqual ( 'bar' )
73
73
} )
74
74
75
- it ( 'should pass props onto chart if data is fn' , ( ) => {
76
- const dataFn = jest . fn ( ( c ) => ( c ? data : { datasets : [ ] } ) )
77
-
78
- render ( < CChart data = { dataFn } options = { options } type = "bar" ref = { ref } wrapper = { false } /> )
79
-
80
- expect ( chart . config . data ) . toMatchObject ( data )
81
- expect ( chart . config . options ) . toMatchObject ( options )
82
- expect ( chart . config . type ) . toEqual ( 'bar' )
83
-
84
- expect ( dataFn ) . toHaveBeenCalledTimes ( 1 )
85
- expect ( dataFn ) . toHaveBeenCalledWith ( expect . any ( HTMLCanvasElement ) )
86
- expect ( update ) . toHaveBeenCalledTimes ( 1 )
87
- } )
88
-
89
75
it ( 'should pass new data on data change' , ( ) => {
90
76
const newData = {
91
77
labels : [ 'red' , 'blue' ] ,
@@ -129,76 +115,6 @@ describe('<CChart />', () => {
129
115
expect ( chart . id ) . toEqual ( id )
130
116
} )
131
117
132
- // it('should properly maintain order with new data', () => {
133
- // const oldData = {
134
- // labels: ['red', 'blue'],
135
- // datasets: [
136
- // { label: 'new-colors', data: [1, 2] },
137
- // { label: 'colors', data: [3, 2] },
138
- // ],
139
- // }
140
-
141
- // const newData = {
142
- // labels: ['red', 'blue'],
143
- // datasets: [
144
- // { label: 'colors', data: [3, 2] },
145
- // { label: 'new-colors', data: [1, 2] },
146
- // ],
147
- // }
148
-
149
- // const { rerender } = render(
150
- // <CChart data={oldData} options={options} type="bar" ref={ref} wrapper={false} />,
151
- // )
152
-
153
- // const meta = Object.assign({}, chart._metasets)
154
-
155
- // const id = chart.id
156
-
157
- // rerender(<CChart data={newData} options={options} type="bar" ref={ref} wrapper={false} />)
158
-
159
- // expect(chart.config.data).toMatchObject(newData)
160
- // expect(meta[0]).toBe(chart._metasets[1])
161
- // expect(meta[1]).toBe(chart._metasets[0])
162
- // expect(update).toHaveBeenCalled()
163
- // expect(chart.id).toEqual(id)
164
- // })
165
-
166
- // it('should properly update when original data did not exist', () => {
167
- // const oldData = {
168
- // labels: ['red', 'blue'],
169
- // datasets: [
170
- // { label: 'new-colors', data: [1, 6] },
171
- // { label: 'colors', data: [3, 2] },
172
- // ],
173
- // }
174
-
175
- // const newData = {
176
- // labels: ['red', 'blue'],
177
- // datasets: [
178
- // { label: 'colors', data: [4, 5] },
179
- // { label: 'new-colors', data: [1, 2] },
180
- // ],
181
- // }
182
-
183
- // const { rerender } = render(
184
- // <CChart data={oldData} options={options} type="bar" ref={ref} wrapper={false} />,
185
- // )
186
-
187
- // // even when we feed the data as undefined, the constructor will
188
- // // force it to []. Here we force it back
189
- // chart.config.data.datasets[0].data = undefined
190
- // const meta = Object.assign({}, chart._metasets)
191
-
192
- // const id = chart.id
193
-
194
- // rerender(<CChart data={newData} options={options} type="bar" ref={ref} wrapper={false} />)
195
-
196
- // expect(chart.config.data).toMatchObject(newData)
197
- // expect(meta[0]).toBe(chart._metasets[1])
198
- // expect(update).toHaveBeenCalled()
199
- // expect(chart.id).toEqual(id)
200
- // })
201
-
202
118
it ( 'should properly update when incoming data does not exist' , ( ) => {
203
119
const oldData = {
204
120
labels : [ 'red' , 'blue' ] ,
@@ -348,23 +264,6 @@ describe('<CChart />', () => {
348
264
expect ( getElementsAtEvent ) . toHaveBeenCalled ( )
349
265
} )
350
266
351
- // it('should show fallback content if given', () => {
352
- // const fallback = <p data-testid="fallbackContent">Fallback content</p>
353
- // const { getByTestId } = render(
354
- // <CChart
355
- // data={data}
356
- // options={options}
357
- // className="chart-example"
358
- // type="bar"
359
- // ref={ref}
360
- // fallbackContent={fallback}
361
- // />,
362
- // )
363
-
364
- // expect(chart).toBeTruthy()
365
- // expect(chart.canvas).toContainElement(getByTestId('fallbackContent'))
366
- // })
367
-
368
267
it ( 'should pass through aria labels to the canvas element' , ( ) => {
369
268
const ariaLabel = 'ARIA LABEL'
370
269
render ( < CChart data = { data } options = { options } type = "bar" ref = { ref } aria-label = { ariaLabel } /> )
0 commit comments