Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 2b68713

Browse files
ceborrschmukler
authored andcommitted
fix(toast): replace cancel with hide on hideDelay
closes #3558
1 parent 7eefcfe commit 2b68713

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/components/toast/toast.spec.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ describe('$mdToast service', function() {
1616
hasConfigMethods(['content', 'action', 'capsule', 'highlightAction', 'theme']);
1717

1818
it('supports a basic toast', inject(function($mdToast, $rootScope, $timeout, $animate) {
19-
var rejected = false;
19+
var resolved = false;
2020
var parent = angular.element('<div>');
2121
$mdToast.show(
2222
$mdToast.simple({
@@ -25,8 +25,8 @@ describe('$mdToast service', function() {
2525
theme: 'some-theme',
2626
capsule: true
2727
})
28-
).catch(function() {
29-
rejected = true;
28+
).then(function() {
29+
resolved = true;
3030
});
3131
$rootScope.$digest();
3232
expect(parent.find('span').text()).toBe('Do something');
@@ -35,7 +35,7 @@ describe('$mdToast service', function() {
3535
$animate.triggerCallbacks();
3636
$timeout.flush();
3737
$animate.triggerCallbacks();
38-
expect(rejected).toBe(true);
38+
expect(resolved).toBe(true);
3939
}));
4040

4141
it('supports dynamicly updating the content', inject(function($mdToast, $rootScope, $rootElement) {

src/core/services/interimElement/interimElement.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ function InterimElementProvider() {
386386

387387
function startHideTimeout() {
388388
if (options.hideDelay) {
389-
hideTimeout = $timeout(service.cancel, options.hideDelay) ;
389+
hideTimeout = $timeout(service.hide, options.hideDelay) ;
390390
}
391391
}
392392
},

src/core/services/interimElement/interimElement.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,7 @@ describe('$$interimElement service', function() {
277277
}));
278278

279279
it('calls hide after hideDelay', inject(function($animate, $timeout, $rootScope) {
280-
var hideSpy = spyOn(Service, 'cancel').and.callThrough();
280+
var hideSpy = spyOn(Service, 'hide').and.callThrough();
281281
Service.show({hideDelay: 1000});
282282
expect(hideSpy).toHaveBeenCalled();
283283
}));

0 commit comments

Comments
 (0)