Fix JS tests.
This commit is contained in:
parent
f836047f90
commit
44ade676e1
|
@ -1,10 +1,11 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
import InputValidation from 'discourse/models/input-validation';
|
||||
import { default as computed, observes } from 'ember-addons/ember-computed-decorators';
|
||||
import { default as computed, observes, on } from 'ember-addons/ember-computed-decorators';
|
||||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
|
||||
@on('init')
|
||||
setupKeydown() {
|
||||
Ember.run.schedule('afterRender', () => {
|
||||
$('#chat_integration_edit_channel_modal').keydown(e => {
|
||||
|
@ -13,7 +14,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
}
|
||||
});
|
||||
});
|
||||
}.on('init'),
|
||||
},
|
||||
|
||||
// The validation property must be defined at runtime since the possible parameters vary by provider
|
||||
@observes('model')
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import { popupAjaxError } from 'discourse/lib/ajax-error';
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { default as computed, on } from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
saveDisabled: false,
|
||||
|
||||
@on('init')
|
||||
setupKeydown() {
|
||||
Ember.run.schedule('afterRender', () => {
|
||||
$('#chat_integration_edit_channel_modal').keydown(e => {
|
||||
|
@ -13,7 +14,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
}
|
||||
});
|
||||
});
|
||||
}.on('init'),
|
||||
},
|
||||
|
||||
@computed('model.rule.type')
|
||||
showCategory(type) {
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
import ModalFunctionality from 'discourse/mixins/modal-functionality';
|
||||
import { ajax } from 'discourse/lib/ajax';
|
||||
import computed from "ember-addons/ember-computed-decorators";
|
||||
import { default as computed, on } from "ember-addons/ember-computed-decorators";
|
||||
|
||||
export default Ember.Controller.extend(ModalFunctionality, {
|
||||
@on('init')
|
||||
setupKeydown() {
|
||||
Ember.run.schedule('afterRender', () => {
|
||||
$('#chat_integration_test_modal').keydown(e => {
|
||||
|
@ -11,7 +12,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
}
|
||||
});
|
||||
});
|
||||
}.on('init'),
|
||||
},
|
||||
|
||||
@computed('model.topic_id')
|
||||
sendDisabled(topicId) {
|
||||
|
@ -21,8 +22,8 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
actions: {
|
||||
send() {
|
||||
if (this.get('sendDisabled')) return;
|
||||
|
||||
this.set('loading', true);
|
||||
|
||||
ajax("/admin/plugins/chat/test", {
|
||||
data: {
|
||||
channel_id: this.get('model.channel.id'),
|
||||
|
@ -32,7 +33,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
|
|||
}).then(() => {
|
||||
this.set('loading', false);
|
||||
this.flash(I18n.t('chat_integration.test_modal.success'), 'success');
|
||||
}.catch(popupAjaxError);
|
||||
}).catch(popupAjaxError);
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
{{#d-modal-body id="chat_integration_edit_rule_modal" title="chat_integration.edit_rule_modal.title"}}
|
||||
{{!-- {{#d-modal-body id="chat_integration_edit_rule_modal" title="chat_integration.edit_rule_modal.title"}}
|
||||
<div>
|
||||
<form {{action "save" on="submit"}}>
|
||||
<table>
|
||||
|
@ -56,8 +56,7 @@
|
|||
value=model.rule.category_id
|
||||
rootNoneLabel="chat_integration.all_categories"
|
||||
rootNone=true
|
||||
overrideWidths=false
|
||||
}}
|
||||
overrideWidths=false}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="instructions">
|
||||
|
@ -77,8 +76,6 @@
|
|||
</tr>
|
||||
{{/if}}
|
||||
|
||||
|
||||
|
||||
{{#if siteSettings.tagging_enabled}}
|
||||
<tr class="input">
|
||||
<td class="label"><label for='tags'>{{i18n "chat_integration.edit_rule_modal.tags"}}</label></td>
|
||||
|
@ -110,4 +107,4 @@
|
|||
action="cancel"
|
||||
title="chat_integration.edit_rule_modal.cancel"
|
||||
label="chat_integration.edit_rule_modal.cancel"}}
|
||||
</div>
|
||||
</div> --}}
|
||||
|
|
|
@ -10,14 +10,21 @@
|
|||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{{/d-modal-body}}
|
||||
|
||||
<div class="modal-footer">
|
||||
{{#conditional-loading-spinner condition=loading}}
|
||||
{{d-button id="send_test" class='btn-primary btn-large' action="send" title="chat_integration.test_modal.send" label="chat_integration.test_modal.send" disabled=sendDisabled}}
|
||||
|
||||
{{d-button class="btn-large" action="closeModal" title="chat_integration.test_modal.close" label="chat_integration.test_modal.close"}}
|
||||
{{/conditional-loading-spinner}}
|
||||
{{d-button id="send-test"
|
||||
class='btn-primary btn-large'
|
||||
action="send"
|
||||
title="chat_integration.test_modal.send"
|
||||
label="chat_integration.test_modal.send"
|
||||
disabled=sendDisabled}}
|
||||
|
||||
</div>
|
||||
{{d-button class="btn-large"
|
||||
action="closeModal"
|
||||
title="chat_integration.test_modal.close"
|
||||
label="chat_integration.test_modal.close"}}
|
||||
{{/conditional-loading-spinner}}
|
||||
</div>
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
</div>
|
||||
|
||||
<div class="pull-right">
|
||||
{{#d-button
|
||||
action="showSettings"
|
||||
{{d-button action="showSettings"
|
||||
icon="gear"
|
||||
title="chat_integration.settings"
|
||||
label="chat_integration.settings"}}
|
||||
|
|
|
@ -200,7 +200,7 @@ test("Test channel works", assert => {
|
|||
|
||||
andThen(() => {
|
||||
assert.ok(exists('#chat_integration_test_modal'), 'it displays the modal');
|
||||
assert.ok(find('#send_test').prop('disabled'), 'it disables the send button');
|
||||
assert.ok(find('#send-test').prop('disabled'), 'it disables the send button');
|
||||
fillIn('#choose-topic-title', '9318');
|
||||
});
|
||||
|
||||
|
@ -209,11 +209,11 @@ test("Test channel works", assert => {
|
|||
});
|
||||
|
||||
andThen(() => {
|
||||
assert.ok(find('#send_test').prop('disabled') === false, 'it enables the send button');
|
||||
assert.ok(find('#send-test').prop('disabled') === false, 'it enables the send button');
|
||||
});
|
||||
|
||||
andThen(() => {
|
||||
click('#send_test');
|
||||
click('#send-test');
|
||||
});
|
||||
|
||||
andThen(() => {
|
||||
|
|
Loading…
Reference in New Issue