@@ -19,7 +19,7 @@ import DeclarationSourceLink
1919
2020const {
2121 ConditionalConstraints,
22- DeclarationGroup ,
22+ DeclarationList ,
2323} = Declaration . components ;
2424
2525const { ChangeTypes } = Declaration . constants ;
@@ -72,14 +72,14 @@ describe('Declaration', () => {
7272 expect ( wrapper . is ( 'section.declaration' ) ) . toBe ( true ) ;
7373 } ) ;
7474
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 ) ;
7979 } ) ;
8080
81- it ( 'renders a `DeclarationGroup `' , ( ) => {
82- const group = wrapper . find ( DeclarationGroup ) ;
81+ it ( 'renders a `DeclarationList `' , ( ) => {
82+ const group = wrapper . find ( DeclarationList ) ;
8383 expect ( group . exists ( ) ) . toBe ( true ) ;
8484 expect ( group . props ( 'declaration' ) ) . toEqual ( propsData . declarations [ 0 ] ) ;
8585 expect ( group . props ( ) ) . toHaveProperty ( 'declListExpanded' , false ) ;
@@ -155,13 +155,13 @@ describe('Declaration', () => {
155155
156156 wrapper . setProps ( { declarations } ) ;
157157
158- const labels = wrapper . findAll ( DeclarationGroup ) ;
158+ const labels = wrapper . findAll ( DeclarationList ) ;
159159 expect ( labels . length ) . toBe ( declarations . length ) ;
160160 expect ( labels . at ( 0 ) . props ( 'shouldCaption' ) ) . toBe ( true ) ;
161161 expect ( labels . at ( 1 ) . props ( 'shouldCaption' ) ) . toBe ( true ) ;
162162 } ) ;
163163
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 ' , ( ) => {
165165 // no DeclarationDiff if no changes
166166 expect ( wrapper . find ( DeclarationDiff ) . exists ( ) ) . toBe ( false ) ;
167167 // there is no `.changed` class applied by default
@@ -191,9 +191,14 @@ describe('Declaration', () => {
191191 } ) ;
192192 expect ( declarationDiff . classes ( ) ) . toContain ( 'changed' ) ;
193193 expect ( declarationDiff . classes ( ) ) . toContain ( 'changed-modified' ) ;
194+
195+ wrapper . setProps ( {
196+ declListExpanded : true ,
197+ } ) ;
198+ expect ( wrapper . find ( DeclarationDiff ) . exists ( ) ) . toBe ( false ) ;
194199 } ) ;
195200
196- it ( 'renders a `DeclarationGroup ` for `added` change type' , ( ) => {
201+ it ( 'renders a `DeclarationList ` for `added` change type' , ( ) => {
197202 const provide = provideFactory ( {
198203 [ identifier ] : {
199204 change : ChangeTypes . added ,
@@ -210,14 +215,14 @@ describe('Declaration', () => {
210215
211216 expect ( wrapper . find ( DeclarationDiff ) . exists ( ) ) . toBe ( false ) ;
212217
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' ) ;
218223 } ) ;
219224
220- it ( 'renders a `DeclarationGroup ` for `deprecated` change type' , ( ) => {
225+ it ( 'renders a `DeclarationList ` for `deprecated` change type' , ( ) => {
221226 const provide = provideFactory ( {
222227 [ identifier ] : {
223228 change : ChangeTypes . deprecated ,
@@ -234,11 +239,11 @@ describe('Declaration', () => {
234239
235240 expect ( wrapper . find ( DeclarationDiff ) . exists ( ) ) . toBe ( false ) ;
236241
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' ) ;
242247 } ) ;
243248
244249 it ( 'applies only `added` type change class if no declarations are present in the diff ' , ( ) => {
@@ -255,10 +260,10 @@ describe('Declaration', () => {
255260
256261 expect ( wrapper . find ( DeclarationDiff ) . exists ( ) ) . toBe ( false ) ;
257262
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' ) ;
263268 } ) ;
264269} ) ;
0 commit comments