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

Commit

Permalink
fix(dialog): removed no dialog actions warning
Browse files Browse the repository at this point in the history
It is a valid use-case to have a dialog that you only close programmatically based on some user action. As such, there shouldn't be a warning when there are no md-dialog-actions present.

fixes #5767
  • Loading branch information
EladBezalel committed Nov 16, 2015
1 parent 9d52697 commit 5faa591
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 24 deletions.
3 changes: 0 additions & 3 deletions src/components/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -563,9 +563,6 @@ function MdDialogProvider($$interimElementProvider) {
if (!closeButton) {
var actionButtons = element[0].querySelectorAll('.md-actions button, md-dialog-actions button');
closeButton = actionButtons[actionButtons.length - 1];
if (actionButtons.length === 0) {
$log.warn('At least one action button is required for <md-dialog-actions>.');
}
}
return angular.element(closeButton);
}
Expand Down
21 changes: 0 additions & 21 deletions src/components/dialog/dialog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -991,27 +991,6 @@ describe('$mdDialog', function() {
expect($log.warn).toHaveBeenCalled();
}));

it('should warn if focusOnOpen == true and md-dialog-actions does not contain actions',
inject(function($mdDialog, $rootScope, $log, $timeout) {
spyOn($log, 'warn');

var parent = angular.element('<div>');
$mdDialog.show({
focusOnOpen: true,
template:
'<md-dialog>' +
'<md-dialog-actions>' +
'<p>Why is this here</p>' +
'</md-dialog-actions>' +
'</md-dialog>',
parent: parent
});

runAnimation();

expect($log.warn).toHaveBeenCalled();
}));

// This also covers the case of NOT warning when the deprecated .md-actions class is NOT used
it('should not warn if focusOnOpen == true and md-dialog-actions has actions',
inject(function($mdDialog, $rootScope, $log, $timeout) {
Expand Down

0 comments on commit 5faa591

Please sign in to comment.