-
Notifications
You must be signed in to change notification settings - Fork 8.5k
Spaces -> Client to NP #54298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Spaces -> Client to NP #54298
Changes from 18 commits
d2883da
8c4516d
cce8d1f
890b685
e0ac89c
6c8c55d
33f04bd
f650303
25fcc60
0a4198f
295773c
1df82cf
5bdf2b9
925ceed
602b11e
03a122f
95d390e
73cc266
7350cfa
dca42cc
35b81ea
e038ff1
4399b59
d6ffb18
d45e63d
3f24902
9ebe560
6fac7e4
2a01095
25008da
cdf2c10
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| export const PAGE_TITLE_COMPONENT: string; | ||
| export const PAGE_SUBTITLE_COMPONENT: string; | ||
| export const PAGE_FOOTER_COMPONENT: string; | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -154,6 +154,9 @@ export const npSetup = { | |||||||||||||||
| }), | ||||||||||||||||
| }, | ||||||||||||||||
| }, | ||||||||||||||||
| spaces: { | ||||||||||||||||
|
||||||||||||||||
| #### What about karma tests? | |
| While our plan is to only provide first-class mocks for Jest tests, there are many legacy karma tests that cannot be quickly or easily converted to Jest -- particularly those which are still relying on mocking Angular services via `ngMock`. | |
| For these tests, we are maintaining a separate set of mocks. Files with a `.karma_mock.{js|ts|tsx}` extension will be loaded _globally_ before karma tests are run. | |
| It is important to note that this behavior is different from `jest.mock('ui/new_platform')`, which only mocks tests on an individual basis. If you encounter any failures in karma tests as a result of new platform migration efforts, you may need to add a `.karma_mock.js` file for the affected services, or add to the existing karma mock we are maintaining in `ui/new_platform`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: the LP spaces plugin runs its legacy.ts as part of a hack, so that it runs for all LP plugins. The goal of legacy.ts is to call the NP registerLegacyAPI, so that the plugin can finish its initialization. In the case of these Karma tests, we need the npSetup static import provided by new_platform.karma.mock to have the spaces plugin registered, so that legacy.ts can call registerLegacyAPI.
So an alternative to placing this here, is to place a guard within legacy.ts, to only call registerLegacyAPI if the spaces plugin is actually defined. What do you think about that approach?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So an alternative to placing this here, is to place a guard within legacy.ts, to only call registerLegacyAPI if the spaces plugin is actually defined. What do you think about that approach?
On the surface it sounds like a better workaround to me, do you have any concerns regarding it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And thanks for the explanation!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the surface it sounds like a better workaround to me, do you have any concerns regarding it?
None at all! Resolved in 3f24902
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| /* | ||
| * Licensed to Elasticsearch B.V. under one or more contributor | ||
| * license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright | ||
| * ownership. Elasticsearch B.V. licenses this file to you under | ||
| * the Apache License, Version 2.0 (the "License"); you may | ||
| * not use this file except in compliance with the License. | ||
| * You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, | ||
| * software distributed under the License is distributed on an | ||
| * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| * KIND, either express or implied. See the License for the | ||
| * specific language governing permissions and limitations | ||
| * under the License. | ||
| */ | ||
|
|
||
| import { featureCatalogueRegistryMock } from '../services/feature_catalogue/feature_catalogue_registry.mock'; | ||
| import { environmentServiceMock } from '../services/environment/environment.mock'; | ||
|
|
||
| const createSetupContract = () => ({ | ||
| featureCatalogue: featureCatalogueRegistryMock.createSetup(), | ||
| environment: environmentServiceMock.createSetup(), | ||
| }); | ||
|
|
||
| const createStartContract = () => ({ | ||
| featureCatalogue: featureCatalogueRegistryMock.createStart(), | ||
| environment: environmentServiceMock.createStart(), | ||
| }); | ||
|
|
||
| export const homePluginMock = { | ||
| createSetupContract, | ||
| createStartContract, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,10 +17,20 @@ | |
| * under the License. | ||
| */ | ||
|
|
||
| const createSetupContract = () => ({ | ||
|
||
| sections: { | ||
| register: jest.fn(), | ||
| getSection: jest.fn(), | ||
| getSectionsEnabled: jest.fn(), | ||
| getAllSections: jest.fn(), | ||
| }, | ||
| }); | ||
|
|
||
| const createStartContract = () => ({ | ||
| legacy: {}, | ||
| }); | ||
|
|
||
| export const managementPluginMock = { | ||
| createSetupContract, | ||
| createStartContract, | ||
| }; | ||
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,16 +1,4 @@ | ||
| // Import the EUI global scope so we can use EUI constants | ||
| @import 'src/legacy/ui/public/styles/_styling_constants'; | ||
|
|
||
| /* Spaces plugin styles */ | ||
|
|
||
| // Prefix all styles with "spc" to avoid conflicts. | ||
| // Examples | ||
| // spcChart | ||
| // spcChart__legend | ||
| // spcChart__legend--small | ||
| // spcChart__legend-isLoading | ||
|
|
||
| @import './management/index'; | ||
| @import './nav_control/index'; | ||
| @import './space_selector/index'; | ||
| @import './copy_saved_objects_to_space/index'; | ||
| @import '../../../../plugins/spaces/public/index'; |
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.