Skip to content

Commit

Permalink
fix: DashboardsBar onExpandedChanged must be a function (#1613)
Browse files Browse the repository at this point in the history
Fixed scenario:
User navigates to non-existing dashboard (i.e., bad uid). Then user clicks on a dashboard chip for a different dashboard. App crashes because onExpandedChanged did not exist.
  • Loading branch information
jenniferarnesen authored Mar 8, 2021
1 parent cd19ea5 commit 0bc1820
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cypress/integration/ui/error_scenarios.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Feature: Error scenarios
Scenario: I navigate to a dashboard that doesn't exist or I don't have access to
Given I type an invalid dashboard id in the browser url
Then a message displays informing that the dashboard is not found
When I open the "Delivery" dashboard
Then the "Delivery" dashboard displays in view mode

@nonmutating
Scenario: An error occurs while saving a dashboard that I don't have access to
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
import { When, Then } from 'cypress-cucumber-preprocessor/steps'
import { getApiBaseUrl } from '../../../support/server/utils'

// Error scenario

before(() => {
//first ensure that the description is not currently shown
cy.request({
method: 'PUT',
url: `${getApiBaseUrl()}/api/userDataStore/dashboard/showDescription`,
headers: {
'content-type': 'application/json',
},
body: 'false',
}).then(response => expect(response.status).to.equal(201))
})

When('clicking to show description fails', () => {
cy.intercept('PUT', 'userDataStore/dashboard/showDescription', {
statusCode: 409,
Expand Down
5 changes: 5 additions & 0 deletions src/components/ControlBar/ViewControlBar/DashboardsBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,11 @@ DashboardsBar.propTypes = {
onExpandedChanged: PropTypes.func,
}

DashboardsBar.defaultProps = {
expanded: false,
onExpandedChanged: Function.prototype,
}

const mapStateToProps = state => ({
userRows: sGetControlBarUserRows(state),
})
Expand Down

0 comments on commit 0bc1820

Please sign in to comment.