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

Commit bb51c4d

Browse files
author
Kent C. Dodds
committed
Fixing #421
1 parent 41bd8b4 commit bb51c4d

File tree

3 files changed

+47
-1
lines changed

3 files changed

+47
-1
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 6.23.1
2+
3+
## Bug Fixes
4+
5+
- api-check wasn't allowing `skipNgModelAttrsManipulator` under the `extras` property. [#421](/../../issues/421)
6+
17
# 6.23.0
28

39
## New Features

src/providers/formlyApiCheck.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,10 @@ const fieldOptionsApiShape = {
103103
name: apiCheck.string.optional,
104104
expressionProperties: expressionProperties.optional,
105105
extras: apiCheck.shape({
106-
validateOnModelChange: apiCheck.bool.optional
106+
validateOnModelChange: apiCheck.bool.optional,
107+
skipNgModelAttrsManipulator: apiCheck.oneOfType([
108+
apiCheck.string, apiCheck.bool
109+
]).optional
107110
}).strict.optional,
108111
data: apiCheck.object.optional,
109112
templateOptions: apiCheck.object.optional,

src/providers/formlyApiCheck.test.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,46 @@ describe('formlyApiCheck', () => {
4242
});
4343
});
4444

45+
describe(`extras`, () => {
46+
describe(`skipNgModelAttrsManipulator`, () => {
47+
it(`should pass with a boolean`, () => {
48+
expectPass({
49+
template: 'foo',
50+
extras: {skipNgModelAttrsManipulator: true}
51+
}, 'formlyFieldOptions');
52+
});
53+
54+
it(`should pass with a string`, () => {
55+
expectPass({
56+
template: 'foo',
57+
extras: {skipNgModelAttrsManipulator: '.selector'}
58+
}, 'formlyFieldOptions');
59+
});
60+
61+
it(`should pass with nothing`, () => {
62+
expectPass({
63+
template: 'foo',
64+
extras: {skipNgModelAttrsManipulator: '.selector'}
65+
}, 'formlyFieldOptions');
66+
});
67+
68+
it(`should fail with anything else`, () => {
69+
expectFail({
70+
template: 'foo',
71+
extras: {skipNgModelAttrsManipulator: 32}
72+
}, 'formlyFieldOptions');
73+
});
74+
});
75+
});
76+
4577
function expectPass(options, checker) {
4678
const result = formlyApiCheck[checker](options);
4779
expect(result).to.be.undefined;
4880
}
4981

82+
function expectFail(options, checker) {
83+
const result = formlyApiCheck[checker](options);
84+
expect(result).to.be.an.instanceOf(Error);
85+
}
86+
5087
});

0 commit comments

Comments
 (0)