Skip to content
This repository was archived by the owner on Apr 30, 2018. It is now read-only.

Commit 4cda5a3

Browse files
Caleb KniffenKent C. Dodds
authored andcommitted
fix(apiCheck): fieldOptionsApiShape now allows setting 'boolean' property on an ngModelAttrs definition
Fixes #451
1 parent fdf5cae commit 4cda5a3

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

src/providers/formlyApiCheck.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,11 @@ const fieldOptionsApiShape = {
136136
hideExpression: formlyExpression.optional,
137137
ngModelElAttrs: apiCheck.objectOf(apiCheck.string).optional,
138138
ngModelAttrs: apiCheck.objectOf(apiCheck.shape({
139-
expression: apiCheck.shape.ifNot(['value', 'attribute', 'bound'], apiCheck.any).optional,
139+
expression: apiCheck.shape.ifNot(['value', 'attribute', 'bound', 'boolean'], apiCheck.any).optional,
140140
value: apiCheck.shape.ifNot('expression', apiCheck.any).optional,
141141
attribute: apiCheck.shape.ifNot('expression', apiCheck.any).optional,
142-
bound: apiCheck.shape.ifNot('expression', apiCheck.any).optional
142+
bound: apiCheck.shape.ifNot('expression', apiCheck.any).optional,
143+
boolean: apiCheck.shape.ifNot('expression', apiCheck.any).optional
143144
}).strict).optional,
144145
elementAttributes: apiCheck.objectOf(apiCheck.string).optional,
145146
optionsTypes: apiCheck.typeOrArrayOf(apiCheck.string).optional,

src/providers/formlyApiCheck.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ describe('formlyApiCheck', () => {
3131
key: 'whatevs'
3232
}, 'formlyFieldOptions');
3333
});
34+
35+
describe('ngModelAttrs', () => {
36+
it(`should allow property of 'boolean'`, () => {
37+
expectPass({
38+
template: 'hello',
39+
key: 'whatevs',
40+
templateOptions: {
41+
foo: 'bar'
42+
},
43+
ngModelAttrs: {
44+
foo: {
45+
boolean: 'foo-bar'
46+
}
47+
}
48+
}, 'formlyFieldOptions');
49+
});
50+
});
3451
});
3552

3653
describe(`fieldGroup`, () => {

0 commit comments

Comments
 (0)