mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 08:09:33 +08:00
Migrate away from #discourse-modal
to .d-modal
This commit is contained in:
parent
8fcd5af5b1
commit
3d95bac3fb
|
@ -4,7 +4,7 @@ export default Ember.Component.extend({
|
|||
didInsertElement() {
|
||||
this._super();
|
||||
$('#modal-alert').hide();
|
||||
$('#discourse-modal').modal('show');
|
||||
$('.d-modal').modal('show');
|
||||
Ember.run.scheduleOnce('afterRender', this, this._afterFirstRender);
|
||||
this.appEvents.on('modal-body:flash', msg => this._flash(msg));
|
||||
},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export default Ember.Component.extend({
|
||||
didInsertElement() {
|
||||
this._super();
|
||||
$('#discourse-modal').modal('hide').addClass('hidden');
|
||||
$('.d-modal').modal('hide').addClass('hidden');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -121,11 +121,11 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
|
|||
user clicks "No", reopenModal. If user clicks "Yes", be sure to call closeModal.
|
||||
**/
|
||||
hideModal() {
|
||||
$('#discourse-modal').modal('hide');
|
||||
$('.d-modal').modal('hide');
|
||||
},
|
||||
|
||||
reopenModal() {
|
||||
$('#discourse-modal').modal('show');
|
||||
$('.d-modal').modal('show');
|
||||
},
|
||||
|
||||
editCategory(category) {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
.post-action,
|
||||
.saving-text,
|
||||
.draft-text,
|
||||
#discourse-modal,
|
||||
.discourse-modal,
|
||||
div.read-state,
|
||||
div.read-state.read,
|
||||
.edit-topic,
|
||||
|
|
|
@ -11,12 +11,12 @@ QUnit.test("Can open the category modal", assert => {
|
|||
|
||||
click('.edit-category');
|
||||
andThen(() => {
|
||||
assert.ok(visible('#discourse-modal'), 'it pops up a modal');
|
||||
assert.ok(visible('.d-modal'), 'it pops up a modal');
|
||||
});
|
||||
|
||||
click('a.close');
|
||||
andThen(() => {
|
||||
assert.ok(!visible('#discourse-modal'), 'it closes the modal');
|
||||
assert.ok(!visible('.d-modal'), 'it closes the modal');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -27,7 +27,7 @@ QUnit.test("Change the category color", assert => {
|
|||
fillIn('#edit-text-color', '#ff0000');
|
||||
click('#save-category');
|
||||
andThen(() => {
|
||||
assert.ok(!visible('#discourse-modal'), 'it closes the modal');
|
||||
assert.ok(!visible('.d-modal'), 'it closes the modal');
|
||||
assert.equal(DiscourseURL.redirectedTo, '/c/bug', 'it does one of the rare full page redirects');
|
||||
});
|
||||
});
|
||||
|
@ -40,7 +40,7 @@ QUnit.test("Change the topic template", assert => {
|
|||
fillIn('.d-editor-input', 'this is the new topic template');
|
||||
click('#save-category');
|
||||
andThen(() => {
|
||||
assert.ok(!visible('#discourse-modal'), 'it closes the modal');
|
||||
assert.ok(!visible('.d-modal'), 'it closes the modal');
|
||||
assert.equal(DiscourseURL.redirectedTo, '/c/bug', 'it does one of the rare full page redirects');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -115,13 +115,13 @@ QUnit.test("Create an enqueued Topic", assert => {
|
|||
fillIn('.d-editor-input', "enqueue this content please");
|
||||
click('#reply-control button.create');
|
||||
andThen(() => {
|
||||
assert.ok(visible('#discourse-modal'), 'it pops up a modal');
|
||||
assert.ok(visible('.d-modal'), 'it pops up a modal');
|
||||
assert.equal(currentURL(), "/", "it doesn't change routes");
|
||||
});
|
||||
|
||||
click('.modal-footer button');
|
||||
andThen(() => {
|
||||
assert.ok(invisible('#discourse-modal'), 'the modal can be dismissed');
|
||||
assert.ok(invisible('.d-modal'), 'the modal can be dismissed');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -183,12 +183,12 @@ QUnit.test("Create an enqueued Reply", assert => {
|
|||
});
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(visible('#discourse-modal'), 'it pops up a modal');
|
||||
assert.ok(visible('.d-modal'), 'it pops up a modal');
|
||||
});
|
||||
|
||||
click('.modal-footer button');
|
||||
andThen(() => {
|
||||
assert.ok(invisible('#discourse-modal'), 'the modal can be dismissed');
|
||||
assert.ok(invisible('.d-modal'), 'the modal can be dismissed');
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -5,26 +5,26 @@ QUnit.test("modal", assert => {
|
|||
visit('/');
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(find('#discourse-modal:visible').length === 0, 'there is no modal at first');
|
||||
assert.ok(find('.d-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');
|
||||
assert.ok(find('.d-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');
|
||||
assert.ok(find('.d-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');
|
||||
assert.ok(find('.d-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');
|
||||
assert.ok(find('.d-modal:visible').length === 0, 'ESC should close the modal');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue
Block a user