Skip to content

Commit

Permalink
fix(dialog)!: remove toggleShow()
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Use dialog.open, dialog.show(), and dialog.close() instead.

PiperOrigin-RevId: 553622255
  • Loading branch information
asyncLiz authored and Copybara-Service committed Aug 3, 2023
1 parent 500472b commit b992b15
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 23 deletions.
19 changes: 7 additions & 12 deletions dialog/dialog_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,13 @@ describe('<md-dialog>', () => {
expect(await harness.isDialogVisible()).toBeFalse();
});

it('renders open state by calling show()/close()/toggleShow()',
async () => {
const {harness} = await setupTest();
harness.element.show();
expect(await harness.isDialogVisible()).toBeTrue();
harness.element.close();
expect(await harness.isDialogVisible()).toBeFalse();
harness.element.toggleShow();
expect(await harness.isDialogVisible()).toBeTrue();
harness.element.toggleShow();
expect(await harness.isDialogVisible()).toBeFalse();
});
it('renders open state by calling show()/close()', async () => {
const {harness} = await setupTest();
harness.element.show();
expect(await harness.isDialogVisible()).toBeTrue();
harness.element.close();
expect(await harness.isDialogVisible()).toBeFalse();
});

it('renders scrim', async () => {
const {harness} = await setupTest();
Expand Down
11 changes: 0 additions & 11 deletions dialog/internal/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,17 +159,6 @@ export class Dialog extends LitElement {
this.open = false;
}

/**
* Opens and shows the dialog if it is closed; otherwise closes it.
*/
toggleShow() {
if (this.open) {
this.close(this.currentAction);
} else {
this.show();
}
}

private getContentScrollInfo() {
if (!this.hasUpdated || !this.contentElement) {
return {isScrollable: false, isAtScrollTop: true, isAtScrollBottom: true};
Expand Down

0 comments on commit b992b15

Please sign in to comment.