mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: transfer TimeSyncButton.test to testing-library (#48404)
This commit is contained in:
@@ -230,9 +230,6 @@ exports[`no enzyme tests`] = {
|
|||||||
"public/app/features/explore/SecondaryActions.test.tsx:1177396128": [
|
"public/app/features/explore/SecondaryActions.test.tsx:1177396128": [
|
||||||
[0, 19, 13, "RegExp match", "2409514259"]
|
[0, 19, 13, "RegExp match", "2409514259"]
|
||||||
],
|
],
|
||||||
"public/app/features/explore/TimeSyncButton.test.tsx:853739820": [
|
|
||||||
[0, 17, 13, "RegExp match", "2409514259"]
|
|
||||||
],
|
|
||||||
"public/app/features/folders/FolderSettingsPage.test.tsx:1109052730": [
|
"public/app/features/folders/FolderSettingsPage.test.tsx:1109052730": [
|
||||||
[0, 19, 13, "RegExp match", "2409514259"]
|
[0, 19, 13, "RegExp match", "2409514259"]
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -1,20 +1,20 @@
|
|||||||
import { mount } from 'enzyme';
|
import { render, screen } from '@testing-library/react';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
import { TimeSyncButton } from './TimeSyncButton';
|
import { TimeSyncButton } from './TimeSyncButton';
|
||||||
|
|
||||||
const setup = (isSynced: boolean) => {
|
const setup = (isSynced: boolean) => {
|
||||||
const onClick = () => {};
|
const onClick = () => {};
|
||||||
return mount(<TimeSyncButton onClick={onClick} isSynced={isSynced} />);
|
return render(<TimeSyncButton onClick={onClick} isSynced={isSynced} />);
|
||||||
};
|
};
|
||||||
|
|
||||||
describe('TimeSyncButton', () => {
|
describe('TimeSyncButton', () => {
|
||||||
it('should change style when synced', () => {
|
it('should have the right name when isSynced = true', () => {
|
||||||
const wrapper = setup(true);
|
setup(true);
|
||||||
expect(wrapper.find('button').props()['aria-label']).toEqual('Synced times');
|
expect(screen.getByRole('button', { name: /synced times/i })).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
it('should not change style when not synced', () => {
|
it('should have the right name when isSynced = false', () => {
|
||||||
const wrapper = setup(false);
|
setup(false);
|
||||||
expect(wrapper.find('button').props()['aria-label']).toEqual('Unsynced times');
|
expect(screen.getByRole('button', { name: /unsynced times/i })).toBeInTheDocument();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user