You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2025/03/27 16:08:01 UTC
(superset) 01/01: fix(Shim): Change mock target
This is an automated email from the ASF dual-hosted git repository.
diegopucci pushed a commit to branch geido/refactor/icons-typing-support
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 9489418bc3f27e9b9c603739554d6c1e091e2ebd
Author: Diego Pucci <di...@gmail.com>
AuthorDate: Thu Mar 27 13:26:44 2025 +0200
fix(Shim): Change mock target
---
.../cypress-base/cypress/e2e/chart_list/list.test.ts | 4 ++--
.../cypress-base/cypress/e2e/dashboard_list/list.test.ts | 4 ++--
.../cypress-base/cypress/support/directories.ts | 8 ++++----
superset-frontend/spec/helpers/shim.tsx | 2 +-
.../IndeterminateCheckbox/IndeterminateCheckbox.test.tsx | 12 ++++++------
.../dashboard/components/menu/BackgroundStyleDropdown.tsx | 11 ++++-------
.../controls/VizTypeControl/VizTypeControl.test.tsx | 2 +-
.../src/features/databases/DatabaseModal/index.test.tsx | 2 +-
8 files changed, 21 insertions(+), 24 deletions(-)
diff --git a/superset-frontend/cypress-base/cypress/e2e/chart_list/list.test.ts b/superset-frontend/cypress-base/cypress/e2e/chart_list/list.test.ts
index 0f905fa3e2..9f689c014b 100644
--- a/superset-frontend/cypress-base/cypress/e2e/chart_list/list.test.ts
+++ b/superset-frontend/cypress-base/cypress/e2e/chart_list/list.test.ts
@@ -123,7 +123,7 @@ describe('Charts list', () => {
it('should bulk select in list mode', () => {
toggleBulkSelect();
cy.get('#header-toggle-all').click();
- cy.get('[aria-label="checkbox_on"]').should('have.length', 26);
+ cy.get('[aria-label="checkbox-on"]').should('have.length', 26);
cy.getBySel('bulk-select-copy').contains('25 Selected');
cy.getBySel('bulk-select-action')
.should('have.length', 2)
@@ -132,7 +132,7 @@ describe('Charts list', () => {
expect($btns).to.contain('Export');
});
cy.getBySel('bulk-select-deselect-all').click();
- cy.get('[aria-label="checkbox_on"]').should('have.length', 0);
+ cy.get('[aria-label="checkbox-on"]').should('have.length', 0);
cy.getBySel('bulk-select-copy').contains('0 Selected');
cy.getBySel('bulk-select-action').should('not.exist');
});
diff --git a/superset-frontend/cypress-base/cypress/e2e/dashboard_list/list.test.ts b/superset-frontend/cypress-base/cypress/e2e/dashboard_list/list.test.ts
index de0f20f40e..322306a4c6 100644
--- a/superset-frontend/cypress-base/cypress/e2e/dashboard_list/list.test.ts
+++ b/superset-frontend/cypress-base/cypress/e2e/dashboard_list/list.test.ts
@@ -88,7 +88,7 @@ describe('Dashboards list', () => {
it('should bulk select in list mode', () => {
toggleBulkSelect();
cy.get('#header-toggle-all').click();
- cy.get('[aria-label="checkbox_on"]').should('have.length', 6);
+ cy.get('[aria-label="checkbox-on"]').should('have.length', 6);
cy.getBySel('bulk-select-copy').contains('5 Selected');
cy.getBySel('bulk-select-action')
.should('have.length', 2)
@@ -97,7 +97,7 @@ describe('Dashboards list', () => {
expect($btns).to.contain('Export');
});
cy.getBySel('bulk-select-deselect-all').click();
- cy.get('[aria-label="checkbox_on"]').should('have.length', 0);
+ cy.get('[aria-label="checkbox-on"]').should('have.length', 0);
cy.getBySel('bulk-select-copy').contains('0 Selected');
cy.getBySel('bulk-select-action').should('not.exist');
});
diff --git a/superset-frontend/cypress-base/cypress/support/directories.ts b/superset-frontend/cypress-base/cypress/support/directories.ts
index 539064b66a..3c8e8eb367 100644
--- a/superset-frontend/cypress-base/cypress/support/directories.ts
+++ b/superset-frontend/cypress-base/cypress/support/directories.ts
@@ -294,8 +294,8 @@ export const chartListView = {
},
table: {
bulkSelect: {
- checkboxOff: '[aria-label="checkbox_off"]',
- checkboxOn: '[aria-label="checkbox_on"]',
+ checkboxOff: '[aria-label="checkbox-off"]',
+ checkboxOn: '[aria-label="checkbox-on"]',
action: dataTestLocator('bulk-select-action'),
},
tableList: dataTestLocator('listview-table'),
@@ -413,8 +413,8 @@ export const dashboardListView = {
selectedStarIcon: "[aria-label='star']",
unselectedStarIcon: "[aria-label='star']",
bulkSelect: {
- checkboxOff: '[aria-label="checkbox_off"]',
- checkboxOn: '[aria-label="checkbox_on"]',
+ checkboxOff: '[aria-label="checkbox-off"]',
+ checkboxOn: '[aria-label="checkbox-on"]',
action: dataTestLocator('bulk-select-action'),
},
tableRow: {
diff --git a/superset-frontend/spec/helpers/shim.tsx b/superset-frontend/spec/helpers/shim.tsx
index 151351c2ae..096c555ce8 100644
--- a/superset-frontend/spec/helpers/shim.tsx
+++ b/superset-frontend/spec/helpers/shim.tsx
@@ -92,7 +92,7 @@ jest.mock('rehype-raw', () => () => jest.fn());
// Mocks the Icon component due to its async nature
// Tests should override this when needed
-jest.mock('src/components/Icons/Icon', () => ({
+jest.mock('src/components/Icons/CustomIcon', () => ({
__esModule: true,
default: ({
fileName,
diff --git a/superset-frontend/src/components/IndeterminateCheckbox/IndeterminateCheckbox.test.tsx b/superset-frontend/src/components/IndeterminateCheckbox/IndeterminateCheckbox.test.tsx
index 9879841b08..c60c146c18 100644
--- a/superset-frontend/src/components/IndeterminateCheckbox/IndeterminateCheckbox.test.tsx
+++ b/superset-frontend/src/components/IndeterminateCheckbox/IndeterminateCheckbox.test.tsx
@@ -51,7 +51,7 @@ test('should render the checkbox', async () => {
expect(screen.getByRole('checkbox')).toBeInTheDocument();
});
-test('should render the checkbox_half icon', async () => {
+test('should render the checkbox-half icon', async () => {
const indeterminateProps = {
...mockedProps,
indeterminate: true,
@@ -60,24 +60,24 @@ test('should render the checkbox_half icon', async () => {
expect(screen.getByRole('img')).toBeInTheDocument();
expect(screen.getByRole('img')).toHaveAttribute(
'aria-label',
- 'checkbox_half',
+ 'checkbox-half',
);
});
-test('should render the checkbox_off icon', async () => {
+test('should render the checkbox-off icon', async () => {
await asyncRender();
expect(screen.getByRole('img')).toBeInTheDocument();
- expect(screen.getByRole('img')).toHaveAttribute('aria-label', 'checkbox_off');
+ expect(screen.getByRole('img')).toHaveAttribute('aria-label', 'checkbox-off');
});
-test('should render the checkbox_on icon', async () => {
+test('should render the checkbox-on icon', async () => {
const checkboxOnProps = {
...mockedProps,
checked: true,
};
await asyncRender(checkboxOnProps);
expect(screen.getByRole('img')).toBeInTheDocument();
- expect(screen.getByRole('img')).toHaveAttribute('aria-label', 'checkbox_on');
+ expect(screen.getByRole('img')).toHaveAttribute('aria-label', 'checkbox-on');
});
test('should call the onChange', async () => {
diff --git a/superset-frontend/src/dashboard/components/menu/BackgroundStyleDropdown.tsx b/superset-frontend/src/dashboard/components/menu/BackgroundStyleDropdown.tsx
index eb44ee81c0..700c6f9e39 100644
--- a/superset-frontend/src/dashboard/components/menu/BackgroundStyleDropdown.tsx
+++ b/superset-frontend/src/dashboard/components/menu/BackgroundStyleDropdown.tsx
@@ -35,7 +35,6 @@ interface BackgroundStyleDropdownProps {
const BackgroundStyleOption = styled.div`
${({ theme }) => css`
display: inline-block;
-
&:before {
content: '';
width: 1em;
@@ -44,25 +43,23 @@ const BackgroundStyleOption = styled.div`
display: inline-block;
vertical-align: middle;
}
-
&.background--white {
padding-left: 0;
background: transparent;
-
&:before {
background: ${theme.colors.grayscale.light5};
border: 1px solid ${theme.colors.grayscale.light2};
}
}
-
/* Create the transparent rect icon */
&.background--transparent:before {
- background-image: linear-gradient(
- 45deg,
+ background-image:
+ linear-gradient(45deg, ${theme.colors.text.label} 25%, transparent 25%),
+ linear-gradient(
+ -45deg,
${theme.colors.text.label} 25%,
transparent 25%
),
- linear-gradient(-45deg, ${theme.colors.text.label} 25%, transparent 25%),
linear-gradient(45deg, transparent 75%, ${theme.colors.text.label} 75%),
linear-gradient(-45deg, transparent 75%, ${theme.colors.text.label} 75%);
background-size: ${theme.gridUnit * 2}px ${theme.gridUnit * 2}px;
diff --git a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx
index 157f265c4c..f427bc9f03 100644
--- a/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx
+++ b/superset-frontend/src/explore/components/controls/VizTypeControl/VizTypeControl.test.tsx
@@ -121,7 +121,7 @@ describe('VizTypeControl', () => {
};
await waitForRenderWrapper(props);
expect(screen.getByLabelText('table')).toBeVisible();
- expect(screen.getByLabelText('big_number_chart_tile')).toBeVisible();
+ expect(screen.getByLabelText('big-number-chart-tile')).toBeVisible();
expect(screen.getByLabelText('pie-chart')).toBeVisible();
expect(screen.getByLabelText('bar-chart')).toBeVisible();
expect(screen.getByLabelText('area-chart')).toBeVisible();
diff --git a/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx b/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx
index 198e9f7060..4a0dd068d6 100644
--- a/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx
+++ b/superset-frontend/src/features/databases/DatabaseModal/index.test.tsx
@@ -678,7 +678,7 @@ describe('DatabaseModal', () => {
});
// These are the checkbox SVGs that cover the actual checkboxes
const checkboxOffSVGs = screen.getAllByRole('img', {
- name: /checkbox_off/i,
+ name: /checkbox-off/i,
});
const tooltipIcons = within(advancedTabPanel).getAllByRole('img', {
name: /info-tooltip/i,