mirror of
https://github.com/codeninjasllc/discourse.git
synced 2024-11-23 15:48:43 -05:00
Merge pull request #4328 from dachary/wip-poll-empty-lines
FIX: poll builder should ignore empty lines
This commit is contained in:
commit
5f481ec097
2 changed files with 4 additions and 2 deletions
|
@ -112,7 +112,9 @@ export default Ember.Controller.extend({
|
|||
output += `${pollHeader}\n`;
|
||||
|
||||
if (pollOptions.length > 0 && !isNumber) {
|
||||
output += `${pollOptions.split("\n").map(option => `* ${option}`).join("\n")}\n`;
|
||||
pollOptions.split("\n").forEach(option => {
|
||||
if (option.length !== 0) output += `* ${option}\n`;
|
||||
});
|
||||
}
|
||||
|
||||
output += '[/poll]';
|
||||
|
|
|
@ -210,7 +210,7 @@ test("multiple pollOutput", function() {
|
|||
isMultiple: true,
|
||||
pollType: controller.get("multiplePollType"),
|
||||
pollMin: 1,
|
||||
pollOptions: "1\n2"
|
||||
pollOptions: "\n\n1\n\n2"
|
||||
});
|
||||
|
||||
equal(controller.get("pollOutput"), "[poll type=multiple min=1 max=2]\n* 1\n* 2\n[/poll]", "it should return the right output");
|
||||
|
|
Loading…
Reference in a new issue