2015-04-06 13:14:00 -05:00
|
|
|
import { acceptance } from "helpers/qunit-helpers";
|
|
|
|
acceptance("Modal");
|
2014-09-08 15:52:49 -05:00
|
|
|
|
2017-06-14 12:57:58 -05:00
|
|
|
QUnit.test("modal", assert => {
|
2014-09-08 15:52:49 -05:00
|
|
|
visit('/');
|
|
|
|
|
2015-03-19 06:22:56 -05:00
|
|
|
andThen(() => {
|
2017-06-14 12:57:58 -05:00
|
|
|
assert.ok(find('#discourse-modal:visible').length === 0, 'there is no modal at first');
|
2014-09-08 15:52:49 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
click('.login-button');
|
2015-03-19 06:22:56 -05:00
|
|
|
andThen(() => {
|
2017-06-14 12:57:58 -05:00
|
|
|
assert.ok(find('#discourse-modal:visible').length === 1, 'modal should appear');
|
2014-09-08 15:52:49 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
click('.modal-outer-container');
|
2015-03-19 06:22:56 -05:00
|
|
|
andThen(() => {
|
2017-06-14 12:57:58 -05:00
|
|
|
assert.ok(find('#discourse-modal:visible').length === 0, 'modal should disappear when you click outside');
|
2014-09-08 15:52:49 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
click('.login-button');
|
2015-03-19 06:22:56 -05:00
|
|
|
andThen(() => {
|
2017-06-14 12:57:58 -05:00
|
|
|
assert.ok(find('#discourse-modal:visible').length === 1, 'modal should reappear');
|
2014-09-08 15:52:49 -05:00
|
|
|
});
|
|
|
|
|
2015-04-06 13:04:22 -05:00
|
|
|
keyEvent('#main-outlet', 'keydown', 27);
|
2015-03-19 06:22:56 -05:00
|
|
|
andThen(() => {
|
2017-06-14 12:57:58 -05:00
|
|
|
assert.ok(find('#discourse-modal:visible').length === 0, 'ESC should close the modal');
|
2014-09-08 15:52:49 -05:00
|
|
|
});
|
2017-06-14 12:57:58 -05:00
|
|
|
});
|