]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Refactoring 29402/head
authorStephan Müller <smueller@suse.com>
Tue, 30 Jul 2019 15:56:38 +0000 (17:56 +0200)
committerStephan Müller <smueller@suse.com>
Wed, 4 Sep 2019 14:22:33 +0000 (16:22 +0200)
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 <smueller@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/shared/components/critical-confirmation-modal/critical-confirmation-modal.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/testing/unit-test-helper.ts

index 33416d0992591f9c88269b68ef018f1a709e8829..faf48936bcfbcfdaf9a8545b7e57fad66c310296 100644 (file)
@@ -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();
     });
   });
 
index 5c795dcaab554c9c3b8f637fb4e890e1fdaeebdd..20605b028f9de1f6211dea09b16d0d94b189bd70 100644 (file)
@@ -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) {