mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Loki Context UI: Do not disable last label (#62866)
* improved text * prevent all labels removed * use `structuredClone` instead of lodash * update test * get `structuredClone` in test? * fix using structuredClone
This commit is contained in:
@@ -15,6 +15,20 @@ jest.mock('@grafana/runtime', () => ({
|
||||
}));
|
||||
|
||||
describe('LokiContextUi', () => {
|
||||
const savedGlobal = global;
|
||||
beforeAll(() => {
|
||||
// TODO: `structuredClone` is not yet in jsdom https://github.com/jsdom/jsdom/issues/3363
|
||||
if (!(global as any).structuredClone) {
|
||||
(global as any).structuredClone = function structuredClone(objectToClone: any) {
|
||||
const stringified = JSON.stringify(objectToClone);
|
||||
const parsed = JSON.parse(stringified);
|
||||
return parsed;
|
||||
};
|
||||
}
|
||||
});
|
||||
afterAll(() => {
|
||||
global = savedGlobal;
|
||||
});
|
||||
const setupProps = (): LokiContextUiProps => {
|
||||
const mockLanguageProvider = {
|
||||
start: jest.fn().mockImplementation(() => Promise.resolve()),
|
||||
@@ -66,7 +80,7 @@ describe('LokiContextUi', () => {
|
||||
render(<LokiContextUi {...props} />);
|
||||
|
||||
// Initial set of labels is available and not selected
|
||||
expect(await screen.findByText(/Select labels to include in the context query/)).toBeInTheDocument();
|
||||
expect(await screen.findByText(/Select labels to be included in the context query/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it('starts the languageProvider', async () => {
|
||||
|
||||
Reference in New Issue
Block a user