diff --git a/src/modal/modal.js b/src/modal/modal.js index 8f38db4ecd..3c8f74f293 100644 --- a/src/modal/modal.js +++ b/src/modal/modal.js @@ -391,7 +391,7 @@ angular.module('ui.bootstrap.modal', []) var promiseChain = null; $modal.getPromiseChain = function() { return promiseChain; - } + }; $modal.open = function (modalOptions) { @@ -428,7 +428,8 @@ angular.module('ui.bootstrap.modal', []) // Then switch to our own combined promise dependency (regardless of how the previous modal fared). // Then add to $modalStack and resolve opened. // Finally clean up the chain variable if no subsequent modal has overwritten it. - var samePromise = promiseChain = $q.all([promiseChain]) + var samePromise; + samePromise = promiseChain = $q.all([promiseChain]) .then(function() { return templateAndResolvePromise; }, function() { return templateAndResolvePromise; }) .then(function resolveSuccess(tplAndVars) { diff --git a/src/modal/test/modal.spec.js b/src/modal/test/modal.spec.js index 7668070286..9cc048c4d5 100644 --- a/src/modal/test/modal.spec.js +++ b/src/modal/test/modal.spec.js @@ -1,6 +1,6 @@ describe('$modal', function () { var $controllerProvider, $rootScope, $document, $compile, $templateCache, $timeout, $q; - var $modal, $modalProvider; + var $modal, $modalStack, $modalProvider; var triggerKeyDown = function (element, keyCode) { var e = $.Event('keydown'); @@ -16,7 +16,7 @@ describe('$modal', function () { $modalProvider = _$modalProvider_; })); - beforeEach(inject(function (_$rootScope_, _$document_, _$compile_, _$templateCache_, _$timeout_, _$q_, _$modal_) { + beforeEach(inject(function (_$rootScope_, _$document_, _$compile_, _$templateCache_, _$timeout_, _$q_, _$modal_, _$modalStack_) { $rootScope = _$rootScope_; $document = _$document_; $compile = _$compile_; @@ -24,6 +24,7 @@ describe('$modal', function () { $timeout = _$timeout_; $q = _$q_; $modal = _$modal_; + $modalStack = _$modalStack_; })); beforeEach(function () { @@ -796,12 +797,14 @@ describe('$modal', function () { // Calls emit n! times on arrays of length n containing all non-repeating permutations of the integers 0..n-1. function permute(n, emit) { - if (n < 1 || typeof emit !== 'function') return; + if (n < 1 || typeof emit !== 'function') { + return; + } var a = []; function _permute(depth) { index: for (var i=0; i < n; i++) { for (var j=0; j < depth; j++) { - if (a[j] == i) { + if (a[j] === i) { continue index; // already used } } @@ -819,11 +822,11 @@ describe('$modal', function () { permute(2, function(a) { test(a); }); permute(2, function(a) { test(a.map(function(x, i) { return {reject:x}; })); }); - permute(2, function(a) { test(a.map(function(x, i) { return i == 0 ? {reject:x} : x; })); }); + permute(2, function(a) { test(a.map(function(x, i) { return i === 0 ? {reject:x} : x; })); }); permute(3, function(a) { test(a); }); permute(3, function(a) { test(a.map(function(x, i) { return {reject:x}; })); }); - permute(3, function(a) { test(a.map(function(x, i) { return i == 0 ? {reject:x} : x; })); }); - permute(3, function(a) { test(a.map(function(x, i) { return i == 1 ? {reject:x} : x; })); }); + permute(3, function(a) { test(a.map(function(x, i) { return i === 0 ? {reject:x} : x; })); }); + permute(3, function(a) { test(a.map(function(x, i) { return i === 1 ? {reject:x} : x; })); }); }); });