1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 16:51:11 +03:00

Fix test failures and jshint errors

This commit is contained in:
mabashian 2018-11-19 13:48:50 -05:00
parent 7b087d4a6c
commit a804c854bf
5 changed files with 7 additions and 75 deletions

View File

@ -34,7 +34,8 @@
"describe": false, "describe": false,
"moment": false, "moment": false,
"spyOn": false, "spyOn": false,
"jasmine": false "jasmine": false,
"dagre": false
}, },
"strict": false, "strict": false,
"quotmark": false, "quotmark": false,

View File

@ -68,12 +68,6 @@ export default ['$scope', 'TemplatesService',
getNodes(); getNodes();
$scope.closeWorkflowMaker = () => {
// Revert the data to the master which was created when the dialog was opened
$scope.graphState.nodeTree = angular.copy($scope.graphStateMaster);
$scope.closeDialog();
};
$scope.saveWorkflowMaker = () => { $scope.saveWorkflowMaker = () => {
Wait('start'); Wait('start');

View File

@ -28,7 +28,7 @@
<div class="WorkflowMaker-titleText">{{strings.get('workflow_maker.TITLE')}} | {{ workflowJobTemplateObj.name }}</div> <div class="WorkflowMaker-titleText">{{strings.get('workflow_maker.TITLE')}} | {{ workflowJobTemplateObj.name }}</div>
</div> </div>
<div class="WorkflowMaker-exitHolder"> <div class="WorkflowMaker-exitHolder">
<button class="WorkflowMaker-exit" ng-click="closeWorkflowMaker()"> <button class="WorkflowMaker-exit" ng-click="closeDialog()">
<i class="fa fa-times-circle"></i> <i class="fa fa-times-circle"></i>
</button> </button>
</div> </div>
@ -106,7 +106,7 @@
</div> </div>
</div> </div>
<div class="WorkflowMaker-buttonHolder"> <div class="WorkflowMaker-buttonHolder">
<button type="button" class="btn btn-sm WorkflowMaker-cancelButton" ng-click="closeWorkflowMaker()"> {{:: strings.get('CLOSE') }}</button> <button type="button" class="btn btn-sm WorkflowMaker-cancelButton" ng-click="closeDialog()"> {{:: strings.get('CLOSE') }}</button>
<button type="button" class="btn btn-sm WorkflowMaker-saveButton" ng-click="saveWorkflowMaker()" ng-show="workflowJobTemplateObj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate" ng-disabled="formState.showNodeForm || formState.showLinkForm"> {{:: strings.get('SAVE') }}</button> <button type="button" class="btn btn-sm WorkflowMaker-saveButton" ng-click="saveWorkflowMaker()" ng-show="workflowJobTemplateObj.summary_fields.user_capabilities.edit || canAddWorkflowJobTemplate" ng-disabled="formState.showNodeForm || formState.showLinkForm"> {{:: strings.get('SAVE') }}</button>
</div> </div>
</div> </div>

View File

@ -30,11 +30,11 @@ describe('Controller: workflowResults', () => {
$provide.value('ParseVariableString', function() {}); $provide.value('ParseVariableString', function() {});
$provide.value('i18n', { '_': (a) => { return a; } }); $provide.value('i18n', { '_': (a) => { return a; } });
$provide.provider('$stateProvider', { '$get': function() { return function() {}; } }); $provide.provider('$stateProvider', { '$get': function() { return function() {}; } });
$provide.service('WorkflowService', function($q) { $provide.service('WorkflowChartService', function($q) {
return { return {
buildTree: function() { generateArraysOfNodesAndLinks: function() {
var deferred = $q.defer(); var deferred = $q.defer();
deferred.resolve(treeData); deferred.resolve();
return deferred.promise; return deferred.promise;
} }
}; };
@ -46,7 +46,6 @@ describe('Controller: workflowResults', () => {
$rootScope = _$rootScope_; $rootScope = _$rootScope_;
workflowResultsService = _workflowResultsService_; workflowResultsService = _workflowResultsService_;
$interval = _$interval_; $interval = _$interval_;
})); }));
describe('elapsed timer', () => { describe('elapsed timer', () => {

View File

@ -1,62 +0,0 @@
'use strict';
describe('Controller: WorkflowMaker', () => {
// Setup
let scope,
WorkflowMakerController,
TemplatesService,
q,
getWorkflowJobTemplateNodesDeferred;
beforeEach(angular.mock.module('awApp'));
beforeEach(angular.mock.module('templates', () => {
TemplatesService = {
getWorkflowJobTemplateNodes: function(){
return angular.noop;
}
};
}));
beforeEach(angular.mock.inject( ($rootScope, $controller, $q) => {
scope = $rootScope.$new();
scope.closeDialog = jasmine.createSpy();
scope.treeData = {
data: {
id: 1,
canDelete: false,
canEdit: false,
canAddTo: true,
isStartNode: true,
unifiedJobTemplate: {
name: "Workflow Launch"
},
children: [],
deletedNodes: [],
totalNodes: 0
},
nextIndex: 2
};
scope.workflowJobTemplateObj = {
id: 1
};
q = $q;
getWorkflowJobTemplateNodesDeferred = q.defer();
TemplatesService.getWorkflowJobTemplateNodes = jasmine.createSpy('getWorkflowJobTemplateNodes').and.returnValue(getWorkflowJobTemplateNodesDeferred.promise);
WorkflowMakerController = $controller('WorkflowMakerController', {
$scope: scope,
TemplatesService: TemplatesService
});
}));
describe('scope.closeWorkflowMaker()', () => {
it('should close the dialog', ()=>{
scope.closeWorkflowMaker();
expect(scope.closeDialog).toHaveBeenCalled();
});
});
});