Migrate away from #discourse-modal to .d-modal

This commit is contained in:
Robin Ward
2017-08-30 15:29:51 -04:00
parent 8fcd5af5b1
commit 3d95bac3fb
7 changed files with 19 additions and 19 deletions

View File

@ -4,7 +4,7 @@ export default Ember.Component.extend({
didInsertElement() { didInsertElement() {
this._super(); this._super();
$('#modal-alert').hide(); $('#modal-alert').hide();
$('#discourse-modal').modal('show'); $('.d-modal').modal('show');
Ember.run.scheduleOnce('afterRender', this, this._afterFirstRender); Ember.run.scheduleOnce('afterRender', this, this._afterFirstRender);
this.appEvents.on('modal-body:flash', msg => this._flash(msg)); this.appEvents.on('modal-body:flash', msg => this._flash(msg));
}, },

View File

@ -1,6 +1,6 @@
export default Ember.Component.extend({ export default Ember.Component.extend({
didInsertElement() { didInsertElement() {
this._super(); this._super();
$('#discourse-modal').modal('hide').addClass('hidden'); $('.d-modal').modal('hide').addClass('hidden');
} }
}); });

View File

@ -121,11 +121,11 @@ const ApplicationRoute = Discourse.Route.extend(OpenComposer, {
user clicks "No", reopenModal. If user clicks "Yes", be sure to call closeModal. user clicks "No", reopenModal. If user clicks "Yes", be sure to call closeModal.
**/ **/
hideModal() { hideModal() {
$('#discourse-modal').modal('hide'); $('.d-modal').modal('hide');
}, },
reopenModal() { reopenModal() {
$('#discourse-modal').modal('show'); $('.d-modal').modal('show');
}, },
editCategory(category) { editCategory(category) {

View File

@ -22,7 +22,7 @@
.post-action, .post-action,
.saving-text, .saving-text,
.draft-text, .draft-text,
#discourse-modal, .discourse-modal,
div.read-state, div.read-state,
div.read-state.read, div.read-state.read,
.edit-topic, .edit-topic,

View File

@ -11,12 +11,12 @@ QUnit.test("Can open the category modal", assert => {
click('.edit-category'); click('.edit-category');
andThen(() => { andThen(() => {
assert.ok(visible('#discourse-modal'), 'it pops up a modal'); assert.ok(visible('.d-modal'), 'it pops up a modal');
}); });
click('a.close'); click('a.close');
andThen(() => { 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'); fillIn('#edit-text-color', '#ff0000');
click('#save-category'); click('#save-category');
andThen(() => { 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'); 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'); fillIn('.d-editor-input', 'this is the new topic template');
click('#save-category'); click('#save-category');
andThen(() => { 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'); assert.equal(DiscourseURL.redirectedTo, '/c/bug', 'it does one of the rare full page redirects');
}); });
}); });

View File

@ -115,13 +115,13 @@ QUnit.test("Create an enqueued Topic", assert => {
fillIn('.d-editor-input', "enqueue this content please"); fillIn('.d-editor-input', "enqueue this content please");
click('#reply-control button.create'); click('#reply-control button.create');
andThen(() => { 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"); assert.equal(currentURL(), "/", "it doesn't change routes");
}); });
click('.modal-footer button'); click('.modal-footer button');
andThen(() => { 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(() => { 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'); click('.modal-footer button');
andThen(() => { andThen(() => {
assert.ok(invisible('#discourse-modal'), 'the modal can be dismissed'); assert.ok(invisible('.d-modal'), 'the modal can be dismissed');
}); });
}); });

View File

@ -5,26 +5,26 @@ QUnit.test("modal", assert => {
visit('/'); visit('/');
andThen(() => { 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'); click('.login-button');
andThen(() => { 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'); click('.modal-outer-container');
andThen(() => { 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'); click('.login-button');
andThen(() => { 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); keyEvent('#main-outlet', 'keydown', 27);
andThen(() => { 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');
}); });
}); });