Refstack pop up window should remain open before users click close.

Closes-Bug: #1492360

Change-Id: I91a56602e69e795f3d1e94dba89d50253ada0da6
This commit is contained in:
david liu 2015-09-18 16:51:05 +08:00 committed by Sergey Slipushenko
parent 4c69e1764e
commit 8f730eb46f
2 changed files with 34 additions and 5 deletions

View File

@ -27,16 +27,15 @@ refstackApp.factory('raiseAlert',
refstackApp.controller('raiseAlertModalController', refstackApp.controller('raiseAlertModalController',
['$scope', '$modalInstance', '$interval', 'data', ['$scope', '$modalInstance', 'data',
function ($scope, $modalInstance, $interval, data) { function ($scope, $modalInstance, data) {
'use strict'; 'use strict';
$scope.data = data; $scope.data = data;
//wait for users click to close the pop up window.
$scope.close = function() { $scope.close = function() {
$modalInstance.close(); $modalInstance.close();
}; };
$interval(function(){
$scope.close();
}, 3000, 1);
} }
] ]
); );

View File

@ -582,4 +582,34 @@ describe('Refstack controllers', function () {
expect(scope.getTestListString()).toEqual(expectedString); expect(scope.getTestListString()).toEqual(expectedString);
}); });
}); });
describe('testRaiseAlertModalController', function() {
var data;
var scope, modalInstance;
data = {
mode: 'success',
title: '',
text: 'operation successful'
};
beforeEach(inject(function ($rootScope, $controller) {
scope = $rootScope.$new();
modalInstance = {
dismiss: jasmine.createSpy('modalInstance.dismiss'),
close: jasmine.createSpy('modalInstance.close')
};
$controller('raiseAlertModalController', {
$scope: scope,
$modalInstance: modalInstance,
data: data
});
}));
it('should close',
function () {
scope.close();
expect(modalInstance.close).toHaveBeenCalledWith();
});
});
}); });