Replace SidebarContext with versioned provider and hook.
Signed-off-by: Eric Peterson <ericpeterson@spotify.com>
This commit is contained in:
@@ -20,7 +20,7 @@ import { ShortcutItem } from './ShortcutItem';
|
||||
import { Shortcut } from './types';
|
||||
import { LocalStoredShortcuts } from './api';
|
||||
import { MockStorageApi, renderInTestApp } from '@backstage/test-utils';
|
||||
import { SidebarContext } from '@backstage/core-components';
|
||||
import { SidebarContextProvider } from '@backstage/core-components';
|
||||
|
||||
describe('ShortcutItem', () => {
|
||||
const shortcut: Shortcut = {
|
||||
@@ -32,9 +32,9 @@ describe('ShortcutItem', () => {
|
||||
|
||||
it('displays the shortcut', async () => {
|
||||
await renderInTestApp(
|
||||
<SidebarContext.Provider value={{ isOpen: true, setOpen: _open => {} }}>
|
||||
<SidebarContextProvider value={{ isOpen: true, setOpen: _open => {} }}>
|
||||
<ShortcutItem api={api} shortcut={shortcut} />
|
||||
</SidebarContext.Provider>,
|
||||
</SidebarContextProvider>,
|
||||
);
|
||||
expect(screen.getByText('ST')).toBeInTheDocument();
|
||||
expect(screen.getByText('some title')).toBeInTheDocument();
|
||||
|
||||
@@ -24,12 +24,12 @@ import { screen, waitFor } from '@testing-library/react';
|
||||
import { Shortcuts } from './Shortcuts';
|
||||
import { LocalStoredShortcuts, shortcutsApiRef } from './api';
|
||||
|
||||
import { SidebarContext } from '@backstage/core-components';
|
||||
import { SidebarContextProvider } from '@backstage/core-components';
|
||||
|
||||
describe('Shortcuts', () => {
|
||||
it('displays an add button', async () => {
|
||||
await renderInTestApp(
|
||||
<SidebarContext.Provider value={{ isOpen: true, setOpen: _open => {} }}>
|
||||
<SidebarContextProvider value={{ isOpen: true, setOpen: _open => {} }}>
|
||||
<TestApiProvider
|
||||
apis={[
|
||||
[
|
||||
@@ -40,7 +40,7 @@ describe('Shortcuts', () => {
|
||||
>
|
||||
<Shortcuts />
|
||||
</TestApiProvider>
|
||||
</SidebarContext.Provider>,
|
||||
</SidebarContextProvider>,
|
||||
);
|
||||
await waitFor(() => !screen.queryByTestId('progress'));
|
||||
expect(screen.getByText('Add Shortcuts')).toBeInTheDocument();
|
||||
|
||||
Reference in New Issue
Block a user