mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
poll widget: Only show "Add option" if a question has been set.
This makes the UI less confusing.
This commit is contained in:
@@ -175,6 +175,7 @@ run_test('activate another person poll', () => {
|
|||||||
const poll_question_input = set_widget_find_result('input.poll-question');
|
const poll_question_input = set_widget_find_result('input.poll-question');
|
||||||
const poll_question_header = set_widget_find_result('.poll-question-header');
|
const poll_question_header = set_widget_find_result('.poll-question-header');
|
||||||
const poll_question_container = set_widget_find_result('.poll-question-bar');
|
const poll_question_container = set_widget_find_result('.poll-question-bar');
|
||||||
|
const poll_comment_container = set_widget_find_result('.poll-comment-bar');
|
||||||
|
|
||||||
const poll_vote_button = set_widget_find_result('button.poll-vote');
|
const poll_vote_button = set_widget_find_result('button.poll-vote');
|
||||||
|
|
||||||
@@ -279,6 +280,7 @@ run_test('activate another person poll', () => {
|
|||||||
widget_elem.handle_events(add_question_event);
|
widget_elem.handle_events(add_question_event);
|
||||||
|
|
||||||
assert(!poll_question_container.visible());
|
assert(!poll_question_container.visible());
|
||||||
|
assert(poll_comment_container.visible());
|
||||||
});
|
});
|
||||||
|
|
||||||
run_test('activate own poll', () => {
|
run_test('activate own poll', () => {
|
||||||
@@ -324,6 +326,7 @@ run_test('activate own poll', () => {
|
|||||||
const poll_question_input = set_widget_find_result('input.poll-question');
|
const poll_question_input = set_widget_find_result('input.poll-question');
|
||||||
const poll_question_header = set_widget_find_result('.poll-question-header');
|
const poll_question_header = set_widget_find_result('.poll-question-header');
|
||||||
const poll_question_container = set_widget_find_result('.poll-question-bar');
|
const poll_question_container = set_widget_find_result('.poll-question-bar');
|
||||||
|
const poll_comment_container = set_widget_find_result('.poll-comment-bar');
|
||||||
|
|
||||||
const poll_vote_button = set_widget_find_result('button.poll-vote');
|
const poll_vote_button = set_widget_find_result('button.poll-vote');
|
||||||
|
|
||||||
@@ -368,4 +371,5 @@ run_test('activate own poll', () => {
|
|||||||
question_button_callback(e);
|
question_button_callback(e);
|
||||||
assert.deepEqual(out_data, undefined);
|
assert.deepEqual(out_data, undefined);
|
||||||
}
|
}
|
||||||
|
assert(poll_comment_container.visible());
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -202,6 +202,9 @@ exports.activate = function (opts) {
|
|||||||
}
|
}
|
||||||
if (widget_data.question !== '') {
|
if (widget_data.question !== '') {
|
||||||
elem.find('button.poll-question').text(i18n.t('Edit question'));
|
elem.find('button.poll-question').text(i18n.t('Edit question'));
|
||||||
|
elem.find('.poll-comment-bar').show();
|
||||||
|
} else {
|
||||||
|
elem.find('.poll-comment-bar').hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
elem.find("button.poll-vote").on('click', function (e) {
|
elem.find("button.poll-vote").on('click', function (e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user