@@ -142,6 +142,28 @@ describe('Nimble number field', () => {
142
142
expect ( directive . requiredVisible ) . toBeTrue ( ) ;
143
143
expect ( nativeElement . requiredVisible ) . toBeTrue ( ) ;
144
144
} ) ;
145
+
146
+ it ( 'has expected defaults for appearanceReadOnly' , ( ) => {
147
+ expect ( directive . appearanceReadOnly ) . toBeFalse ( ) ;
148
+ expect ( nativeElement . appearanceReadOnly ) . toBeFalse ( ) ;
149
+ } ) ;
150
+
151
+ it ( 'can use the directive to set appearanceReadOnly' , ( ) => {
152
+ directive . appearanceReadOnly = true ;
153
+ expect ( directive . appearanceReadOnly ) . toBeTrue ( ) ;
154
+ expect ( nativeElement . appearanceReadOnly ) . toBeTrue ( ) ;
155
+ } ) ;
156
+
157
+ it ( 'has expected defaults for fullBleed' , ( ) => {
158
+ expect ( directive . fullBleed ) . toBeFalse ( ) ;
159
+ expect ( nativeElement . fullBleed ) . toBeFalse ( ) ;
160
+ } ) ;
161
+
162
+ it ( 'can use the directive to set fullBleed' , ( ) => {
163
+ directive . fullBleed = true ;
164
+ expect ( directive . fullBleed ) . toBeTrue ( ) ;
165
+ expect ( nativeElement . fullBleed ) . toBeTrue ( ) ;
166
+ } ) ;
145
167
} ) ;
146
168
147
169
describe ( 'with template string values' , ( ) => {
@@ -158,6 +180,8 @@ describe('Nimble number field', () => {
158
180
error-text="error text"
159
181
error-visible
160
182
required-visible
183
+ appearance-readonly
184
+ full-bleed
161
185
>
162
186
</nimble-number-field>`
163
187
} )
@@ -230,6 +254,16 @@ describe('Nimble number field', () => {
230
254
expect ( directive . requiredVisible ) . toBeTrue ( ) ;
231
255
expect ( nativeElement . requiredVisible ) . toBeTrue ( ) ;
232
256
} ) ;
257
+
258
+ it ( 'will use template string values for appearanceReadOnly' , ( ) => {
259
+ expect ( directive . appearanceReadOnly ) . toBeTrue ( ) ;
260
+ expect ( nativeElement . appearanceReadOnly ) . toBeTrue ( ) ;
261
+ } ) ;
262
+
263
+ it ( 'will use template string values for fullBleed' , ( ) => {
264
+ expect ( directive . fullBleed ) . toBeTrue ( ) ;
265
+ expect ( nativeElement . fullBleed ) . toBeTrue ( ) ;
266
+ } ) ;
233
267
} ) ;
234
268
235
269
describe ( 'with property bound values' , ( ) => {
@@ -246,6 +280,8 @@ describe('Nimble number field', () => {
246
280
[error-text]="errorText"
247
281
[error-visible]="errorVisible"
248
282
[required-visible]="requiredVisible"
283
+ [appearance-readonly]="appearanceReadOnly"
284
+ [full-bleed]="fullBleed"
249
285
>
250
286
</nimble-number-field>`
251
287
} )
@@ -262,6 +298,8 @@ describe('Nimble number field', () => {
262
298
public errorText = 'initial value' ;
263
299
public errorVisible = false ;
264
300
public requiredVisible = false ;
301
+ public appearanceReadOnly = false ;
302
+ public fullBleed = false ;
265
303
}
266
304
267
305
let fixture : ComponentFixture < TestHostComponent > ;
@@ -388,6 +426,28 @@ describe('Nimble number field', () => {
388
426
expect ( directive . requiredVisible ) . toBeTrue ( ) ;
389
427
expect ( nativeElement . requiredVisible ) . toBeTrue ( ) ;
390
428
} ) ;
429
+
430
+ it ( 'can be configured with property binding for appearanceReadOnly' , ( ) => {
431
+ expect ( directive . appearanceReadOnly ) . toBeFalse ( ) ;
432
+ expect ( nativeElement . appearanceReadOnly ) . toBeFalse ( ) ;
433
+
434
+ fixture . componentInstance . appearanceReadOnly = true ;
435
+ fixture . detectChanges ( ) ;
436
+
437
+ expect ( directive . appearanceReadOnly ) . toBeTrue ( ) ;
438
+ expect ( nativeElement . appearanceReadOnly ) . toBeTrue ( ) ;
439
+ } ) ;
440
+
441
+ it ( 'can be configured with property binding for fullBleed' , ( ) => {
442
+ expect ( directive . fullBleed ) . toBeFalse ( ) ;
443
+ expect ( nativeElement . fullBleed ) . toBeFalse ( ) ;
444
+
445
+ fixture . componentInstance . fullBleed = true ;
446
+ fixture . detectChanges ( ) ;
447
+
448
+ expect ( directive . fullBleed ) . toBeTrue ( ) ;
449
+ expect ( nativeElement . fullBleed ) . toBeTrue ( ) ;
450
+ } ) ;
391
451
} ) ;
392
452
393
453
describe ( 'with attribute bound values' , ( ) => {
@@ -404,6 +464,8 @@ describe('Nimble number field', () => {
404
464
[attr.error-text]="errorText"
405
465
[attr.error-visible]="errorVisible"
406
466
[attr.required-visible]="requiredVisible"
467
+ [attr.appearance-readonly]="appearanceReadOnly"
468
+ [attr.full-bleed]="fullBleed"
407
469
>
408
470
</nimble-number-field>`
409
471
} )
@@ -420,6 +482,8 @@ describe('Nimble number field', () => {
420
482
public errorText = 'initial value' ;
421
483
public errorVisible : BooleanValueOrAttribute = null ;
422
484
public requiredVisible : BooleanValueOrAttribute = null ;
485
+ public appearanceReadOnly : BooleanValueOrAttribute = null ;
486
+ public fullBleed : BooleanValueOrAttribute = null ;
423
487
}
424
488
425
489
let fixture : ComponentFixture < TestHostComponent > ;
@@ -546,5 +610,27 @@ describe('Nimble number field', () => {
546
610
expect ( directive . requiredVisible ) . toBeTrue ( ) ;
547
611
expect ( nativeElement . requiredVisible ) . toBeTrue ( ) ;
548
612
} ) ;
613
+
614
+ it ( 'can be configured with attribute binding for appearanceReadOnly' , ( ) => {
615
+ expect ( directive . appearanceReadOnly ) . toBeFalse ( ) ;
616
+ expect ( nativeElement . appearanceReadOnly ) . toBeFalse ( ) ;
617
+
618
+ fixture . componentInstance . appearanceReadOnly = '' ;
619
+ fixture . detectChanges ( ) ;
620
+
621
+ expect ( directive . appearanceReadOnly ) . toBeTrue ( ) ;
622
+ expect ( nativeElement . appearanceReadOnly ) . toBeTrue ( ) ;
623
+ } ) ;
624
+
625
+ it ( 'can be configured with attribute binding for fullBleed' , ( ) => {
626
+ expect ( directive . fullBleed ) . toBeFalse ( ) ;
627
+ expect ( nativeElement . fullBleed ) . toBeFalse ( ) ;
628
+
629
+ fixture . componentInstance . fullBleed = '' ;
630
+ fixture . detectChanges ( ) ;
631
+
632
+ expect ( directive . fullBleed ) . toBeTrue ( ) ;
633
+ expect ( nativeElement . fullBleed ) . toBeTrue ( ) ;
634
+ } ) ;
549
635
} ) ;
550
636
} ) ;
0 commit comments