mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 09:42:07 +08:00
30 lines
845 B
JavaScript
30 lines
845 B
JavaScript
import { acceptance } from "helpers/qunit-helpers";
|
|
acceptance("Modal");
|
|
|
|
QUnit.test("modal", assert => {
|
|
visit('/');
|
|
|
|
andThen(() => {
|
|
assert.ok(find('#discourse-modal:visible').length === 0, 'there is no modal at first');
|
|
});
|
|
|
|
click('.login-button');
|
|
andThen(() => {
|
|
assert.ok(find('#discourse-modal:visible').length === 1, 'modal should appear');
|
|
});
|
|
|
|
click('.modal-outer-container');
|
|
andThen(() => {
|
|
assert.ok(find('#discourse-modal:visible').length === 0, 'modal should disappear when you click outside');
|
|
});
|
|
|
|
click('.login-button');
|
|
andThen(() => {
|
|
assert.ok(find('#discourse-modal:visible').length === 1, 'modal should reappear');
|
|
});
|
|
|
|
keyEvent('#main-outlet', 'keydown', 27);
|
|
andThen(() => {
|
|
assert.ok(find('#discourse-modal:visible').length === 0, 'ESC should close the modal');
|
|
});
|
|
}); |