diff --git a/src/timepicker/timepicker.spec.ts b/src/timepicker/timepicker.spec.ts index a694dc6924..d7bac28546 100644 --- a/src/timepicker/timepicker.spec.ts +++ b/src/timepicker/timepicker.spec.ts @@ -637,6 +637,30 @@ describe('ngb-timepicker', () => { expect(fixture.componentInstance.model).toBeNull(); }); + + it('should not submit form when spinners clicked', async(() => { + const html = `
`; + + const fixture = createTestComponent(html); + const compiled = fixture.nativeElement; + const buttons = getButtons(compiled); + const button = buttons[0] as HTMLButtonElement; + + fixture.detectChanges(); + fixture.whenStable() + .then(() => { + fixture.detectChanges(); + return fixture.whenStable(); + }) + .then(() => { + button.click(); + fixture.detectChanges(); + return fixture.whenStable(); + }) + .then(() => { expect(fixture.componentInstance.submitted).toBeFalsy(); }); + })); }); describe('disabled', () => { @@ -838,4 +862,7 @@ class TestComponent { disabled = true; readonly = true; form = new FormGroup({control: new FormControl('', Validators.required)}); + submitted = false; + + onSubmit() { this.submitted = true; } } diff --git a/src/timepicker/timepicker.ts b/src/timepicker/timepicker.ts index 01fd3d9b74..8a9a420602 100644 --- a/src/timepicker/timepicker.ts +++ b/src/timepicker/timepicker.ts @@ -50,14 +50,14 @@ const NGB_TIMEPICKER_VALUE_ACCESSOR = {- |
-
@@ -65,7 +65,7 @@ const NGB_TIMEPICKER_VALUE_ACCESSOR = {
|
-
@@ -97,20 +97,20 @@ const NGB_TIMEPICKER_VALUE_ACCESSOR = {
| |
-
+
|
| |
- |
-
@@ -118,7 +118,7 @@ const NGB_TIMEPICKER_VALUE_ACCESSOR = {
|
-
| |