mirror of
https://github.com/ansible/awx.git
synced 2026-03-21 02:47:35 -02:30
update controller to handle undefined followScroll function
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count', '$scope', 'ParseTypeChange', 'ParseVariableString', 'jobResultsService', 'eventQueue', '$compile', function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile) {
|
export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count', '$scope', 'ParseTypeChange', 'ParseVariableString', 'jobResultsService', 'eventQueue', '$compile', '$log', function(jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile, $log) {
|
||||||
var getTowerLinks = function() {
|
var getTowerLinks = function() {
|
||||||
var getTowerLink = function(key) {
|
var getTowerLink = function(key) {
|
||||||
if ($scope.job.related[key]) {
|
if ($scope.job.related[key]) {
|
||||||
@@ -173,7 +173,7 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
|
|||||||
if ($scope.followEngaged) {
|
if ($scope.followEngaged) {
|
||||||
if (!$scope.followScroll) {
|
if (!$scope.followScroll) {
|
||||||
$scope.followScroll = function() {
|
$scope.followScroll = function() {
|
||||||
return null;
|
$log.error("follow scroll undefined, standard out directive not loaded yet?");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$scope.followScroll();
|
$scope.followScroll();
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ describe('Controller: jobResultsController', () => {
|
|||||||
// Setup
|
// Setup
|
||||||
let jobResultsController;
|
let jobResultsController;
|
||||||
|
|
||||||
let jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile, eventResolve, populateResolve, $rScope, q;
|
let jobData, jobDataOptions, jobLabels, jobFinished, count, $scope, ParseTypeChange, ParseVariableString, jobResultsService, eventQueue, $compile, eventResolve, populateResolve, $rScope, q, $log;
|
||||||
|
|
||||||
jobData = {
|
jobData = {
|
||||||
related: {}
|
related: {}
|
||||||
@@ -53,7 +53,7 @@ describe('Controller: jobResultsController', () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
let injectVals = () => {
|
let injectVals = () => {
|
||||||
angular.mock.inject((_jobData_, _jobDataOptions_, _jobLabels_, _jobFinished_, _count_, _ParseTypeChange_, _ParseVariableString_, _jobResultsService_, _eventQueue_, _$compile_, $rootScope, $controller, $q, $httpBackend) => {
|
angular.mock.inject((_jobData_, _jobDataOptions_, _jobLabels_, _jobFinished_, _count_, _ParseTypeChange_, _ParseVariableString_, _jobResultsService_, _eventQueue_, _$compile_, $rootScope, $controller, $q, $httpBackend, _$log_) => {
|
||||||
// when you call $scope.$apply() (which you need to do to
|
// when you call $scope.$apply() (which you need to do to
|
||||||
// to get inside of .then blocks to test), something is
|
// to get inside of .then blocks to test), something is
|
||||||
// causing a request for all static files.
|
// causing a request for all static files.
|
||||||
@@ -79,6 +79,7 @@ describe('Controller: jobResultsController', () => {
|
|||||||
ParseVariableString.and.returnValue(jobData.extra_vars);
|
ParseVariableString.and.returnValue(jobData.extra_vars);
|
||||||
jobResultsService = _jobResultsService_;
|
jobResultsService = _jobResultsService_;
|
||||||
eventQueue = _eventQueue_;
|
eventQueue = _eventQueue_;
|
||||||
|
$log = _$log_;
|
||||||
|
|
||||||
jobResultsService.getEvents.and
|
jobResultsService.getEvents.and
|
||||||
.returnValue($q.when(eventResolve));
|
.returnValue($q.when(eventResolve));
|
||||||
@@ -97,7 +98,8 @@ describe('Controller: jobResultsController', () => {
|
|||||||
ParseTypeChange: ParseTypeChange,
|
ParseTypeChange: ParseTypeChange,
|
||||||
jobResultsService: jobResultsService,
|
jobResultsService: jobResultsService,
|
||||||
eventQueue: eventQueue,
|
eventQueue: eventQueue,
|
||||||
$compile: $compile
|
$compile: $compile,
|
||||||
|
$log: $log
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
@@ -563,6 +565,8 @@ describe('Controller: jobResultsController', () => {
|
|||||||
|
|
||||||
bootstrapTest();
|
bootstrapTest();
|
||||||
|
|
||||||
|
spyOn($log, 'error');
|
||||||
|
|
||||||
$scope.followEngaged = true;
|
$scope.followEngaged = true;
|
||||||
|
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
@@ -570,6 +574,10 @@ describe('Controller: jobResultsController', () => {
|
|||||||
|
|
||||||
it('creates new child scope for the event', () => {
|
it('creates new child scope for the event', () => {
|
||||||
expect($scope.events[12].event).toBe(populateResolve);
|
expect($scope.events[12].event).toBe(populateResolve);
|
||||||
|
|
||||||
|
// in unit test, followScroll should not be defined as
|
||||||
|
// directive has not been instantiated
|
||||||
|
expect($log.error).toHaveBeenCalledWith("follow scroll undefined, standard out directive not loaded yet?");
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user