From a1e81bb28e497d18388d0aea8693b1ca20e07a2d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stephan=20M=C3=BCller?= Date: Tue, 30 Jul 2019 17:56:38 +0200 Subject: [PATCH] mgr/dashboard: Refactoring MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit I came across a yoda case and a test case that didn't use 'done' while using an async call. Fixes: https://tracker.ceph.com/issues/40828 Signed-off-by: Stephan Müller --- .../critical-confirmation-modal.component.spec.ts | 3 ++- .../mgr/dashboard/frontend/src/testing/unit-test-helper.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts index 33416d09925..faf48936bcf 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts @@ -117,7 +117,7 @@ describe('CriticalConfirmationModalComponent', () => { expect(component).toBeTruthy(); }); - it('should focus the checkbox form field', () => { + it('should focus the checkbox form field', (done) => { fixture.detectChanges(); fixture.whenStable().then(() => { const focused = fixture.debugElement.query(By.css(':focus')); @@ -125,6 +125,7 @@ describe('CriticalConfirmationModalComponent', () => { expect(focused.attributes.type).toBe('checkbox'); const element = document.getElementById('confirmation'); expect(element === document.activeElement).toBeTruthy(); + done(); }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts b/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts index 5c795dcaab5..20605b028f9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts +++ b/src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts @@ -229,7 +229,7 @@ export class FixtureHelper { * Expect a specific element to be visible or not. */ expectElementVisible(css: string, visibility: boolean) { - expect(Boolean(this.getElementByCss(css))).toBe(visibility); + expect(visibility).toBe(Boolean(this.getElementByCss(css))); } expectFormFieldToBe(css: string, value: string) { -- 2.39.5