@@ -19,7 +19,7 @@ import DeclarationSourceLink
19
19
20
20
const {
21
21
ConditionalConstraints,
22
- DeclarationGroup ,
22
+ DeclarationList ,
23
23
} = Declaration . components ;
24
24
25
25
const { ChangeTypes } = Declaration . constants ;
@@ -72,14 +72,14 @@ describe('Declaration', () => {
72
72
expect ( wrapper . is ( 'section.declaration' ) ) . toBe ( true ) ;
73
73
} ) ;
74
74
75
- it ( 'renders 1 `DeclarationGroup ` and 0 labels without multiple declarations' , ( ) => {
76
- const declarationGroups = wrapper . findAll ( DeclarationGroup ) ;
77
- expect ( declarationGroups ) . toHaveLength ( 1 ) ;
78
- expect ( declarationGroups . at ( 0 ) . props ( 'shouldCaption' ) ) . toEqual ( false ) ;
75
+ it ( 'renders 1 `DeclarationList ` and 0 labels without multiple declarations' , ( ) => {
76
+ const declarationLists = wrapper . findAll ( DeclarationList ) ;
77
+ expect ( declarationLists ) . toHaveLength ( 1 ) ;
78
+ expect ( declarationLists . at ( 0 ) . props ( 'shouldCaption' ) ) . toEqual ( false ) ;
79
79
} ) ;
80
80
81
- it ( 'renders a `DeclarationGroup `' , ( ) => {
82
- const group = wrapper . find ( DeclarationGroup ) ;
81
+ it ( 'renders a `DeclarationList `' , ( ) => {
82
+ const group = wrapper . find ( DeclarationList ) ;
83
83
expect ( group . exists ( ) ) . toBe ( true ) ;
84
84
expect ( group . props ( 'declaration' ) ) . toEqual ( propsData . declarations [ 0 ] ) ;
85
85
expect ( group . props ( ) ) . toHaveProperty ( 'declListExpanded' , false ) ;
@@ -155,13 +155,13 @@ describe('Declaration', () => {
155
155
156
156
wrapper . setProps ( { declarations } ) ;
157
157
158
- const labels = wrapper . findAll ( DeclarationGroup ) ;
158
+ const labels = wrapper . findAll ( DeclarationList ) ;
159
159
expect ( labels . length ) . toBe ( declarations . length ) ;
160
160
expect ( labels . at ( 0 ) . props ( 'shouldCaption' ) ) . toBe ( true ) ;
161
161
expect ( labels . at ( 1 ) . props ( 'shouldCaption' ) ) . toBe ( true ) ;
162
162
} ) ;
163
163
164
- it ( 'renders a `DeclarationDiff` when there are API changes for current and previous' , ( ) => {
164
+ it ( 'renders a `DeclarationDiff` when there are API changes for current and previous and collapsed other declaration list ' , ( ) => {
165
165
// no DeclarationDiff if no changes
166
166
expect ( wrapper . find ( DeclarationDiff ) . exists ( ) ) . toBe ( false ) ;
167
167
// there is no `.changed` class applied by default
@@ -191,9 +191,14 @@ describe('Declaration', () => {
191
191
} ) ;
192
192
expect ( declarationDiff . classes ( ) ) . toContain ( 'changed' ) ;
193
193
expect ( declarationDiff . classes ( ) ) . toContain ( 'changed-modified' ) ;
194
+
195
+ wrapper . setProps ( {
196
+ declListExpanded : true ,
197
+ } ) ;
198
+ expect ( wrapper . find ( DeclarationDiff ) . exists ( ) ) . toBe ( false ) ;
194
199
} ) ;
195
200
196
- it ( 'renders a `DeclarationGroup ` for `added` change type' , ( ) => {
201
+ it ( 'renders a `DeclarationList ` for `added` change type' , ( ) => {
197
202
const provide = provideFactory ( {
198
203
[ identifier ] : {
199
204
change : ChangeTypes . added ,
@@ -210,14 +215,14 @@ describe('Declaration', () => {
210
215
211
216
expect ( wrapper . find ( DeclarationDiff ) . exists ( ) ) . toBe ( false ) ;
212
217
213
- const declarationGroup = wrapper . find ( DeclarationGroup ) ;
214
- expect ( declarationGroup . props ( 'changeType' ) ) . toBe ( ChangeTypes . added ) ;
215
- expect ( declarationGroup . props ( 'declaration' ) ) . toBe ( propsData . declarations [ 0 ] ) ;
216
- expect ( declarationGroup . classes ( ) ) . toContain ( 'changed' ) ;
217
- expect ( declarationGroup . classes ( ) ) . toContain ( 'changed-added' ) ;
218
+ const declarationList = wrapper . find ( DeclarationList ) ;
219
+ expect ( declarationList . props ( 'changeType' ) ) . toBe ( ChangeTypes . added ) ;
220
+ expect ( declarationList . props ( 'declaration' ) ) . toBe ( propsData . declarations [ 0 ] ) ;
221
+ expect ( declarationList . classes ( ) ) . toContain ( 'changed' ) ;
222
+ expect ( declarationList . classes ( ) ) . toContain ( 'changed-added' ) ;
218
223
} ) ;
219
224
220
- it ( 'renders a `DeclarationGroup ` for `deprecated` change type' , ( ) => {
225
+ it ( 'renders a `DeclarationList ` for `deprecated` change type' , ( ) => {
221
226
const provide = provideFactory ( {
222
227
[ identifier ] : {
223
228
change : ChangeTypes . deprecated ,
@@ -234,11 +239,11 @@ describe('Declaration', () => {
234
239
235
240
expect ( wrapper . find ( DeclarationDiff ) . exists ( ) ) . toBe ( false ) ;
236
241
237
- const declarationGroup = wrapper . find ( DeclarationGroup ) ;
238
- expect ( declarationGroup . props ( 'changeType' ) ) . toBe ( ChangeTypes . deprecated ) ;
239
- expect ( declarationGroup . props ( 'declaration' ) ) . toBe ( propsData . declarations [ 0 ] ) ;
240
- expect ( declarationGroup . classes ( ) ) . toContain ( 'changed' ) ;
241
- expect ( declarationGroup . classes ( ) ) . toContain ( 'changed-deprecated' ) ;
242
+ const declarationList = wrapper . find ( DeclarationList ) ;
243
+ expect ( declarationList . props ( 'changeType' ) ) . toBe ( ChangeTypes . deprecated ) ;
244
+ expect ( declarationList . props ( 'declaration' ) ) . toBe ( propsData . declarations [ 0 ] ) ;
245
+ expect ( declarationList . classes ( ) ) . toContain ( 'changed' ) ;
246
+ expect ( declarationList . classes ( ) ) . toContain ( 'changed-deprecated' ) ;
242
247
} ) ;
243
248
244
249
it ( 'applies only `added` type change class if no declarations are present in the diff ' , ( ) => {
@@ -255,10 +260,10 @@ describe('Declaration', () => {
255
260
256
261
expect ( wrapper . find ( DeclarationDiff ) . exists ( ) ) . toBe ( false ) ;
257
262
258
- const declarationGroup = wrapper . find ( DeclarationGroup ) ;
259
- expect ( declarationGroup . props ( 'changeType' ) ) . toBe ( ChangeTypes . added ) ;
260
- expect ( declarationGroup . props ( 'declaration' ) ) . toBe ( propsData . declarations [ 0 ] ) ;
261
- expect ( declarationGroup . classes ( ) ) . toContain ( 'changed' ) ;
262
- expect ( declarationGroup . classes ( ) ) . toContain ( 'changed-added' ) ;
263
+ const declarationList = wrapper . find ( DeclarationList ) ;
264
+ expect ( declarationList . props ( 'changeType' ) ) . toBe ( ChangeTypes . added ) ;
265
+ expect ( declarationList . props ( 'declaration' ) ) . toBe ( propsData . declarations [ 0 ] ) ;
266
+ expect ( declarationList . classes ( ) ) . toContain ( 'changed' ) ;
267
+ expect ( declarationList . classes ( ) ) . toContain ( 'changed-added' ) ;
263
268
} ) ;
264
269
} ) ;
0 commit comments