Skip to content

Commit

Permalink
clear custommodalcontent, clear config + ts skiplibcheck (#70)
Browse files Browse the repository at this point in the history
* clear custommodalcontent, clear config + ts skiplibcheck

* test for custom modal content
  • Loading branch information
iisa authored Oct 10, 2023
1 parent 897d021 commit 0c1e2e5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/modal-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ export class ModalManager extends LitElement implements ModalManagerInterface {
/** @inheritdoc */
closeModal(): void {
this.mode = ModalManagerMode.Closed;
this.customModalContent = undefined;
this.modalTemplate.config = new ModalConfig();
}

/**
Expand Down
7 changes: 6 additions & 1 deletion test/modal-manager.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { fixture, expect, oneEvent, elementUpdated } from '@open-wc/testing';
import { html } from 'lit';
import { TemplateResult, html } from 'lit';

import '../src/modal-manager';
import { ModalConfig } from '../src/modal-config';
Expand All @@ -21,10 +21,15 @@ describe('Modal Manager', () => {
<modal-manager .mode=${ModalManagerMode.Open}></modal-manager>
`)) as ModalManager;

el.customModalContent = ('foo' as unknown) as TemplateResult;
await elementUpdated(el);

expect(el.customModalContent).to.equal('foo');
el.closeModal();
await elementUpdated(el);

expect(el.mode).to.equal('closed');
expect(el.customModalContent).to.equal(undefined);
});

it('can be closed by clicking on the backdrop', async () => {
Expand Down

0 comments on commit 0c1e2e5

Please sign in to comment.