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

Commit

Permalink
update(dialog): remove .md-actions deprecation (#9637)
Browse files Browse the repository at this point in the history
* Removes the `.md-actions` deprecation from pre- v1.0.0
* Simplifies the method to search for a close button

Closes #9633
  • Loading branch information
devversion authored and kara committed Oct 16, 2016
1 parent 1e4ba35 commit 2c286b4
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 39 deletions.
19 changes: 1 addition & 18 deletions src/components/dialog/dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -725,19 +725,9 @@ function MdDialogProvider($$interimElementProvider) {
return dialogPopIn(element, options)
.then(function() {
lockScreenReader(element, options);
warnDeprecatedActions();
focusOnOpen();
});

/**
* Check to see if they used the deprecated .md-actions class and log a warning
*/
function warnDeprecatedActions() {
if (element[0].querySelector('.md-actions')) {
$log.warn('Using a class of md-actions is deprecated, please use <md-dialog-actions>.');
}
}

/**
* For alerts, focus on content... otherwise focus on
* the close button (or equivalent)
Expand All @@ -755,14 +745,7 @@ function MdDialogProvider($$interimElementProvider) {
* If we find no actions at all, log a warning to the console.
*/
function findCloseButton() {
var closeButton = element[0].querySelector('.dialog-close');

if (!closeButton) {
var actionButtons = element[0].querySelectorAll('.md-actions button, md-dialog-actions button');
closeButton = actionButtons[actionButtons.length - 1];
}

return closeButton;
return element[0].querySelector('.dialog-close, md-dialog-actions button:last-child');
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/dialog/dialog.scss
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ md-dialog {
}
}

.md-actions, md-dialog-actions {
md-dialog-actions {
display: flex;
order: 2;
box-sizing: border-box;
Expand All @@ -100,7 +100,7 @@ md-dialog {
}
}
&.md-content-overflow {
.md-actions, md-dialog-actions {
md-dialog-actions {
border-top-width: 1px;
border-top-style: solid;
}
Expand Down
19 changes: 0 additions & 19 deletions src/components/dialog/dialog.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -1197,25 +1197,6 @@ describe('$mdDialog', function() {
expect($document.activeElement).toBe(parent[0].querySelector('#focus-target'));
}));

it('should warn if the deprecated .md-actions class is used', inject(function($mdDialog, $rootScope, $log, $timeout) {
spyOn($log, 'warn');

var parent = angular.element('<div>');
$mdDialog.show({
template:
'<md-dialog>' +
'<div class="md-actions">' +
'<button class="md-button">Ok good</button>' +
'</div>' +
'</md-dialog>',
parent: parent
});

runAnimation();

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

it('should only allow one open at a time', inject(function($mdDialog, $rootScope, $animate) {
var parent = angular.element('<div>');
$mdDialog.show({
Expand Down

0 comments on commit 2c286b4

Please sign in to comment.