Compare commits

...

3 Commits

Author SHA1 Message Date
Evan Rusackas
1c11b09923 fix: apply pre-commit auto-fixes
prettier reformatted 1 file (FilterScope.test.tsx)
2026-04-21 14:54:22 -07:00
Evan Rusackas
dac16c8020 fix(deps): adapt FilterScope tests to react-checkbox-tree 2.x role change
react-checkbox-tree 2.0.0 changed the clickable node label from
role="link" to role="button" (the rct-node-clickable span). The
FilterScope test suite queried these nodes via getByRole('link'),
which caused 9 failures in sharded-jest-tests (2).

Updated superset-frontend/src/dashboard/components/filterscope/FilterScope.test.tsx
to query role 'button' instead of 'link' in getCheckboxState,
clickCheckbox, and the assertions on filter/chart/tab tree nodes.
Real button queries (Close, Save, Collapse/Expand all) were already
role 'button' and are unchanged.
2026-04-21 13:45:39 -07:00
dependabot[bot]
845c038945 chore(deps): bump react-checkbox-tree in /superset-frontend
Bumps [react-checkbox-tree](https://github.com/jakezatecky/react-checkbox-tree) from 1.8.0 to 2.0.0.
- [Release notes](https://github.com/jakezatecky/react-checkbox-tree/releases)
- [Changelog](https://github.com/jakezatecky/react-checkbox-tree/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jakezatecky/react-checkbox-tree/compare/v1.8.0...v2.0.0)

---
updated-dependencies:
- dependency-name: react-checkbox-tree
  dependency-version: 2.0.0
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-21 20:22:07 +00:00
3 changed files with 43 additions and 49 deletions

View File

@@ -115,7 +115,7 @@
"re-resizable": "^6.11.2",
"react": "^17.0.2",
"react-arborist": "^3.5.0",
"react-checkbox-tree": "^1.8.0",
"react-checkbox-tree": "^2.0.1",
"react-diff-viewer-continued": "^4.2.0",
"react-dnd": "^11.1.3",
"react-dnd-html5-backend": "^11.1.3",
@@ -25297,6 +25297,15 @@
"dev": true,
"license": "Apache-2.0"
},
"node_modules/fast-equals": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/fast-equals/-/fast-equals-6.0.0.tgz",
"integrity": "sha512-PFhhIGgdM79r5Uztdj9Zb6Tt1zKafqVfdMGwVca1z5z6fbX7DmsySSuJd8HiP6I1j505DCS83cLxo5rmSNeVEA==",
"license": "MIT",
"engines": {
"node": ">=6.0.0"
}
},
"node_modules/fast-fifo": {
"version": "1.3.2",
"resolved": "https://registry.npmjs.org/fast-fifo/-/fast-fifo-1.3.2.tgz",
@@ -35341,7 +35350,6 @@
"version": "4.1.2",
"resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz",
"integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==",
"dev": true,
"license": "MIT"
},
"node_modules/lodash.merge": {
@@ -41560,36 +41568,18 @@
}
},
"node_modules/react-checkbox-tree": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/react-checkbox-tree/-/react-checkbox-tree-1.8.0.tgz",
"integrity": "sha512-ufC4aorihOvjLpvY1beab2hjVLGZbDTFRzw62foG0+th+KX7e/sdmWu/nD1ZS/U5Yr0rWGwedGH5GOtR0IkUXw==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/react-checkbox-tree/-/react-checkbox-tree-2.0.1.tgz",
"integrity": "sha512-ZUh9strXP3a+RpXEGPSq5qWC0HSo3pjjGQEwNWYdmo1OfSNq0L61boy4ANIN2O+ybo/n80hadQYNAeMgwdQqRQ==",
"license": "MIT",
"dependencies": {
"classnames": "^2.2.5",
"lodash": "^4.17.10",
"nanoid": "^3.0.0",
"fast-equals": "^6.0.0",
"lodash.memoize": "^4.1.2",
"prop-types": "^15.5.8"
},
"peerDependencies": {
"react": "^15.3.0 || ^16.0.0 || ^17.0.0 || ^18.0.0"
}
},
"node_modules/react-checkbox-tree/node_modules/nanoid": {
"version": "3.3.8",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.8.tgz",
"integrity": "sha512-WNLf5Sd8oZxOm+TzppcYk8gVOgP+l58xNy58D0nbUnOxOWRWvlcCV4kUF7ltmI6PsrLl/BgKEyS4mqsGChFN0w==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/ai"
}
],
"license": "MIT",
"bin": {
"nanoid": "bin/nanoid.cjs"
},
"engines": {
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
"react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
}
},
"node_modules/react-diff-viewer-continued": {

View File

@@ -196,7 +196,7 @@
"re-resizable": "^6.11.2",
"react": "^17.0.2",
"react-arborist": "^3.5.0",
"react-checkbox-tree": "^1.8.0",
"react-checkbox-tree": "^2.0.1",
"react-diff-viewer-continued": "^4.2.0",
"react-dnd": "^11.1.3",
"react-dnd-html5-backend": "^11.1.3",

View File

@@ -171,7 +171,7 @@ function getCheckboxIcon(element: HTMLElement): Element {
* checkbox state change is the fill color of the SVG icon.
*/
function getCheckboxState(name: string): CheckboxState {
const element = screen.getByRole('link', { name });
const element = screen.getByRole('button', { name });
const svgPath = getCheckboxIcon(element).children[1].children[0].children[0];
const fill = svgPath.getAttribute('fill');
return fill === supersetTheme.colorPrimary
@@ -183,7 +183,7 @@ function getCheckboxState(name: string): CheckboxState {
// Replace the original clickCheckbox function with the async version
async function clickCheckbox(name: string) {
const element = screen.getByRole('link', { name });
const element = screen.getByRole('button', { name });
const checkboxLabel = getCheckboxIcon(element);
await userEvent.click(checkboxLabel);
}
@@ -204,11 +204,11 @@ test('renders with empty filters', () => {
test('renders with filters values', () => {
render(<FilterScopeSelector {...createProps()} />, { useRedux: true });
expect(screen.getByRole('link', { name: FILTER_A })).toBeInTheDocument();
expect(screen.getByRole('link', { name: FILTER_B })).toBeInTheDocument();
expect(screen.getByRole('link', { name: FILTER_C })).toBeInTheDocument();
expect(screen.getByRole('link', { name: TAB_A })).toBeInTheDocument();
expect(screen.getByRole('link', { name: TAB_B })).toBeInTheDocument();
expect(screen.getByRole('button', { name: FILTER_A })).toBeInTheDocument();
expect(screen.getByRole('button', { name: FILTER_B })).toBeInTheDocument();
expect(screen.getByRole('button', { name: FILTER_C })).toBeInTheDocument();
expect(screen.getByRole('button', { name: TAB_A })).toBeInTheDocument();
expect(screen.getByRole('button', { name: TAB_B })).toBeInTheDocument();
expect(screen.queryByText(CHART_A)).not.toBeInTheDocument();
expect(screen.queryByText(CHART_B)).not.toBeInTheDocument();
expect(screen.queryByText(CHART_C)).not.toBeInTheDocument();
@@ -222,21 +222,21 @@ test('collapses/expands all filters', () => {
useRedux: true,
});
userEvent.click(screen.getAllByRole('button', { name: COLLAPSE_ALL })[0]);
expect(screen.getByRole('link', { name: ALL_FILTERS })).toBeInTheDocument();
expect(screen.getByRole('button', { name: ALL_FILTERS })).toBeInTheDocument();
expect(
screen.queryByRole('link', { name: FILTER_A }),
screen.queryByRole('button', { name: FILTER_A }),
).not.toBeInTheDocument();
expect(
screen.queryByRole('link', { name: FILTER_B }),
screen.queryByRole('button', { name: FILTER_B }),
).not.toBeInTheDocument();
expect(
screen.queryByRole('link', { name: FILTER_C }),
screen.queryByRole('button', { name: FILTER_C }),
).not.toBeInTheDocument();
userEvent.click(screen.getAllByRole('button', { name: EXPAND_ALL })[0]);
expect(screen.getByRole('link', { name: ALL_FILTERS })).toBeInTheDocument();
expect(screen.getByRole('link', { name: FILTER_A })).toBeInTheDocument();
expect(screen.getByRole('link', { name: FILTER_B })).toBeInTheDocument();
expect(screen.getByRole('link', { name: FILTER_C })).toBeInTheDocument();
expect(screen.getByRole('button', { name: ALL_FILTERS })).toBeInTheDocument();
expect(screen.getByRole('button', { name: FILTER_A })).toBeInTheDocument();
expect(screen.getByRole('button', { name: FILTER_B })).toBeInTheDocument();
expect(screen.getByRole('button', { name: FILTER_C })).toBeInTheDocument();
});
test('collapses/expands all charts', () => {
@@ -251,10 +251,10 @@ test('collapses/expands all charts', () => {
expect(screen.queryByText(CHART_D)).not.toBeInTheDocument();
userEvent.click(screen.getAllByRole('button', { name: EXPAND_ALL })[1]);
expect(screen.getByText(ALL_CHARTS)).toBeInTheDocument();
expect(screen.getByRole('link', { name: CHART_A })).toBeInTheDocument();
expect(screen.getByRole('link', { name: CHART_B })).toBeInTheDocument();
expect(screen.getByRole('link', { name: CHART_C })).toBeInTheDocument();
expect(screen.getByRole('link', { name: CHART_D })).toBeInTheDocument();
expect(screen.getByRole('button', { name: CHART_A })).toBeInTheDocument();
expect(screen.getByRole('button', { name: CHART_B })).toBeInTheDocument();
expect(screen.getByRole('button', { name: CHART_C })).toBeInTheDocument();
expect(screen.getByRole('button', { name: CHART_D })).toBeInTheDocument();
});
test('searches for a chart', () => {
@@ -262,9 +262,13 @@ test('searches for a chart', () => {
useRedux: true,
});
userEvent.type(screen.getByPlaceholderText('Search...'), CHART_C);
expect(screen.queryByRole('link', { name: CHART_A })).not.toBeInTheDocument();
expect(screen.queryByRole('link', { name: CHART_B })).not.toBeInTheDocument();
expect(screen.getByRole('link', { name: CHART_C })).toBeInTheDocument();
expect(
screen.queryByRole('button', { name: CHART_A }),
).not.toBeInTheDocument();
expect(
screen.queryByRole('button', { name: CHART_B }),
).not.toBeInTheDocument();
expect(screen.getByRole('button', { name: CHART_C })).toBeInTheDocument();
});
// Update all tests that use clickCheckbox to be async and await the function call