Skip to content

Commit

Permalink
Merge branch 'master' into testMapUserImportGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
kibanamachine authored Feb 3, 2021
2 parents ad13cf6 + 7fbcf68 commit 7d987ae
Show file tree
Hide file tree
Showing 57 changed files with 3,266 additions and 2,124 deletions.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@
"@types/mime": "^2.0.1",
"@types/mime-types": "^2.1.0",
"@types/minimatch": "^2.0.29",
"@types/mocha": "^7.0.2",
"@types/mocha": "^8.2.0",
"@types/mock-fs": "^4.10.0",
"@types/moment-timezone": "^0.5.12",
"@types/mustache": "^0.8.31",
Expand Down Expand Up @@ -731,10 +731,10 @@
"micromatch": "3.1.10",
"minimist": "^1.2.5",
"mkdirp": "0.5.1",
"mocha": "^7.1.1",
"mocha-junit-reporter": "^1.23.1",
"mochawesome": "^4.1.0",
"mochawesome-merge": "^4.1.0",
"mocha": "^8.2.1",
"mocha-junit-reporter": "^2.0.0",
"mochawesome": "^6.2.1",
"mochawesome-merge": "^4.2.0",
"mock-fs": "^4.12.0",
"mock-http-server": "1.3.0",
"ms-chromium-edge-driver": "^0.2.3",
Expand Down
1,709 changes: 862 additions & 847 deletions packages/kbn-pm/dist/index.js

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,11 @@ describe('failure hooks', function () {
it('runs and prints expected output', () => {
const proc = spawnSync(process.execPath, [SCRIPT, '--config', FAILURE_HOOKS_CONFIG]);
const lines = stripAnsi(proc.stdout.toString('utf8')).split(/\r?\n/);
const linesCopy = [...lines];

const tests = [
{
flag: '$FAILING_BEFORE_HOOK$',
flag: '"before all" hook: $FAILING_BEFORE_HOOK$',
assert(lines) {
expect(lines.shift()).toMatch(/info\s+testHookFailure\s+\$FAILING_BEFORE_ERROR\$/);
expect(lines.shift()).toMatch(
Expand All @@ -30,15 +32,15 @@ describe('failure hooks', function () {
},
},
{
flag: '$FAILING_TEST$',
flag: '└-> $FAILING_TEST$',
assert(lines) {
expect(lines.shift()).toMatch(/global before each/);
expect(lines.shift()).toMatch(/info\s+testFailure\s+\$FAILING_TEST_ERROR\$/);
expect(lines.shift()).toMatch(/info\s+testFailureAfterDelay\s+\$FAILING_TEST_ERROR\$/);
},
},
{
flag: '$FAILING_AFTER_HOOK$',
flag: '"after all" hook: $FAILING_AFTER_HOOK$',
assert(lines) {
expect(lines.shift()).toMatch(/info\s+testHookFailure\s+\$FAILING_AFTER_ERROR\$/);
expect(lines.shift()).toMatch(
Expand All @@ -48,14 +50,19 @@ describe('failure hooks', function () {
},
];

while (lines.length && tests.length) {
const line = lines.shift();
if (line.includes(tests[0].flag)) {
const test = tests.shift();
test.assert(lines);
try {
while (lines.length && tests.length) {
const line = lines.shift();
if (line.includes(tests[0].flag)) {
const test = tests.shift();
test.assert(lines);
}
}
}

expect(tests).toHaveLength(0);
expect(tests).toHaveLength(0);
} catch (error) {
console.error('full log output', linesCopy.join('\n'));
throw error;
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ it('only runs hooks of parents and tests in level1a', async () => {
"suite: ",
"suite: level 1",
"suite: level 1 level 1a",
"hook: \\"before each\\" hook: rootBeforeEach",
"hook: level 1 \\"before each\\" hook: level1BeforeEach",
"hook: \\"before each\\" hook: rootBeforeEach for \\"test 1a\\"",
"hook: level 1 \\"before each\\" hook: level1BeforeEach for \\"test 1a\\"",
"test: level 1 level 1a test 1a",
]
`);
Expand All @@ -108,8 +108,8 @@ it('only runs hooks of parents and tests in level1b', async () => {
"suite: ",
"suite: level 1",
"suite: level 1 level 1b",
"hook: \\"before each\\" hook: rootBeforeEach",
"hook: level 1 \\"before each\\" hook: level1BeforeEach",
"hook: \\"before each\\" hook: rootBeforeEach for \\"test 1b\\"",
"hook: level 1 \\"before each\\" hook: level1BeforeEach for \\"test 1b\\"",
"test: level 1 level 1b test 1b",
]
`);
Expand All @@ -127,12 +127,12 @@ it('only runs hooks of parents and tests in level1a and level1b', async () => {
"suite: ",
"suite: level 1",
"suite: level 1 level 1a",
"hook: \\"before each\\" hook: rootBeforeEach",
"hook: level 1 \\"before each\\" hook: level1BeforeEach",
"hook: \\"before each\\" hook: rootBeforeEach for \\"test 1a\\"",
"hook: level 1 \\"before each\\" hook: level1BeforeEach for \\"test 1a\\"",
"test: level 1 level 1a test 1a",
"suite: level 1 level 1b",
"hook: \\"before each\\" hook: rootBeforeEach",
"hook: level 1 \\"before each\\" hook: level1BeforeEach",
"hook: \\"before each\\" hook: rootBeforeEach for \\"test 1b\\"",
"hook: level 1 \\"before each\\" hook: level1BeforeEach for \\"test 1b\\"",
"test: level 1 level 1b test 1b",
]
`);
Expand All @@ -151,8 +151,8 @@ it('only runs level1a if including level1 and excluding level1b', async () => {
"suite: ",
"suite: level 1",
"suite: level 1 level 1a",
"hook: \\"before each\\" hook: rootBeforeEach",
"hook: level 1 \\"before each\\" hook: level1BeforeEach",
"hook: \\"before each\\" hook: rootBeforeEach for \\"test 1a\\"",
"hook: level 1 \\"before each\\" hook: level1BeforeEach for \\"test 1a\\"",
"test: level 1 level 1a test 1a",
]
`);
Expand All @@ -171,8 +171,8 @@ it('only runs level1b if including level1 and excluding level1a', async () => {
"suite: ",
"suite: level 1",
"suite: level 1 level 1b",
"hook: \\"before each\\" hook: rootBeforeEach",
"hook: level 1 \\"before each\\" hook: level1BeforeEach",
"hook: \\"before each\\" hook: rootBeforeEach for \\"test 1b\\"",
"hook: level 1 \\"before each\\" hook: level1BeforeEach for \\"test 1b\\"",
"test: level 1 level 1b test 1b",
]
`);
Expand All @@ -190,7 +190,7 @@ it('only runs level2 if excluding level1', async () => {
"suite: ",
"suite: level 2",
"suite: level 2 level 2a",
"hook: \\"before each\\" hook: rootBeforeEach",
"hook: \\"before each\\" hook: rootBeforeEach for \\"test 2a\\"",
"test: level 2 level 2a test 2a",
]
`);
Expand Down
8 changes: 0 additions & 8 deletions packages/kbn-ui-shared-deps/flot_charts/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* and the Server Side Public License, v 1; you may not use this file except in
* compliance with, at your election, the Elastic License or the Server Side
* Public License, v 1.
*/

/* @notice
*
* This product includes code that is based on flot-charts, which was available
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions src/core/public/chrome/ui/header/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,18 @@
display: none;
}
}

.header__breadcrumbsWithExtensionContainer {
overflow: hidden; // enables text-ellipsis in the last breadcrumb
.euiHeaderBreadcrumbs {
// stop breadcrumbs from growing.
// this makes the extension appear right next to the last breadcrumb
flex-grow: 0;
margin-right: 0;

overflow: hidden; // enables text-ellipsis in the last breadcrumb
}
}
.header__breadcrumbsAppendExtension {
flex-grow: 1;
}
19 changes: 19 additions & 0 deletions src/core/public/chrome/ui/header/header.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { StubBrowserStorage, mountWithIntl } from '@kbn/test/jest';
import { httpServiceMock } from '../../../http/http_service.mock';
import { applicationServiceMock } from '../../../mocks';
import { Header } from './header';
import { ChromeBreadcrumbsAppendExtension } from '../../chrome_service';

jest.mock('@elastic/eui/lib/services/accessibility/html_id_generator', () => ({
htmlIdGenerator: () => () => 'mockId',
Expand Down Expand Up @@ -71,6 +72,9 @@ describe('Header', () => {
const recentlyAccessed$ = new BehaviorSubject([
{ link: '', label: 'dashboard', id: 'dashboard' },
]);
const breadcrumbsAppendExtension$ = new BehaviorSubject<
undefined | ChromeBreadcrumbsAppendExtension
>(undefined);
const component = mountWithIntl(
<Header
{...mockProps()}
Expand All @@ -80,6 +84,7 @@ describe('Header', () => {
recentlyAccessed$={recentlyAccessed$}
isLocked$={isLocked$}
customNavLink$={customNavLink$}
breadcrumbsAppendExtension$={breadcrumbsAppendExtension$}
/>
);
expect(component.find('EuiHeader').exists()).toBeFalsy();
Expand All @@ -93,5 +98,19 @@ describe('Header', () => {
component.update();
expect(component.find('nav[aria-label="Primary"]').exists()).toBeTruthy();
expect(component).toMatchSnapshot();

act(() =>
breadcrumbsAppendExtension$.next({
content: (root: HTMLDivElement) => {
root.innerHTML = '<div class="my-extension">__render__</div>';
return () => (root.innerHTML = '');
},
})
);
component.update();
expect(component.find('HeaderExtension').exists()).toBeTruthy();
expect(
component.find('HeaderExtension').getDOMNode().querySelector('.my-extension')
).toBeTruthy();
});
});
30 changes: 25 additions & 5 deletions src/core/public/chrome/ui/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
*/

import {
EuiFlexGroup,
EuiHeader,
EuiHeaderSection,
EuiHeaderSectionItem,
Expand Down Expand Up @@ -40,6 +41,7 @@ import { HeaderHelpMenu } from './header_help_menu';
import { HeaderLogo } from './header_logo';
import { HeaderNavControls } from './header_nav_controls';
import { HeaderActionMenu } from './header_action_menu';
import { HeaderExtension } from './header_extension';

export interface HeaderProps {
kibanaVersion: string;
Expand Down Expand Up @@ -73,11 +75,13 @@ export function Header({
basePath,
onIsLockedUpdate,
homeHref,
breadcrumbsAppendExtension$,
...observables
}: HeaderProps) {
const isVisible = useObservable(observables.isVisible$, false);
const isLocked = useObservable(observables.isLocked$, false);
const [isNavOpen, setIsNavOpen] = useState(false);
const breadcrumbsAppendExtension = useObservable(breadcrumbsAppendExtension$);

if (!isVisible) {
return <LoadingIndicator loadingCount$={observables.loadingCount$} showAsBar />;
Expand All @@ -87,6 +91,10 @@ export function Header({
const navId = htmlIdGenerator()();
const className = classnames('hide-for-sharing', 'headerGlobalNav');

const Breadcrumbs = (
<HeaderBreadcrumbs appTitle$={observables.appTitle$} breadcrumbs$={observables.breadcrumbs$} />
);

return (
<>
<header className={className} data-test-subj="headerGlobalNav">
Expand Down Expand Up @@ -157,11 +165,23 @@ export function Header({
<HeaderNavControls side="left" navControls$={observables.navControlsLeft$} />
</EuiHeaderSection>

<HeaderBreadcrumbs
appTitle$={observables.appTitle$}
breadcrumbs$={observables.breadcrumbs$}
breadcrumbsAppendExtension$={observables.breadcrumbsAppendExtension$}
/>
{!breadcrumbsAppendExtension ? (
Breadcrumbs
) : (
<EuiFlexGroup
responsive={false}
wrap={false}
alignItems={'center'}
className={'header__breadcrumbsWithExtensionContainer'}
gutterSize={'none'}
>
{Breadcrumbs}
<HeaderExtension
extension={breadcrumbsAppendExtension.content}
containerClassName={'header__breadcrumbsAppendExtension'}
/>
</EuiFlexGroup>
)}

<HeaderBadge badge$={observables.badge$} />

Expand Down
Loading

0 comments on commit 7d987ae

Please sign in to comment.