Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
AngularMigration: Allow dashboard by dashboard migration (#84100)
- Loading branch information
1 parent
1ffeb7c
commit e5d1cd8
Showing
10 changed files
with
275 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
public/app/features/plugins/angularDeprecation/AngularMigrationNotice.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { render, screen } from '@testing-library/react'; | ||
import userEvent from '@testing-library/user-event'; | ||
import React from 'react'; | ||
|
||
import { AngularMigrationNotice } from './AngularMigrationNotice'; | ||
|
||
jest.mock('@grafana/runtime', () => ({ | ||
...jest.requireActual('@grafana/runtime'), | ||
})); | ||
|
||
describe('AngularMigrationNotice', () => { | ||
const noticeText = | ||
/This dashboard was migrated from Angular. Please make sure everything is behaving as expected and save and refresh this dashboard to persist the migration./i; | ||
const dsUid = 'abc'; | ||
|
||
afterAll(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
}); | ||
|
||
it('should render', () => { | ||
render(<AngularMigrationNotice dashboardUid={dsUid} />); | ||
expect(screen.getByText(noticeText)).toBeInTheDocument(); | ||
}); | ||
|
||
it('should be dismissable', async () => { | ||
render(<AngularMigrationNotice dashboardUid={dsUid} />); | ||
const closeButton = screen.getByRole('button', { name: /Close alert/i }); | ||
expect(closeButton).toBeInTheDocument(); | ||
await userEvent.click(closeButton); | ||
expect(screen.queryByText(noticeText)).not.toBeInTheDocument(); | ||
}); | ||
|
||
describe('Migration alert buttons', () => { | ||
it('should display the "Revert migration" button', () => { | ||
render(<AngularMigrationNotice dashboardUid={dsUid} />); | ||
const revertMigrationButton = screen.getByRole('button', { name: /Revert migration/i }); | ||
expect(revertMigrationButton).toBeInTheDocument(); | ||
}); | ||
|
||
it('should display the "Report issue" button', () => { | ||
render(<AngularMigrationNotice dashboardUid={dsUid} />); | ||
const reportIssueButton = screen.getByRole('button', { name: /Report issue/i }); | ||
expect(reportIssueButton).toBeInTheDocument(); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.