diff --git a/awx/ui_next/src/screens/Job/WorkflowOutput/WorkflowOutputToolbar.test.jsx b/awx/ui_next/src/screens/Job/WorkflowOutput/WorkflowOutputToolbar.test.jsx
index 4afe13e93f..3523e08f32 100644
--- a/awx/ui_next/src/screens/Job/WorkflowOutput/WorkflowOutputToolbar.test.jsx
+++ b/awx/ui_next/src/screens/Job/WorkflowOutput/WorkflowOutputToolbar.test.jsx
@@ -1,13 +1,17 @@
import React from 'react';
-import { WorkflowStateContext } from '@contexts/Workflow';
+import {
+ WorkflowDispatchContext,
+ WorkflowStateContext,
+} from '@contexts/Workflow';
import { mountWithContexts } from '@testUtils/enzymeHelpers';
import WorkflowOutputToolbar from './WorkflowOutputToolbar';
+let wrapper;
+const dispatch = jest.fn();
const job = {
id: 1,
status: 'successful',
};
-
const workflowContext = {
nodes: [],
showLegend: false,
@@ -15,16 +19,7 @@ const workflowContext = {
};
describe('WorkflowOutputToolbar', () => {
- test('mounts successfully', () => {
- const wrapper = mountWithContexts(
-
-
-
- );
- expect(wrapper).toHaveLength(1);
- });
-
- test('shows correct number of nodes', () => {
+ beforeAll(() => {
const nodes = [
{
id: 1,
@@ -37,12 +32,31 @@ describe('WorkflowOutputToolbar', () => {
isDeleted: true,
},
];
- const wrapper = mountWithContexts(
-
-
-
+ wrapper = mountWithContexts(
+
+
+
+
+
);
+ });
+
+ afterAll(() => {
+ wrapper.unmount();
+ });
+
+ test('Shows correct number of nodes', () => {
// The start node (id=1) and deleted nodes (isDeleted=true) should be ignored
expect(wrapper.find('Badge').text()).toBe('1');
});
+
+ test('Toggle Legend button dispatches as expected', () => {
+ wrapper.find('CompassIcon').simulate('click');
+ expect(dispatch).toHaveBeenCalledWith({ type: 'TOGGLE_LEGEND' });
+ });
+
+ test('Toggle Tools button dispatches as expected', () => {
+ wrapper.find('WrenchIcon').simulate('click');
+ expect(dispatch).toHaveBeenCalledWith({ type: 'TOGGLE_TOOLS' });
+ });
});
diff --git a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/DeleteAllNodesModal.jsx b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/DeleteAllNodesModal.jsx
index 324bb98b87..9947656801 100644
--- a/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/DeleteAllNodesModal.jsx
+++ b/awx/ui_next/src/screens/Template/WorkflowJobTemplateVisualizer/Modals/DeleteAllNodesModal.jsx
@@ -11,6 +11,7 @@ function DeleteAllNodesModal({ i18n }) {
,