Migrates Label component from Bootstrap to AntD. (#12774)

This commit is contained in:
Michael S. Molina
2021-02-02 03:15:07 -03:00
committed by GitHub
parent 388edbf7b2
commit 2adfb85597
21 changed files with 162 additions and 225 deletions

View File

@@ -21,7 +21,7 @@
*/
import React from 'react';
import { render, sleep, waitFor } from 'spec/helpers/testing-library';
import Timer from 'src/components/Timer';
import Timer, { TimerProps } from 'src/components/Timer';
import { now } from 'src/modules/dates';
function parseTime(text?: string | null) {
@@ -29,7 +29,7 @@ function parseTime(text?: string | null) {
}
describe('Timer', () => {
const mockProps = {
const mockProps: TimerProps = {
startTime: now(),
endTime: undefined,
isRunning: true,
@@ -41,7 +41,6 @@ describe('Timer', () => {
const node = screen.getByRole('timer');
let text = node.textContent || '';
expect(node).toBeInTheDocument();
expect(node).toHaveClass('label-warning');
expect(node).toHaveTextContent('00:00:00.00');
// should start running
await waitFor(() => {

View File

@@ -45,6 +45,6 @@ describe('RowCountLabel', () => {
limit: 100,
};
const wrapper = shallow(<RowCountLabel {...props} />);
expect(wrapper.find(Label).first().props().bsStyle).toBe('danger');
expect(wrapper.find(Label).first().props().type).toBe('danger');
});
});

View File

@@ -19,7 +19,7 @@
import React from 'react';
import { styledMount as mount } from 'spec/helpers/theming';
import Security from 'src/profile/components/Security';
import Label from 'src/components/Label';
import { user, userNoPerms } from './fixtures';
describe('Security', () => {
@@ -31,19 +31,19 @@ describe('Security', () => {
});
it('renders 2 role labels', () => {
const wrapper = mount(<Security {...mockedProps} />);
expect(wrapper.find('.roles').find('.label')).toHaveLength(2);
expect(wrapper.find('.roles').find(Label)).toHaveLength(2);
});
it('renders 2 datasource labels', () => {
const wrapper = mount(<Security {...mockedProps} />);
expect(wrapper.find('.datasources').find('.label')).toHaveLength(2);
expect(wrapper.find('.datasources').find(Label)).toHaveLength(2);
});
it('renders 3 database labels', () => {
const wrapper = mount(<Security {...mockedProps} />);
expect(wrapper.find('.databases').find('.label')).toHaveLength(3);
expect(wrapper.find('.databases').find(Label)).toHaveLength(3);
});
it('renders no permission label when empty', () => {
const wrapper = mount(<Security user={userNoPerms} />);
expect(wrapper.find('.datasources').find('.label')).not.toExist();
expect(wrapper.find('.databases').find('.label')).not.toExist();
expect(wrapper.find('.datasources').find(Label)).not.toExist();
expect(wrapper.find('.databases').find(Label)).not.toExist();
});
});