Copilot commented on code in PR #40914:
URL: https://github.com/apache/superset/pull/40914#discussion_r3391585340
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.test.tsx:
##########
@@ -165,6 +165,42 @@ describe('DashboardBuilder', () => {
expect(header).toBeInTheDocument();
});
+ test('should hide DashboardHeader when standalone mode hides nav and title
(?standalone=2)', () => {
+ // React-level equivalent of the legacy
`cy.get('#app-menu').should('not.exist')`
+ // Cypress assertion. The `#app-menu` node lives in Flask's spa.html
template,
+ // gated by `{% if standalone_mode %}`, so RTL cannot reach it directly.
+ // `?standalone=2` maps to DashboardStandaloneMode.HideNavAndTitle, which
the
+ // DashboardBuilder honours by suppressing the React-side DashboardHeader.
+ const originalHref = window.location.href;
+ window.history.replaceState({}, '', '/?standalone=2');
+ try {
+ const { queryByTestId } = setup();
+
expect(queryByTestId('dashboard-header-container')).not.toBeInTheDocument();
+ } finally {
+ window.history.replaceState({}, '', originalHref);
+ }
+ });
+
+ test('should apply editing class and hide header when both edit and
standalone params are set', () => {
+ // Combined-params analogue of the legacy `?edit=true&standalone=true`
Cypress
+ // mount. The two URL params are orthogonal on the React side: standalone=2
+ // suppresses DashboardHeader regardless of editMode, while editMode still
+ // drives the `dashboard--editing` class on the wrapper.
+ const originalHref = window.location.href;
+ window.history.replaceState({}, '', '/?edit=true&standalone=2');
Review Comment:
This test claims to validate behavior when both `edit` and `standalone` URL
params are set, but `DashboardBuilder` only reads `URL_PARAMS.standalone` (it
never reads `edit`). Since `editMode` is being forced via the redux override,
`?edit=true` in the URL is misleading and could give false confidence about
URL→state coverage in this file. Consider removing the `edit=true` query param
and updating the test name/comment to reflect that `editMode` comes from state
here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]