Skip to content

Commit

Permalink
Use real appBasePath in legacy AppService shim (elastic#51353)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshdover authored and timductive committed Dec 16, 2019
1 parent 039ebcc commit 1e120fe
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/legacy/ui/public/new_platform/new_platform.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
*/

import { setRootControllerMock } from './new_platform.test.mocks';
import { legacyAppRegister, __reset__ } from './new_platform';
import { legacyAppRegister, __reset__, __setup__ } from './new_platform';
import { coreMock } from '../../../../core/public/mocks';

describe('ui/new_platform', () => {
describe('legacyAppRegister', () => {
beforeEach(() => {
setRootControllerMock.mockReset();
__reset__();
__setup__(coreMock.createSetup({ basePath: '/test/base/path' }) as any, {} as any);
});

const registerApp = () => {
Expand Down Expand Up @@ -59,7 +61,7 @@ describe('ui/new_platform', () => {
controller(scopeMock, elementMock);
expect(mountMock).toHaveBeenCalledWith(expect.any(Object), {
element: elementMock[0],
appBasePath: '',
appBasePath: '/test/base/path/app/test',
});
});

Expand Down
5 changes: 4 additions & 1 deletion src/legacy/ui/public/new_platform/new_platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,10 @@ export const legacyAppRegister = (app: App) => {

// Root controller cannot return a Promise so use an internal async function and call it immediately
(async () => {
const unmount = await app.mount({ core: npStart.core }, { element, appBasePath: '' });
const unmount = await app.mount(
{ core: npStart.core },
{ element, appBasePath: npSetup.core.http.basePath.prepend(`/app/${app.id}`) }
);
$scope.$on('$destroy', () => {
unmount();
});
Expand Down

0 comments on commit 1e120fe

Please sign in to comment.