edit bot: Fix UI element shows incorrect interface for outgoing webhook.

Dropdown element for outgoing interface type was not showing correct
value, cause the way default value was set to dropdown was incorrect
(it should have been setting the selected parameter on the selected
option if it were going to be selected via the template code).

Fixes #9419.
This commit is contained in:
Yashashvi Dave 2018-05-18 18:09:02 +05:30 committed by Tim Abbott
parent c6909fb99c
commit 3b09dda879
3 changed files with 4 additions and 3 deletions

View File

@ -1573,8 +1573,8 @@ run_test('handlebars_bug', () => {
interface: "1"},
};
var html = render('edit-outgoing-webhook-service', args);
assert.equal($(html).find('#edit_service_base_url').attr('value'), args.service.base_url);
assert.equal($(html).find('#edit_service_interface').attr('value'), args.service.interface);
assert.equal($(html).find('#edit_service_base_url').val(), args.service.base_url);
assert.equal($(html).find('#edit_service_interface').val(), args.service.interface);
}());
(function edit_embedded_bot_service() {

View File

@ -373,6 +373,7 @@ exports.set_up = function () {
if (bot.bot_type.toString() === OUTGOING_WEBHOOK_BOT_TYPE) {
$("#service_data").append(templates.render("edit-outgoing-webhook-service",
{service: service}));
$("#edit_service_interface").val(service.interface);
}
if (bot.bot_type.toString() === EMBEDDED_BOT_TYPE) {
$("#service_data").append(templates.render("edit-embedded-bot-service",

View File

@ -5,7 +5,7 @@
</div>
<div class="">
<label for="edit_service_interface">{{t "Interface" }}</label>
<select id="edit_service_interface" name="service_interface" value="{{service.interface}}">
<select id="edit_service_interface" name="service_interface">
<option value="1">{{t "Generic" }}</option>
<option value="2">{{t "Slack's outgoing webhooks" }}</option>
</select>