@@ -40,7 +40,7 @@ describe('IntlTelInputComponent', () => {
40
40
} ) ;
41
41
42
42
it ( 'should convert phone number to E164 format' , ( ) => {
43
- component . options . set ( {
43
+ fixture . componentRef . setInput ( 'options' , {
44
44
preferredCountries : [ 'ch' ] ,
45
45
onlyCountries : [ 'ch' , 'fr' ]
46
46
} ) ;
@@ -52,7 +52,7 @@ describe('IntlTelInputComponent', () => {
52
52
} ) ;
53
53
54
54
it ( 'should re-set E164 phone number on countryChange' , ( ) => {
55
- component . options . set ( {
55
+ fixture . componentRef . setInput ( 'options' , {
56
56
preferredCountries : [ 'ch' ] ,
57
57
onlyCountries : [ 'ch' , 'fr' ]
58
58
} ) ;
@@ -70,7 +70,7 @@ describe('IntlTelInputComponent', () => {
70
70
71
71
it ( 'should add a label tag if label attribute is set' , ( ) => {
72
72
const labelText = 'label text' ;
73
- component . label . set ( labelText ) ;
73
+ fixture . componentRef . setInput ( 'label' , labelText ) ;
74
74
fixture . detectChanges ( ) ;
75
75
76
76
const element = fixture
@@ -91,7 +91,7 @@ describe('IntlTelInputComponent', () => {
91
91
} ) ;
92
92
93
93
it ( 'should not have a css class by default for the label' , ( ) => {
94
- component . label . set ( 'label' ) ;
94
+ fixture . componentRef . setInput ( 'label' , 'label' ) ;
95
95
fixture . detectChanges ( ) ;
96
96
97
97
const element = fixture
@@ -103,8 +103,8 @@ describe('IntlTelInputComponent', () => {
103
103
} ) ;
104
104
105
105
it ( 'should be possible to specify a css class for the label' , ( ) => {
106
- component . label . set ( 'label' ) ;
107
- component . labelCssClass . set ( 'label-css-class ') ;
106
+ fixture . componentRef . setInput ( 'label' , 'label' ) ;
107
+ fixture . componentRef . setInput ( 'labelCssClass' , 'labelCssClass ') ;
108
108
fixture . detectChanges ( ) ;
109
109
110
110
const element = fixture
@@ -116,7 +116,8 @@ describe('IntlTelInputComponent', () => {
116
116
} ) ;
117
117
118
118
it ( 'should set both required and aria-required if specified' , ( ) => {
119
- component . required . set ( true ) ;
119
+ fixture . componentRef . setInput ( 'required' , true ) ;
120
+
120
121
fixture . detectChanges ( ) ;
121
122
122
123
const element : HTMLElement = fixture
@@ -139,21 +140,22 @@ describe('IntlTelInputComponent', () => {
139
140
} ) ;
140
141
141
142
it ( 'should set name and id to the same value' , ( ) => {
142
- component . name . set ( 'custom-name' ) ;
143
+ fixture . componentRef . setInput ( 'name' , 'custom-name' ) ;
143
144
fixture . detectChanges ( ) ;
144
145
145
146
const element : HTMLElement = fixture
146
147
. debugElement
147
148
. query ( By . css ( 'input' ) )
148
149
. nativeElement ;
149
- console . log ( component . name ( ) ) ;
150
+
150
151
expect ( element . getAttribute ( 'name' ) ) . toBe ( component . name ( ) ) ;
151
152
expect ( element . getAttribute ( 'name' ) ) . toBe ( element . getAttribute ( 'id' ) ) ;
152
153
} ) ;
153
154
154
155
it ( 'should allow specifying a css class' , ( ) => {
155
156
const cssClass = 'my-css-class' ;
156
- component . cssClass . set ( cssClass ) ;
157
+ fixture . componentRef . setInput ( 'cssClass' , cssClass ) ;
158
+
157
159
fixture . detectChanges ( ) ;
158
160
159
161
const element : HTMLElement = fixture
@@ -165,16 +167,14 @@ console.log(component.name());
165
167
} ) ;
166
168
167
169
it ( 'should be possible to set preferredCountries option' , ( ) => {
168
- component . options . set ( {
170
+ fixture . componentRef . setInput ( 'options' , {
169
171
countrySearch : false ,
170
172
preferredCountries : [ 'ch' ] ,
171
173
onlyCountries : [ 'ch' ]
172
174
} ) ;
173
175
component . ngAfterViewInit ( ) ;
174
-
175
176
fixture . detectChanges ( ) ;
176
- console . log ( fixture
177
- . debugElement ) ;
177
+
178
178
const element = fixture
179
179
. debugElement
180
180
. query ( By . css ( '#intl-tel-input-name' ) )
@@ -187,7 +187,7 @@ console.log(fixture
187
187
188
188
it ( 'should be possible to set i18n option' , ( ) => {
189
189
const localizedCountryName = 'Suisse' ;
190
- component . options . set ( {
190
+ fixture . componentRef . setInput ( 'options' , {
191
191
preferredCountries : [ 'ch' ] ,
192
192
i18n : { ch : localizedCountryName } ,
193
193
onlyCountries : [ 'ch' ]
0 commit comments