discourse/test/javascripts/acceptance/modal-test.js.es6

30 lines
845 B
Plaintext
Raw Normal View History

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