Skip to content

fix(material-experimental/mdc-dialog): use same container selector as non-mdc version #23074

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/material-experimental/mdc-dialog/dialog-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {cssClasses, numbers} from '@material/dialog';
* @docs-private
*/
@Component({
selector: 'mat-mdc-dialog-container',
selector: 'mat-dialog-container',
templateUrl: 'dialog-container.html',
styleUrls: ['dialog.css'],
encapsulation: ViewEncapsulation.None,
Expand Down
20 changes: 10 additions & 10 deletions src/material-experimental/mdc-dialog/dialog.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe('MDC-based dialog', () => {

it('should open a dialog', async () => {
await element(by.id('default')).click();
await expectToExist('mat-mdc-dialog-container');
await expectToExist('mat-dialog-container');
});

it('should open a template dialog', async () => {
Expand All @@ -26,39 +26,39 @@ describe('MDC-based dialog', () => {

await waitForDialog();
await clickOnBackdrop();
await expectToExist('mat-mdc-dialog-container', false);
await expectToExist('mat-dialog-container', false);
});

it('should close by pressing escape', async () => {
await element(by.id('default')).click();

await waitForDialog();
await pressKeys(Key.ESCAPE);
await expectToExist('mat-mdc-dialog-container', false);
await expectToExist('mat-dialog-container', false);
});

it('should close by pressing escape when the first tabbable element has lost focus', async () => {
await element(by.id('default')).click();

await waitForDialog();
await clickElementAtPoint('mat-mdc-dialog-container', {x: 0, y: 0});
await clickElementAtPoint('mat-dialog-container', {x: 0, y: 0});
await pressKeys(Key.ESCAPE);
await expectToExist('mat-mdc-dialog-container', false);
await expectToExist('mat-dialog-container', false);
});

it('should close by clicking on the "close" button', async () => {
await element(by.id('default')).click();

await waitForDialog();
await element(by.id('close')).click();
await expectToExist('mat-mdc-dialog-container', false);
await expectToExist('mat-dialog-container', false);
});

it('should focus the first focusable element', async () => {
await element(by.id('default')).click();

await waitForDialog();
await expectFocusOn('mat-mdc-dialog-container input');
await expectFocusOn('mat-dialog-container input');
});

it('should restore focus to the element that opened the dialog', async () => {
Expand All @@ -84,19 +84,19 @@ describe('MDC-based dialog', () => {

await waitForDialog();
await clickOnBackdrop();
await expectToExist('mat-mdc-dialog-container');
await expectToExist('mat-dialog-container');
});

it('should be able to prevent closing by pressing escape', async () => {
await element(by.id('disabled')).click();

await waitForDialog();
await pressKeys(Key.ESCAPE);
await expectToExist('mat-mdc-dialog-container');
await expectToExist('mat-dialog-container');
});

async function waitForDialog() {
await waitForElement('mat-mdc-dialog-container');
await waitForElement('mat-dialog-container');
}

async function clickOnBackdrop() {
Expand Down
Loading