mirror of
https://github.com/ansible/awx.git
synced 2026-01-13 19:10:07 -03:30
update controller to handle undefined followScroll function
This commit is contained in:
parent
f7e184650b
commit
eb4ec54764
@ -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 getTowerLink = function(key) {
|
||||
if ($scope.job.related[key]) {
|
||||
@ -173,7 +173,7 @@ export default ['jobData', 'jobDataOptions', 'jobLabels', 'jobFinished', 'count'
|
||||
if ($scope.followEngaged) {
|
||||
if (!$scope.followScroll) {
|
||||
$scope.followScroll = function() {
|
||||
return null;
|
||||
$log.error("follow scroll undefined, standard out directive not loaded yet?");
|
||||
}
|
||||
}
|
||||
$scope.followScroll();
|
||||
|
||||
@ -4,7 +4,7 @@ describe('Controller: jobResultsController', () => {
|
||||
// Setup
|
||||
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 = {
|
||||
related: {}
|
||||
@ -53,7 +53,7 @@ describe('Controller: jobResultsController', () => {
|
||||
};
|
||||
|
||||
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
|
||||
// to get inside of .then blocks to test), something is
|
||||
// causing a request for all static files.
|
||||
@ -79,6 +79,7 @@ describe('Controller: jobResultsController', () => {
|
||||
ParseVariableString.and.returnValue(jobData.extra_vars);
|
||||
jobResultsService = _jobResultsService_;
|
||||
eventQueue = _eventQueue_;
|
||||
$log = _$log_;
|
||||
|
||||
jobResultsService.getEvents.and
|
||||
.returnValue($q.when(eventResolve));
|
||||
@ -97,7 +98,8 @@ describe('Controller: jobResultsController', () => {
|
||||
ParseTypeChange: ParseTypeChange,
|
||||
jobResultsService: jobResultsService,
|
||||
eventQueue: eventQueue,
|
||||
$compile: $compile
|
||||
$compile: $compile,
|
||||
$log: $log
|
||||
});
|
||||
});
|
||||
};
|
||||
@ -563,6 +565,8 @@ describe('Controller: jobResultsController', () => {
|
||||
|
||||
bootstrapTest();
|
||||
|
||||
spyOn($log, 'error');
|
||||
|
||||
$scope.followEngaged = true;
|
||||
|
||||
$scope.$apply();
|
||||
@ -570,6 +574,10 @@ describe('Controller: jobResultsController', () => {
|
||||
|
||||
it('creates new child scope for the event', () => {
|
||||
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?");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user