Admin: Keeps expired api keys visible in table after delete (#31636)

* Admin: Keeps expired keys visible in table after delete

* Chore: covers component in tests before refactor

* Refactor: splitting up into smaller components

* Chore: fixes a small issue with the validation

* Chore: forgot to export type
This commit is contained in:
Hugo Häggmark
2021-03-04 13:20:38 +01:00
committed by GitHub
parent a1e227638c
commit e87d48921e
14 changed files with 546 additions and 537 deletions

View File

@@ -3,6 +3,8 @@ import '@testing-library/jest-dom';
import { render, screen } from '@testing-library/react';
import { within } from '@testing-library/dom';
import userEvent from '@testing-library/user-event';
import { selectors } from '@grafana/e2e-selectors';
import { LinksSettings } from './LinksSettings';
describe('LinksSettings', () => {
@@ -61,7 +63,9 @@ describe('LinksSettings', () => {
render(<LinksSettings dashboard={linklessDashboard} />);
expect(screen.getByRole('heading', { name: 'Dashboard Links' })).toBeInTheDocument();
expect(screen.getByLabelText('Call to action button Add Dashboard Link')).toBeInTheDocument();
expect(
screen.getByLabelText(selectors.components.CallToActionCard.button('Add Dashboard Link'))
).toBeInTheDocument();
expect(screen.queryByRole('table')).not.toBeInTheDocument();
});
@@ -72,7 +76,9 @@ describe('LinksSettings', () => {
const tableBodyRows = within(screen.getAllByRole('rowgroup')[1]).getAllByRole('row');
expect(tableBodyRows.length).toBe(links.length);
expect(screen.queryByLabelText('Call to action button Add Dashboard Link')).not.toBeInTheDocument();
expect(
screen.queryByLabelText(selectors.components.CallToActionCard.button('Add Dashboard Link'))
).not.toBeInTheDocument();
});
test('it rearranges the order of dashboard links', () => {