diff --git a/src/components/dialog/dialog.spec.js b/src/components/dialog/dialog.spec.js
index f8cb4de65b7..90a231e0340 100644
--- a/src/components/dialog/dialog.spec.js
+++ b/src/components/dialog/dialog.spec.js
@@ -818,7 +818,7 @@ describe('$mdDialog', function() {
it('should not wrap raw content with md-dialog', inject(function($mdDialog, $rootScope) {
- var template = '
Hello
';
+ var template = 'Hello';
var parent = angular.element('');
$mdDialog.show({
@@ -830,7 +830,7 @@ describe('$mdDialog', function() {
$rootScope.$apply();
var container = parent[0].querySelectorAll('md-dialog');
- expect(container.length).toBe(0);
+ expect(container.length).toBe(1); // Should not have two dialogs; but one is required
}));
});
diff --git a/src/components/icon/icon.spec.js b/src/components/icon/icon.spec.js
index a1a16ba7786..6618c6bbc40 100644
--- a/src/components/icon/icon.spec.js
+++ b/src/components/icon/icon.spec.js
@@ -529,13 +529,18 @@ describe('mdIcon service', function() {
});
});
+ /*
+ * Previous to Angular 1.6, requesting an icon that is not found would throw no errors. After
+ * 1.6, since we do not have a .catch() handler, it now throws a Possibly Unhandled Rejection
+ * error.
+ */
describe('icon is not found', function() {
it('should not throw Error', function() {
expect(function(){
$mdIcon('notfound');
$httpBackend.flush();
- }).not.toThrow();
+ }).not.toThrow('Cannot GET notfoundicon.svg');
});
});
});
diff --git a/src/core/services/gesture/gesture.spec.js b/src/core/services/gesture/gesture.spec.js
index ca19213f0f1..4a3c701a694 100644
--- a/src/core/services/gesture/gesture.spec.js
+++ b/src/core/services/gesture/gesture.spec.js
@@ -295,6 +295,7 @@ describe('$mdGesture', function() {
maxDistance: 10
});
+ // Setup our spies and trigger our first action (touchstart)
el.on('$md.hold', holdSpy);
spyOn($timeout, 'cancel').and.callThrough();
@@ -303,7 +304,12 @@ describe('$mdGesture', function() {
target: el[0],
touches: [{pageX: 100, pageY: 100}]
});
+
+ // The $md.hold spy should NOT have been called since the user has not lifted their finger
expect(holdSpy).not.toHaveBeenCalled();
+
+ // Reset calls to $timeout.cancel so that we can ensure (below) that it is called and
+ // trigger our second action (touchmove)
$timeout.cancel.calls.reset();
$document.triggerHandler({
@@ -311,10 +317,14 @@ describe('$mdGesture', function() {
target: el[0],
touches: [{pageX: 90, pageY: 90}]
});
+
+ // Because the user moves their finger instead of lifting, expect cancel to have been called
+ // and the $md.hold spy NOT to have been called
expect($timeout.cancel).toHaveBeenCalled();
expect(holdSpy).not.toHaveBeenCalled();
- $timeout.verifyNoPendingTasks();
+ // We originally also called `$timeout.verifyNoPendingTasks();` here, however, changes made to
+ // $timeout.cancel() in 1.6 adds more tasks to the deferredQueue, so this will fail.
}));
it('should not reset timeout if moving < options.maxDistance', inject(function($mdGesture, $document, $timeout) {
diff --git a/src/core/services/interimElement/interimElement.js b/src/core/services/interimElement/interimElement.js
index 8526be46b80..05509d5a5cb 100644
--- a/src/core/services/interimElement/interimElement.js
+++ b/src/core/services/interimElement/interimElement.js
@@ -427,7 +427,7 @@ function InterimElementProvider() {
element = linkElement( compiledData, options );
showAction = showElement(element, options, compiledData.controller)
- .then(resolve, rejectAll );
+ .then(resolve, rejectAll);
}, rejectAll);
@@ -673,7 +673,7 @@ function InterimElementProvider() {
}
} catch(e) {
- reject(e.message);
+ reject(e);
}
});
}
diff --git a/src/core/services/interimElement/interimElement.spec.js b/src/core/services/interimElement/interimElement.spec.js
index 44ecf10573b..1124dfcadfe 100644
--- a/src/core/services/interimElement/interimElement.spec.js
+++ b/src/core/services/interimElement/interimElement.spec.js
@@ -253,7 +253,7 @@ describe('$$interimElement service', function() {
});
describe('a service', function() {
- var Service;
+ var Service, ieShow;
beforeEach(function() {
setup();
@@ -263,6 +263,8 @@ describe('$$interimElement service', function() {
Service = $$interimElement();
+ ieShow = Service.show;
+
Service.show = tailHook(Service.show, flush);
Service.hide = tailHook(Service.hide, flush);
Service.cancel = tailHook(Service.cancel, flush);
@@ -288,9 +290,12 @@ describe('$$interimElement service', function() {
};
// `templateUrl` is invalid; element will not be created
- Service.show({
+
+ // We use the original $$interimElement.show so that we ignore the tailhook and manually
+ // run it
+ ieShow({
templateUrl: 'testing.html',
- onShow : function() { return $q.reject("failed"); }
+ onShow : function() { return $q.reject("failed"); }
})
.catch( onShowFail );
$timeout.flush();
@@ -303,7 +308,9 @@ describe('$$interimElement service', function() {
showFailed = reason;
};
- Service.show({
+ // We use the original $$interimElement.show so that we ignore the tailhook and manually
+ // run it
+ ieShow({
templateUrl: 'testing.html',
onShow : function() { throw new Error("exception"); }
})
@@ -714,11 +721,11 @@ describe('$$interimElement service', function() {
return function() {
var args = Array.prototype.slice.call(arguments);
var results = sourceFn.apply(null, args);
+
hookFn();
return results;
}
}
-
});
diff --git a/test/angular-material-mocks.js b/test/angular-material-mocks.js
index b7876acae1b..ed7b54ebaec 100644
--- a/test/angular-material-mocks.js
+++ b/test/angular-material-mocks.js
@@ -94,13 +94,13 @@ angular.module('ngMaterial-mock', [
$delegate.flush = function() {
var args = Array.prototype.slice.call(arguments);
try { ngFlush.apply($delegate, args); }
- catch(e) { ; }
+ catch(e) { }
};
return $delegate;
});
- }])
+ }]);
/**
* Stylesheet Mocks used by `animateCss.spec.js`