Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit 3bcc552

Browse files
committed
changing test and switching validate function logic
1 parent 4cf53ab commit 3bcc552

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

source/components/form/form.tests.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ describe('FormComponent', (): void => {
2828
beforeEach((): void => {
2929
notification = { warning: sinon.spy() };
3030
formService = {};
31-
mockGuidService = { random: sinon.spy() };
31+
mockGuidService = { random: sinon.spy(() => { return '2979637a-1fc1-4c5e-bf9d-a89154342aba'}) };
3232

3333
form = new FormComponent(<any>notification, new AsyncHelper(), <any>formService, mockGuidService, null);
3434
form.form = <any>{
@@ -62,7 +62,7 @@ describe('FormComponent', (): void => {
6262
form = new FormComponent(<any>notification, new AsyncHelper(), <any>formService, mockGuidService, parentForm);
6363

6464
sinon.assert.calledOnce(addControlSpy);
65-
sinon.assert.calledWith(addControlSpy, '', form.form);
65+
sinon.assert.calledWith(addControlSpy, `form-${mockGuidService.random()}`, form.form);
6666
});
6767

6868
it('should reset the form', () => {

source/components/form/form.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ export class FormComponent {
7878
}
7979

8080
validate(): boolean {
81-
return !this.form.invalid;
81+
return this.form.valid;
8282
}
8383

8484
reset(): void {

0 commit comments

Comments
 (0)