Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

Commit

Permalink
style: fix style and test errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan Williams committed Apr 17, 2015
1 parent 8907241 commit d5238c6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
5 changes: 3 additions & 2 deletions src/modal/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ angular.module('ui.bootstrap.modal', [])
var promiseChain = null;
$modal.getPromiseChain = function() {
return promiseChain;
}
};

$modal.open = function (modalOptions) {

Expand Down Expand Up @@ -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) {

Expand Down
17 changes: 10 additions & 7 deletions src/modal/test/modal.spec.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -16,14 +16,15 @@ 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_;
$templateCache = _$templateCache_;
$timeout = _$timeout_;
$q = _$q_;
$modal = _$modal_;
$modalStack = _$modalStack_;
}));

beforeEach(function () {
Expand Down Expand Up @@ -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
}
}
Expand All @@ -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; })); });
});
});

Expand Down

0 comments on commit d5238c6

Please sign in to comment.