Fix Karma test

This commit is contained in:
Gustavo Maximiliano Cortez 2014-07-31 22:49:11 -03:00
parent f704826a5c
commit dbf812f848
3 changed files with 5 additions and 5 deletions

View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
angular.module('copayApp.controllers').controller('SidebarController', angular.module('copayApp.controllers').controller('SidebarController',
function($scope, $rootScope, $sce, $location, $http, $idle, notification, controllerUtils) { function($scope, $rootScope, $sce, $location, $http, notification, controllerUtils) {
$scope.version = copay.version; $scope.version = copay.version;
$scope.networkName = config.networkName; $scope.networkName = config.networkName;
@ -83,14 +83,11 @@ angular.module('copayApp.controllers').controller('SidebarController',
controllerUtils.setSocketHandlers(); controllerUtils.setSocketHandlers();
if ($rootScope.wallet) { if ($rootScope.wallet) {
$idle.watch();
$scope.$on('$idleStart', function(a) { $scope.$on('$idleStart', function(a) {
notification.warning('Timing', 'You were enought time in inactivity. This session will be closed in 10 seconds if continues without activity'); notification.warning('Timing', 'You were enought time in inactivity. This session will be closed in 10 seconds if continues without activity');
}); });
$scope.$on('$idleTimeout', function() { $scope.$on('$idleTimeout', function() {
$idle.unwatch();
$scope.signout(); $scope.signout();
notification.warning('Session closed', 'Session closed for a long time of inactivity'); notification.warning('Session closed', 'Session closed for a long time of inactivity');
}); });

View File

@ -73,12 +73,14 @@ angular
$idleProvider.idleDuration(15 * 60); // in seconds $idleProvider.idleDuration(15 * 60); // in seconds
$idleProvider.warningDuration(10); // in seconds $idleProvider.warningDuration(10); // in seconds
}) })
.run(function($rootScope, $location) { .run(function($rootScope, $location, $idle) {
$idle.watch();
$rootScope.$on('$routeChangeStart', function(event, next, current) { $rootScope.$on('$routeChangeStart', function(event, next, current) {
if (!util.supports.data) { if (!util.supports.data) {
$location.path('unsupported'); $location.path('unsupported');
} else { } else {
if ((!$rootScope.wallet || !$rootScope.wallet.id) && next.validate) { if ((!$rootScope.wallet || !$rootScope.wallet.id) && next.validate) {
$idle.unwatch();
$location.path('/'); $location.path('/');
} }
if ($rootScope.wallet && !$rootScope.wallet.isReady()) { if ($rootScope.wallet && !$rootScope.wallet.isReady()) {

View File

@ -21,6 +21,7 @@ module.exports = function(config) {
'lib/angular/angular.min.js', 'lib/angular/angular.min.js',
'lib/angular-mocks/angular-mocks.js', 'lib/angular-mocks/angular-mocks.js',
'lib/moment/moment.js', 'lib/moment/moment.js',
'lib/ng-idle/angular-idle.min.js',
'lib/angular-moment/angular-moment.js', 'lib/angular-moment/angular-moment.js',
'lib/qrcode-generator/js/qrcode.js', 'lib/qrcode-generator/js/qrcode.js',
'lib/angular-qrcode/qrcode.js', 'lib/angular-qrcode/qrcode.js',