Skip to content

Commit 902d8ca

Browse files
committed
Changed constant OnChange to onChange.
Changed some tests where accessing properties would not give intelisense (with atom-typescript it causes error). Fixed typo.
1 parent 22cbf46 commit 902d8ca

6 files changed

Lines changed: 43 additions & 43 deletions

File tree

lib/src/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export const consts = {
22
globalFormValidationId: "_GLOBAL_FORM_",
3-
defaultFilter: { OnChange: true }
3+
defaultFilter: { onChange: true }
44
}

lib/src/spec/baseFormValidation.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ describe('formValidation tests', () => {
353353
const addFieldValidation = sinon.stub(ValidationEngine.prototype, 'addFieldValidation', () => { });
354354
const validation1 = () => new FieldValidationResult();
355355
const customParams = { foo: 'bar' };
356-
const eventsFilter = { OnBlur: true };
356+
const eventsFilter = { onBlur: true };
357357
const validationConstraints: ValidationConstraints = {
358358
fields: {
359359
property1: [

lib/src/spec/fieldValidationEventFilter.spec.ts

Lines changed: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,42 @@ import { fieldValidationEventFilter } from '../fieldValidationEventFilter'
44
describe('FieldValidationEventFilter ', () => {
55

66
describe('when calling filter ', () => {
7-
it('should returns new Array<FieldValidation> having only one elmenent matching the eventsFilter {OnChange: true} ' +
8-
'when passing a list of validations containg only one Element and having OnChange true for that element', () => {
7+
it('should returns new Array<FieldValidation> having only one element matching the eventsFilter {onChange: true} ' +
8+
'when passing a list of validations containg only one Element and having onChange true for that element', () => {
99
//Arrange
1010
const allValidations: FieldValidation[] = [
1111
{
1212
validationFn: (vm, value) => { return null },
13-
eventsFilter: { OnChange: true },
13+
eventsFilter: { onChange: true },
1414
customParams: {}
1515
}
1616
];
1717

18-
const eventFilter = { OnChange: true };
18+
const eventFilter = { onChange: true };
1919

2020
//Act
2121
const result = fieldValidationEventFilter.filter(allValidations, eventFilter);
2222

2323
//Assert
2424
expect(result.length).to.be.equal(1);
25-
expect(result[0].eventsFilter.OnChange).to.be.true;
25+
expect(result[0].eventsFilter).to.have.property('onChange').that.is.true;
2626
});
2727

2828
});
2929

3030
describe('when calling filter ', () => {
31-
it('should returns new Array<FieldValidation> having zero elmenent matching the eventsFilter {OnBlur: true} ' +
32-
'when passing a list of validations containg only one Element and having OnChange true for that element', () => {
31+
it('should returns new Array<FieldValidation> having zero elements matching the eventsFilter {onBlur: true} ' +
32+
'when passing a list of validations containg only one Element and having onChange true for that element', () => {
3333
//Arrange
3434
const allValidations: Array<FieldValidation> = [
3535
{
3636
validationFn: (vm, value) => { return null },
37-
eventsFilter: { OnChange: true },
37+
eventsFilter: { onChange: true },
3838
customParams: {}
3939
}
4040
];
4141

42-
const eventsFilter = { OnBlur: true };
42+
const eventsFilter = { onBlur: true };
4343

4444
//Act
4545
const result = fieldValidationEventFilter.filter(allValidations, eventsFilter);
@@ -51,84 +51,84 @@ describe('FieldValidationEventFilter ', () => {
5151

5252
describe('FieldValidationEventFilter ', () => {
5353
describe('when calling filter ', () => {
54-
it('should returns new Array<FieldValidation> having only one elmenent matching the eventsFilter {OnChange: true} ' +
55-
'when passing a list of validations containg two elements, one OnChange the other OnBlur', () => {
54+
it('should returns new Array<FieldValidation> having only one element matching the eventsFilter {onChange: true} ' +
55+
'when passing a list of validations containg two elements, one onChange the other onBlur', () => {
5656
//Arrange
5757
const allValidations: Array<FieldValidation> = [
5858
{
5959
validationFn: (vm, value) => { return null },
60-
eventsFilter: { OnChange: true },
60+
eventsFilter: { onChange: true },
6161
customParams: {}
6262
},
6363
{
6464
validationFn: (vm, value) => { return null },
65-
eventsFilter: { OnBlur: true },
65+
eventsFilter: { onBlur: true },
6666
customParams: {}
6767
}
6868
];
6969

70-
const eventsFilter = { OnChange: true };
70+
const eventsFilter = { onChange: true };
7171

7272
//Act
7373
const result = fieldValidationEventFilter.filter(allValidations, eventsFilter);
7474

7575
//Assert
7676
expect(result.length).to.be.equal(1);
77-
expect(result[0].eventsFilter.OnChange).to.be.true;
77+
expect(result[0].eventsFilter).to.have.property('onChange').that.is.true;
7878
});
7979
});
8080
});
8181

8282
describe('FieldValidationEventFilter ', () => {
8383
describe('when calling filter ', () => {
84-
it('should returns new Array<FieldValidation> having two elements matching the eventsFilter {OnChange: true} ' +
85-
'when passing a list of validations containg three elements, two OnChange the other OnBlur', () => {
84+
it('should returns new Array<FieldValidation> having two elements matching the eventsFilter {onChange: true} ' +
85+
'when passing a list of validations containg three elements, two onChange the other onBlur', () => {
8686
//Arrange
8787
const allValidations: Array<FieldValidation> = [
8888
{
8989
validationFn: (vm, value) => { return null },
90-
eventsFilter: { OnChange: true },
90+
eventsFilter: { onChange: true },
9191
customParams: {}
9292
},
9393
{
9494
validationFn: (vm, value) => { return null },
95-
eventsFilter: { OnBlur: true },
95+
eventsFilter: { onBlur: true },
9696
customParams: {}
9797
},
9898
{
9999
validationFn: (vm, value) => { return null },
100-
eventsFilter: { OnChange: true },
100+
eventsFilter: { onChange: true },
101101
customParams: {}
102102
}
103103
];
104104

105-
const eventsFilter = { OnChange: true };
105+
const eventsFilter = { onChange: true };
106106

107107
//Act
108108
const result = fieldValidationEventFilter.filter(allValidations, eventsFilter);
109109

110110
//Assert
111111
expect(result.length).to.be.equal(2);
112-
expect(result[0].eventsFilter.OnChange).to.be.true;
113-
expect(result[1].eventsFilter.OnChange).to.be.true;
112+
expect(result[0].eventsFilter).to.have.property('onChange').that.is.true;
113+
expect(result[1].eventsFilter).to.have.property('onChange').that.is.true;
114114
});
115115
});
116116
});
117117

118118
describe('FieldValidationEventFilter ', () => {
119119
describe('when calling filter ', () => {
120-
it('should returns new Array<FieldValidation> having two elements matching the eventsFilter {OnChange: true, OnBlur: true} (OR) ' +
121-
'when passing a list of validations containg three elements, one OnChange the other OnBlur, the other OnWhatever', () => {
120+
it('should returns new Array<FieldValidation> having two elements matching the eventsFilter {onChange: true, onBlur: true} (OR) ' +
121+
'when passing a list of validations containg three elements, one onChange the other onBlur, the other OnWhatever', () => {
122122
//Arrange
123123
const allValidations: Array<FieldValidation> = [
124124
{
125125
validationFn: (vm, value) => { return null },
126-
eventsFilter: { OnChange: true },
126+
eventsFilter: { onChange: true },
127127
customParams: {}
128128
},
129129
{
130130
validationFn: (vm, value) => { return null },
131-
eventsFilter: { OnBlur: true },
131+
eventsFilter: { onBlur: true },
132132
customParams: {}
133133
},
134134
{
@@ -138,33 +138,33 @@ describe('FieldValidationEventFilter ', () => {
138138
}
139139
];
140140

141-
const eventsFilter = { OnChange: true, OnBlur: true };
141+
const eventsFilter = { onChange: true, onBlur: true };
142142

143143
//Act
144144
const result = fieldValidationEventFilter.filter(allValidations, eventsFilter);
145145

146146
//Assert
147147
expect(result.length).to.be.equal(2);
148-
expect(result[0].eventsFilter.OnChange).to.be.true;
149-
expect(result[1].eventsFilter.OnBlur).to.be.true;
148+
expect(result[0].eventsFilter).to.have.property('onChange').that.is.true;
149+
expect(result[1].eventsFilter).to.have.property('onBlur').that.is.true;
150150
});
151151
});
152152
});
153153

154154
describe('FieldValidationEventFilter ', () => {
155155
describe('when calling filter ', () => {
156156
it('should returns new Array<FieldValidation> having three elements matching the eventsFilter null ' +
157-
'when passing a list of validations containg three elements, one OnChange the other OnBlur, the other OnWhatever', () => {
157+
'when passing a list of validations containg three elements, one onChange the other onBlur, the other OnWhatever', () => {
158158
//Arrange
159159
const allValidations: Array<FieldValidation> = [
160160
{
161161
validationFn: (vm, value) => { return null },
162-
eventsFilter: { OnChange: true },
162+
eventsFilter: { onChange: true },
163163
customParams: {}
164164
},
165165
{
166166
validationFn: (vm, value) => { return null },
167-
eventsFilter: { OnBlur: true },
167+
eventsFilter: { onBlur: true },
168168
customParams: {}
169169
},
170170
{
@@ -181,9 +181,9 @@ describe('FieldValidationEventFilter ', () => {
181181

182182
//Assert
183183
expect(result.length).to.be.equal(3);
184-
expect(result[0].eventsFilter.OnChange).to.be.true;
185-
expect(result[1].eventsFilter.OnBlur).to.be.true;
186-
expect(result[2].eventsFilter.OnWhatever).to.be.true;
184+
expect(result[0].eventsFilter).to.have.property('onChange').that.is.true;
185+
expect(result[1].eventsFilter).to.have.property('onBlur').that.is.true;
186+
expect(result[2].eventsFilter).to.have.property('OnWhatever').that.is.true;
187187
});
188188
});
189189
});

lib/src/spec/validationEngineValidateForm.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,8 @@ describe('ValidationEngine Validate Form', () => {
480480
const vm = { fullname: '' };
481481

482482
// Act
483-
validationEngine.addFieldValidation('fullname', validationFn1Spy, { OnChange: true, OnBlur: true });
484-
validationEngine.addFieldValidation('fullname', validationFn2Spy, { OnBlur: true });
483+
validationEngine.addFieldValidation('fullname', validationFn1Spy, { onChange: true, onBlur: true });
484+
validationEngine.addFieldValidation('fullname', validationFn2Spy, { onBlur: true });
485485
validationEngine.validateForm(vm).then((validationResult) => {
486486

487487
// Assert

samples/react/01 SignupForm/src/components/sampleSignupForm/sampleSignupForm.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export class SampleSignupForm extends React.Component<Props, {}> {
3535
this.applyFieldValidation(event);
3636
}}
3737
onBlur={(event) => {
38-
this.applyFieldValidation(event, { OnBlur: true });
38+
this.applyFieldValidation(event, { onBlur: true });
3939
}}
4040
error={(this.props.errors.login) ? this.props.errors.login.errorMessage : ''} />
4141

samples/react/01 SignupForm/src/components/sampleSignupForm/validations/signupFormValidation.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ const signupValidationConstraints: ValidationConstraints = {
4949
login: [
5050
{
5151
validator: Validators.required,
52-
eventsFilter: { OnChange: true, OnBlur: true },
52+
eventsFilter: { onChange: true, onBlur: true },
5353
},
5454
{
5555
validator: loginExistOnGitHubValidationHandler,
56-
eventsFilter: { OnBlur: true }
56+
eventsFilter: { onBlur: true }
5757
},
5858
]
5959
}

0 commit comments

Comments
 (0)