FEATURE: add an option to create undismissable modals

This commit is contained in:
Jeff Wong
2018-06-04 18:34:41 -07:00
parent 42847252a4
commit b7d92061e2
4 changed files with 36 additions and 5 deletions
@@ -1,4 +1,6 @@
import { acceptance } from "helpers/qunit-helpers";
import showModal from 'discourse/lib/show-modal';
acceptance("Modal");
QUnit.test("modal", assert => {
@@ -27,4 +29,19 @@ QUnit.test("modal", assert => {
andThen(() => {
assert.ok(find('.d-modal:visible').length === 0, 'ESC should close the modal');
});
andThen(() => {
Ember.TEMPLATES['modal/not-dismissable'] = Ember.HTMLBars.compile('{{#d-modal-body title="" class="" dismissable=false}}test{{/d-modal-body}}');
showModal('not-dismissable', {});
});
andThen(() => {
assert.ok(find('.d-modal:visible').length === 1, 'modal should appear');
});
click('.modal-outer-container');
andThen(() => {
assert.ok(find('.d-modal:visible').length === 1, 'modal should not disappear when you click outside');
});
keyEvent('#main-outlet', 'keydown', 27);
andThen(() => {
assert.ok(find('.d-modal:visible').length === 1, 'ESC should not close the modal');
});
});