From: Stephan Müller Date: Tue, 30 Jul 2019 15:56:38 +0000 (+0200) Subject: mgr/dashboard: Refactoring X-Git-Tag: v15.1.0~1665^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F29402%2Fhead;p=ceph.git mgr/dashboard: Refactoring 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 --- 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 33416d099259..faf48936bcfb 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 5c795dcaab55..20605b028f9d 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) {