Skip to content

Commit

Permalink
Clear core loading indicator just before UI is rendered (elastic#55242)
Browse files Browse the repository at this point in the history
Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
  • Loading branch information
joshdover and elasticmachine committed Jan 21, 2020
1 parent c556cee commit 1ff2951
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
7 changes: 3 additions & 4 deletions src/core/public/core_system.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,15 +429,14 @@ describe('Notifications targetDomElement', () => {
rootDomElement,
});

let targetDomElementParentInStart: HTMLElement | null;
let targetDomElementInStart: HTMLElement | null;
MockNotificationsService.start.mockImplementation(({ targetDomElement }): any => {
expect(targetDomElement.parentElement).not.toBeNull();
targetDomElementParentInStart = targetDomElement.parentElement;
targetDomElementInStart = targetDomElement;
});

// Starting the core system should pass the targetDomElement as a child of the rootDomElement
await core.setup();
await core.start();
expect(targetDomElementParentInStart!).toBe(rootDomElement);
expect(targetDomElementInStart!.parentElement).toBe(rootDomElement);
});
});
15 changes: 8 additions & 7 deletions src/core/public/core_system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,13 +222,6 @@ export class CoreSystem {
const notificationsTargetDomElement = document.createElement('div');
const overlayTargetDomElement = document.createElement('div');

// ensure the rootDomElement is empty
this.rootDomElement.textContent = '';
this.rootDomElement.classList.add('coreSystemRootDomElement');
this.rootDomElement.appendChild(coreUiTargetDomElement);
this.rootDomElement.appendChild(notificationsTargetDomElement);
this.rootDomElement.appendChild(overlayTargetDomElement);

const overlays = this.overlay.start({
i18n,
targetDomElement: overlayTargetDomElement,
Expand Down Expand Up @@ -276,6 +269,14 @@ export class CoreSystem {
};

const plugins = await this.plugins.start(core);

// ensure the rootDomElement is empty
this.rootDomElement.textContent = '';
this.rootDomElement.classList.add('coreSystemRootDomElement');
this.rootDomElement.appendChild(coreUiTargetDomElement);
this.rootDomElement.appendChild(notificationsTargetDomElement);
this.rootDomElement.appendChild(overlayTargetDomElement);

const rendering = this.rendering.start({
application,
chrome,
Expand Down

0 comments on commit 1ff2951

Please sign in to comment.