@@ -27,10 +27,10 @@ describe('Select Component', () => {
27
27
const selectionOptions = [
28
28
{ label : 'first' , value : 'first-value' } ,
29
29
{ label : 'second' , value : 'second-value' } ,
30
- { label : 'third' , value : 'third-value' }
30
+ { label : 'third' , value : 'third-value' , selectedLabel : 'Third Value!!!' }
31
31
] ;
32
32
33
- test ( 'should display intial selection' , fakeAsync ( ( ) => {
33
+ test ( 'should display initial selection' , fakeAsync ( ( ) => {
34
34
spectator = hostFactory (
35
35
`
36
36
<ht-select [selected]="selected">
@@ -127,7 +127,7 @@ describe('Select Component', () => {
127
127
spectator = hostFactory (
128
128
`
129
129
<ht-select [selected]="selected" (selectedChange)="onChange($event)">
130
- <ht-select-option *ngFor="let option of options" [label]="option.label" [value]="option.value">
130
+ <ht-select-option *ngFor="let option of options" [label]="option.label" [value]="option.value" [selectedLabel]="option.selectedLabel" >
131
131
</ht-select-option>
132
132
</ht-select>` ,
133
133
{
@@ -140,14 +140,15 @@ describe('Select Component', () => {
140
140
) ;
141
141
142
142
spectator . tick ( ) ;
143
+ expect ( spectator . query ( '.trigger-content' ) ) . toHaveText ( selectionOptions [ 1 ] . label ) ;
143
144
spectator . click ( '.trigger-content' ) ;
144
145
145
146
const optionElements = spectator . queryAll ( '.select-option' , { root : true } ) ;
146
147
spectator . click ( optionElements [ 2 ] ) ;
147
148
148
149
expect ( onChange ) . toHaveBeenCalledTimes ( 1 ) ;
149
150
expect ( onChange ) . toHaveBeenCalledWith ( selectionOptions [ 2 ] . value ) ;
150
- expect ( spectator . element ) . toHaveText ( selectionOptions [ 2 ] . label ) ;
151
+ expect ( spectator . query ( '.trigger-content' ) ) . toHaveText ( selectionOptions [ 2 ] . selectedLabel ! ) ;
151
152
flush ( ) ;
152
153
} ) ) ;
153
154
0 commit comments