@@ -5,7 +5,7 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations';
5
5
import { MatExpansionModule , MatAccordion } from './index' ;
6
6
7
7
8
- describe ( 'CdkAccordion ' , ( ) => {
8
+ describe ( 'MatAccordion ' , ( ) => {
9
9
beforeEach ( async ( ( ) => {
10
10
TestBed . configureTestingModule ( {
11
11
imports : [
@@ -83,12 +83,39 @@ describe('CdkAccordion', () => {
83
83
fixture . detectChanges ( ) ;
84
84
expect ( panels [ 0 ] . classes [ 'mat-expanded' ] ) . toBeFalsy ( ) ;
85
85
expect ( panels [ 1 ] . classes [ 'mat-expanded' ] ) . toBeFalsy ( ) ;
86
+
87
+ } ) ;
88
+
89
+ it ( 'should correctly apply the displayMode provided' , ( ) => {
90
+ const fixture = TestBed . createComponent ( SetOfItems ) ;
91
+ const firstPanel = fixture . debugElement . queryAll ( By . css ( '.mat-expansion-panel' ) ) [ 0 ] ;
92
+
93
+ fixture . componentInstance . firstPanelExpanded = true ;
94
+ fixture . detectChanges ( ) ;
95
+ expect ( firstPanel . classes [ 'mat-expansion-panel-spacing' ] ) . toBeTruthy ( ) ;
96
+
97
+ fixture . componentInstance . displayMode = 'flat' ;
98
+ fixture . detectChanges ( ) ;
99
+ expect ( firstPanel . classes [ 'mat-expansion-panel-spacing' ] ) . toBeFalsy ( ) ;
100
+ } ) ;
101
+
102
+ it ( 'should correctly apply the togglePosition provided' , ( ) => {
103
+ const fixture = TestBed . createComponent ( SetOfItems ) ;
104
+ fixture . detectChanges ( ) ;
105
+ const firstPanelHeader =
106
+ fixture . debugElement . queryAll ( By . css ( '.mat-expansion-indicator-container' ) ) [ 0 ] ;
107
+
108
+ expect ( firstPanelHeader . classes [ 'mat-expansion-indicator-container-before' ] ) . toBeFalsy ( ) ;
109
+
110
+ fixture . componentInstance . togglePosition = 'before' ;
111
+ fixture . detectChanges ( ) ;
112
+ expect ( firstPanelHeader . classes [ 'mat-expansion-indicator-container-before' ] ) . toBeTruthy ( ) ;
86
113
} ) ;
87
114
} ) ;
88
115
89
116
90
117
@Component ( { template : `
91
- <mat-accordion [multi]="multi">
118
+ <mat-accordion [multi]="multi" [displayMode]="displayMode" [togglePosition]="togglePosition" >
92
119
<mat-expansion-panel [expanded]="firstPanelExpanded">
93
120
<mat-expansion-panel-header>Summary</mat-expansion-panel-header>
94
121
<p>Content</p>
@@ -102,6 +129,8 @@ class SetOfItems {
102
129
@ViewChild ( MatAccordion ) accordion : MatAccordion ;
103
130
104
131
multi : boolean = false ;
132
+ displayMode = 'default' ;
133
+ togglePosition = 'after' ;
105
134
firstPanelExpanded : boolean = false ;
106
135
secondPanelExpanded : boolean = false ;
107
136
secondPanelDisabled : boolean = false ;
0 commit comments