[Serverless] Make project header component handle chrome visibility changes (#162746)

## Summary
Closes https://github.com/elastic/kibana/issues/160834

This PR fixes a bug with the Dashboard app in serverless projects. The
Dashboard has a "Full screen" button that is intended to cause the
content area of the dashboard take up the entire viewport. To do this,
the dashboard app uses a chrome service to update an observable used in
the rendering of the header, which sets the layout to a "chromeless"
state. The bug is: in serverless, the project header must respect the
chromeless state.

### Testing

1. Run `yarn es snapshot` in one terminal and then `yarn serverless` in
another terminal.
2. Load sample data through the "Integrations" app, which can be found
in Global Search.
3. View a sample data dashboard, and use the `Full screen` button in the
app menu toolbar.

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

---------

Co-authored-by: Christiane (Tina) Heiligers <christiane.heiligers@elastic.co>
This commit is contained in:
Tim Sullivan 2023-08-02 14:08:30 -07:00 committed by GitHub
parent d8078b625d
commit 2c6fd26f5e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 119 additions and 105 deletions

View file

@ -73,8 +73,12 @@ const createHistoryMock = (): jest.Mocked<History> => {
};
};
const createInternalStartContractMock = (): jest.Mocked<InternalApplicationStart> => {
const currentAppId$ = new Subject<string | undefined>();
const createInternalStartContractMock = (
currentAppId?: string
): jest.Mocked<InternalApplicationStart> => {
const currentAppId$ = currentAppId
? new BehaviorSubject<string | undefined>(currentAppId)
: new Subject<string | undefined>();
return {
applications$: new BehaviorSubject<Map<string, PublicAppInfo>>(new Map()),