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