From 3eb125c39bd35b81af6ff6995e6fd2d6d3d0201a Mon Sep 17 00:00:00 2001 From: Rafael dos Santos Silva Date: Wed, 5 Apr 2017 18:07:50 -0300 Subject: [PATCH] FIX: Fix poll builder qunit tests --- .../controllers/poll-ui-builder-test.js.es6 | 24 +++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/plugins/poll/test/javascripts/controllers/poll-ui-builder-test.js.es6 b/plugins/poll/test/javascripts/controllers/poll-ui-builder-test.js.es6 index 60c50ca58fa..61373127de8 100644 --- a/plugins/poll/test/javascripts/controllers/poll-ui-builder-test.js.es6 +++ b/plugins/poll/test/javascripts/controllers/poll-ui-builder-test.js.es6 @@ -59,6 +59,14 @@ test("showMinMax", function() { }); equal(controller.get("showMinMax"), true, "it should be true"); + + controller.setProperties({ + isNumber: false, + isMultiple: false, + isRegular: true + }); + + equal(controller.get("showMinMax"), false, "it should be false"); }); test("pollOptionsCount", function() { @@ -147,6 +155,14 @@ test("disableInsert", function() { const controller = this.subject(); controller.siteSettings = Discourse.SiteSettings; + controller.setProperties({ isRegular: true }); + + equal(controller.get("disableInsert"), true, "it should be true"); + + controller.setProperties({ isRegular: true, pollOptionsCount: 2 }); + + equal(controller.get("disableInsert"), false, "it should be false"); + controller.setProperties({ isNumber: true }); equal(controller.get("disableInsert"), false, "it should be false"); @@ -188,12 +204,16 @@ test("regular pollOutput", function() { controller.siteSettings.poll_maximum_options = 20; controller.set("pollOptions", "1\n2"); + controller.setProperties({ + pollOptions: "1\n2", + pollType: controller.get("regularPollType") + }); - equal(controller.get("pollOutput"), "[poll]\n* 1\n* 2\n[/poll]", "it should return the right output"); + equal(controller.get("pollOutput"), "[poll type=regular]\n* 1\n* 2\n[/poll]", "it should return the right output"); controller.set("publicPoll", "true"); - equal(controller.get("pollOutput"), "[poll public=true]\n* 1\n* 2\n[/poll]", "it should return the right output"); + equal(controller.get("pollOutput"), "[poll type=regular public=true]\n* 1\n* 2\n[/poll]", "it should return the right output"); });