From 05b3541fa365feb73eb7412e9c3c25509a23db59 Mon Sep 17 00:00:00 2001 From: Eli Perelman Date: Tue, 5 Nov 2019 15:52:18 -0500 Subject: [PATCH] Add additional test for app chrome hidden versus chrome visibility --- src/core/public/chrome/chrome_service.test.ts | 22 +++++++++++++++++++ src/core/public/chrome/chrome_service.tsx | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/core/public/chrome/chrome_service.test.ts b/src/core/public/chrome/chrome_service.test.ts index e1f8431f047724e..4c3ddc2930f33c4 100644 --- a/src/core/public/chrome/chrome_service.test.ts +++ b/src/core/public/chrome/chrome_service.test.ts @@ -230,6 +230,28 @@ describe('start', () => { ] `); }); + + it('changing visibility has no effect on chrome-hiding application', async () => { + const startDeps = defaultStartDeps([new FakeApp('alpha', true)]); + const { currentAppId$ } = startDeps.application; + const { chrome, service } = await start({ startDeps }); + const promise = chrome + .getIsVisible$() + .pipe(toArray()) + .toPromise(); + + currentAppId$.next('alpha'); + chrome.setIsVisible(true); + service.stop(); + + await expect(promise).resolves.toMatchInlineSnapshot(` + Array [ + true, + false, + false, + ] + `); + }); }); describe('is collapsed', () => { diff --git a/src/core/public/chrome/chrome_service.tsx b/src/core/public/chrome/chrome_service.tsx index 217cb57e5cb946d..067e6cf8f77ef68 100644 --- a/src/core/public/chrome/chrome_service.tsx +++ b/src/core/public/chrome/chrome_service.tsx @@ -96,7 +96,7 @@ export class ChromeService { }: StartDeps): Promise { /** * These observables allow consumers to toggle the chrome visibility via either: - * 1. Using setIsVisible() to trigger the next hide$ + * 1. Using setIsVisible() to trigger the next chromeHidden$ * 2. Setting `chromeHidden` when registering an application, which will * reset the visibility whenever the next application is mounted * 3. Having embed=true in the query string