Skip to content

Commit

Permalink
Test fix and more robust logic
Browse files Browse the repository at this point in the history
  • Loading branch information
datamel committed Mar 1, 2023
1 parent 0d84c55 commit 805dab2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/components/cylc/cylcObject/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ import {
mdiPencil
} from '@mdi/js'
import { mapGetters, mapState } from 'vuex'
import WorkflowState from '@/model/WorkflowState.model'
export default {
name: 'CylcObjectMenu',
Expand Down Expand Up @@ -246,8 +247,11 @@ export default {
},
isDisabled (mutation, authorised) {
if (this.node.type !== 'workflow') {
this.workflowStatus = this.getNodes(
'workflow', [this.node.tokens.workflow_id])[0].node.status
const nodeReturned = this.getNodes(
'workflow', [this.node.tokens.workflow_id])
if (nodeReturned.length) {
this.workflowStatus = nodeReturned[0].node.status
} else { this.workflowStatus = WorkflowState.RUNNING.name }
} else {
this.workflowStatus = this.node.node.status
}
Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/specs/menu.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

describe('CylcObject Menu component', () => {
const collapsedWorkflowMenuLength = 6 // (5 mutations + "show more" btn)
const collapsedWorkflowMenuLength = 7 // (6 mutations + "show more" btn)
const expandedWorkflowMenuLength = 21

it('should not be displayed initially on load', () => {
Expand Down

0 comments on commit 805dab2

Please sign in to comment.