diff --git a/src/components/cylc/tree/GScanTreeItem.vue b/src/components/cylc/tree/GScanTreeItem.vue
index 39ffd69a1..98649a9dd 100644
--- a/src/components/cylc/tree/GScanTreeItem.vue
+++ b/src/components/cylc/tree/GScanTreeItem.vue
@@ -54,6 +54,7 @@ along with this program. If not, see .
size="1em"
class="modifier-badge"
:class="modifier"
+ :data-test="`modifier-${modifier}`"
/>
{
})
describe('expand/collapse button click', () => {
- const wrapper = mountFunction({
- props: {
- node: simpleTaskNode,
- filteredOutNodesCache: new WeakMap(),
- }
- })
- expect(wrapper).to.not.be.expanded()
- const expandCollapseBtn = wrapper.find('.node-expand-collapse-button')
- it('should expand if currently collapsed', async () => {
+ it('expands/collapses', async () => {
+ const wrapper = mountFunction({
+ props: {
+ node: simpleTaskNode,
+ filteredOutNodesCache: new WeakMap(),
+ }
+ })
+ expect(wrapper).to.not.be.expanded()
+ const expandCollapseBtn = wrapper.find('.node-expand-collapse-button')
await expandCollapseBtn.trigger('click')
expect(wrapper).to.be.expanded()
- })
- it('should collapse if currently expanded', async () => {
await expandCollapseBtn.trigger('click')
expect(wrapper).to.not.be.expanded()
})
@@ -137,20 +137,30 @@ describe('TreeItem component', () => {
})
describe('GScanTreeItem', () => {
- const mountFunction = (options) => mount(GScanTreeItem, {
- global: {
- plugins: [createVuetify(), CommandMenuPlugin],
- mock: { $workflowService }
- },
- ...options
- })
+ const mountFunction = (options) => mount(
+ GScanTreeItem,
+ merge(
+ {
+ global: {
+ plugins: [createVuetify(), CommandMenuPlugin],
+ mock: { $workflowService },
+ },
+ props: {
+ filteredOutNodesCache: new WeakMap(),
+ },
+ },
+ options
+ )
+ )
describe('computed properties', () => {
- const wrapper = mountFunction({
- props: {
- node: flattenWorkflowParts(stateTotalsTestWorkflowNodes),
- filteredOutNodesCache: new WeakMap(),
- }
+ let wrapper
+ beforeEach(() => {
+ wrapper = mountFunction({
+ props: {
+ node: flattenWorkflowParts(stateTotalsTestWorkflowNodes),
+ }
+ })
})
it('does not combine descendant latest state tasks', () => {
expect(wrapper.vm.statesInfo.latestTasks).to.deep.equal({})
@@ -178,7 +188,6 @@ describe('GScanTreeItem', () => {
node: {
type: 'barbenheimer',
},
- filteredOutNodesCache: new WeakMap(),
},
shallow: true,
})
@@ -191,11 +200,44 @@ describe('GScanTreeItem', () => {
type: 'workflow',
tokens: { workflow: 'a/b/c' }
},
- filteredOutNodesCache: new WeakMap(),
},
shallow: true,
})
expect(wrapper.vm.workflowLink).to.equal('/workspace/a/b/c')
})
})
+
+ describe('Modifier icons', () => {
+ let wrapper
+ it('shows modifiers for non-stopped workflows', async () => {
+ const { id, tokens } = simpleWorkflowNode
+ const node = {
+ type: 'workflow',
+ node: {
+ status: 'running',
+ containsHeld: true,
+ containsRetry: true,
+ stateTotals: {},
+ },
+ id,
+ tokens,
+ }
+ wrapper = mountFunction({
+ global: {
+ stubs: ['WorkflowIcon', 'WarningIcon'],
+ },
+ props: {
+ node,
+ },
+ })
+ function expectModifiers (value) {
+ expect(wrapper.find('[data-test=modifier-held]').exists()).toBe(value)
+ expect(wrapper.find('[data-test=modifier-retrying]').exists()).toBe(value)
+ }
+ expectModifiers(true)
+ node.node.status = 'stopped'
+ await wrapper.setProps({ node })
+ expectModifiers(false)
+ })
+ })
})