refactor: icon to icons for listviewcomponent (#15408)

* initial commit

* fix dashboard cypress tests

* fix more tests

* fix more tests

* fix listviews
This commit is contained in:
Phillip Kelley-Dotson 2021-07-01 11:36:16 -07:00 committed by GitHub
parent 246368e9dc
commit 7f2f51b2bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 14 additions and 14 deletions

View File

@ -22,7 +22,7 @@ describe('chart card view', () => {
beforeEach(() => { beforeEach(() => {
cy.login(); cy.login();
cy.visit(CHART_LIST); cy.visit(CHART_LIST);
cy.get('[data-test="card-view"]').click(); cy.get('[aria-label="card-view"]').click();
}); });
it('should load cards', () => { it('should load cards', () => {

View File

@ -22,7 +22,7 @@ describe('chart card view filters', () => {
beforeEach(() => { beforeEach(() => {
cy.login(); cy.login();
cy.visit(CHART_LIST); cy.visit(CHART_LIST);
cy.get('[data-test="card-view"]').click(); cy.get('[aria-label="card-view"]').click();
}); });
it('should filter by owners correctly', () => { it('should filter by owners correctly', () => {
@ -89,7 +89,7 @@ describe('chart list view filters', () => {
beforeEach(() => { beforeEach(() => {
cy.login(); cy.login();
cy.visit(CHART_LIST); cy.visit(CHART_LIST);
cy.get('[data-test="list-view"]').click(); cy.get('[aria-label="list-view"]').click();
}); });
it('should filter by owners correctly', () => { it('should filter by owners correctly', () => {

View File

@ -22,7 +22,7 @@ describe('chart list view', () => {
beforeEach(() => { beforeEach(() => {
cy.login(); cy.login();
cy.visit(CHART_LIST); cy.visit(CHART_LIST);
cy.get('[data-test="list-view"]').click(); cy.get('[aria-label="list-view"]').click();
}); });
it('should load rows', () => { it('should load rows', () => {

View File

@ -22,7 +22,7 @@ describe('Dashboard card view', () => {
beforeEach(() => { beforeEach(() => {
cy.login(); cy.login();
cy.visit(DASHBOARD_LIST); cy.visit(DASHBOARD_LIST);
cy.get('[data-test="card-view"]').click(); cy.get('[aria-label="card-view"]').click();
}); });
xit('should load cards', () => { xit('should load cards', () => {

View File

@ -22,7 +22,7 @@ describe('dashboard filters card view', () => {
beforeEach(() => { beforeEach(() => {
cy.login(); cy.login();
cy.visit(DASHBOARD_LIST); cy.visit(DASHBOARD_LIST);
cy.get('[data-test="card-view"]').click(); cy.get('[aria-label="card-view"]').click();
}); });
it('should filter by owners correctly', () => { it('should filter by owners correctly', () => {
@ -73,7 +73,7 @@ describe('dashboard filters list view', () => {
beforeEach(() => { beforeEach(() => {
cy.login(); cy.login();
cy.visit(DASHBOARD_LIST); cy.visit(DASHBOARD_LIST);
cy.get('[data-test="list-view"]').click(); cy.get('[aria-label="list-view"]').click();
}); });
it('should filter by owners correctly', () => { it('should filter by owners correctly', () => {

View File

@ -22,7 +22,7 @@ describe('dashboard list view', () => {
beforeEach(() => { beforeEach(() => {
cy.login(); cy.login();
cy.visit(DASHBOARD_LIST); cy.visit(DASHBOARD_LIST);
cy.get('[data-test="list-view"]').click(); cy.get('[aria-label="list-view"]').click();
}); });
xit('should load rows', () => { xit('should load rows', () => {

View File

@ -23,7 +23,7 @@ import Alert from 'src/components/Alert';
import { ReactComponent as EmptyImage } from 'images/empty.svg'; import { ReactComponent as EmptyImage } from 'images/empty.svg';
import cx from 'classnames'; import cx from 'classnames';
import Button from 'src/components/Button'; import Button from 'src/components/Button';
import Icon from 'src/components/Icon'; import Icons from 'src/components/Icons';
import IndeterminateCheckbox from 'src/components/IndeterminateCheckbox'; import IndeterminateCheckbox from 'src/components/IndeterminateCheckbox';
import { TableCollection, Pagination } from 'src/components/dataViewCommon'; import { TableCollection, Pagination } from 'src/components/dataViewCommon';
import CardCollection from './CardCollection'; import CardCollection from './CardCollection';
@ -142,7 +142,7 @@ const ViewModeContainer = styled.div`
display: inline-block; display: inline-block;
border-radius: ${({ theme }) => theme.gridUnit / 2}px; border-radius: ${({ theme }) => theme.gridUnit / 2}px;
padding: ${({ theme }) => theme.gridUnit}px; padding: ${({ theme }) => theme.gridUnit}px;
padding-bottom: 0; padding-bottom: ${({ theme }) => theme.gridUnit * 0.5}px;
&:first-of-type { &:first-of-type {
margin-right: ${({ theme }) => theme.gridUnit * 2}px; margin-right: ${({ theme }) => theme.gridUnit * 2}px;
@ -182,7 +182,7 @@ const ViewModeToggle = ({
}} }}
className={cx('toggle-button', { active: mode === 'card' })} className={cx('toggle-button', { active: mode === 'card' })}
> >
<Icon name="card-view" /> <Icons.CardView />
</div> </div>
<div <div
role="button" role="button"
@ -193,7 +193,7 @@ const ViewModeToggle = ({
}} }}
className={cx('toggle-button', { active: mode === 'table' })} className={cx('toggle-button', { active: mode === 'table' })}
> >
<Icon name="list-view" /> <Icons.ListView />
</div> </div>
</ViewModeContainer> </ViewModeContainer>
); );

View File

@ -142,7 +142,7 @@ describe('ChartList', () => {
}); });
it('renders a table view', async () => { it('renders a table view', async () => {
wrapper.find('[data-test="list-view"]').first().simulate('click'); wrapper.find('[aria-label="list-view"]').first().simulate('click');
await waitForComponentToPaint(wrapper); await waitForComponentToPaint(wrapper);
expect(wrapper.find('table')).toExist(); expect(wrapper.find('table')).toExist();
}); });

View File

@ -143,7 +143,7 @@ describe('DashboardList', () => {
}); });
it('renders a table view', async () => { it('renders a table view', async () => {
wrapper.find('[data-test="list-view"]').first().simulate('click'); wrapper.find('[aria-label="list-view"]').first().simulate('click');
await waitForComponentToPaint(wrapper); await waitForComponentToPaint(wrapper);
expect(wrapper.find('table')).toExist(); expect(wrapper.find('table')).toExist();
}); });