This repository was archived by the owner on Apr 30, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -1321,6 +1321,40 @@ describe('formly-field', function() {
1321
1321
} ) ;
1322
1322
1323
1323
describe ( `options.validation.errorExistsAndShouldBeVisible` , ( ) => {
1324
+ describe . skip ( `multiple ng-model elements` , ( ) => {
1325
+ beforeEach ( ( ) => {
1326
+ scope . fields = [
1327
+ {
1328
+ template : `
1329
+ <input ng-model="model[options.data.firstKey]" />
1330
+ <input ng-model="model[options.data.secondKey]" />
1331
+ ` ,
1332
+ // we'll just give it a validator that depends on a value we
1333
+ // can change in our tests
1334
+ validators : { foo : '!options.data.invalid' }
1335
+ }
1336
+ ] ;
1337
+ } ) ;
1338
+
1339
+ it ( `should set showError to true when one of them is invalid` , ( ) => {
1340
+ compileAndDigest ( ) ;
1341
+ expect ( field . validation . errorExistsAndShouldBeVisible , 'initially false' ) . to . be . false ;
1342
+ field . data . invalid = true ;
1343
+
1344
+ // force $touched and revalidation of both form controls
1345
+ field . formControl . forEach ( fc => {
1346
+ fc . $setTouched ( ) ;
1347
+ fc . $validate ( ) ;
1348
+ } ) ;
1349
+
1350
+ // redigest to set the showError prop
1351
+ scope . $digest ( ) ;
1352
+
1353
+ expect ( field . formControl [ 0 ] . $error . foo , '$error on the first formControl' ) . be . true ;
1354
+ expect ( field . validation . errorExistsAndShouldBeVisible , 'now true' ) . to . be . true ;
1355
+ } ) ;
1356
+ } ) ;
1357
+
1324
1358
describe ( `with custom errorExistsAndShouldBeVisible expression` , ( ) => {
1325
1359
beforeEach ( ( ) => {
1326
1360
scope . fields = [ getNewField ( { validators : { foo : 'false' } } ) ] ;
You can’t perform that action at this time.
0 commit comments