DEV: Replace equal() with strictEqual() (#14827)
This commit is contained in:
@@ -76,7 +76,7 @@ acceptance("Poll breakdown", function (needs) {
|
||||
|
||||
assert.ok(exists(".poll-breakdown-total-votes"), "displays the vote count");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
count(".poll-breakdown-chart-container"),
|
||||
2,
|
||||
"renders a chart for each of the groups in group_results response"
|
||||
@@ -92,7 +92,7 @@ acceptance("Poll breakdown", function (needs) {
|
||||
await visit("/t/-/topic_with_pie_chart_poll");
|
||||
await click(".poll-show-breakdown");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
query(".poll-breakdown-option-count").textContent.trim(),
|
||||
"40.0%",
|
||||
"displays the correct vote percentage"
|
||||
@@ -100,7 +100,7 @@ acceptance("Poll breakdown", function (needs) {
|
||||
|
||||
await click(".modal-tabs .count");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
query(".poll-breakdown-option-count").textContent.trim(),
|
||||
"2",
|
||||
"displays the correct vote count"
|
||||
@@ -108,7 +108,7 @@ acceptance("Poll breakdown", function (needs) {
|
||||
|
||||
await click(".modal-tabs .percentage");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
query(".poll-breakdown-option-count").textContent.trim(),
|
||||
"40.0%",
|
||||
"displays the percentage again"
|
||||
|
||||
@@ -18,25 +18,25 @@ acceptance("Rendering polls with pie charts", function (needs) {
|
||||
|
||||
const poll = query(".poll");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
query(".info-number", poll).innerHTML,
|
||||
"2",
|
||||
"it should display the right number of voters"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll(".info-number", poll)[1].innerHTML,
|
||||
"5",
|
||||
"it should display the right number of votes"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
poll.classList.contains("pie"),
|
||||
true,
|
||||
"pie class is present on poll div"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll(".poll-results-chart", poll).length,
|
||||
1,
|
||||
"Renders the chart div instead of bar container"
|
||||
|
||||
@@ -432,7 +432,7 @@ acceptance("Poll quote", function (needs) {
|
||||
test("renders and extends", async function (assert) {
|
||||
await visit("/t/-/topic_with_two_quoted_polls");
|
||||
await click(".quote-controls");
|
||||
assert.equal(count(".poll"), 2, "polls are rendered");
|
||||
assert.equal(count(".poll-buttons"), 2, "polls are extended");
|
||||
assert.strictEqual(count(".poll"), 2, "polls are rendered");
|
||||
assert.strictEqual(count(".poll-buttons"), 2, "polls are extended");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -567,11 +567,11 @@ acceptance("Poll results", function (needs) {
|
||||
test("can load more voters", async function (assert) {
|
||||
await visit("/t/-/load-more-poll-voters");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
find(".poll-container .results li:nth-child(1) .poll-voters li").length,
|
||||
1
|
||||
);
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
find(".poll-container .results li:nth-child(2) .poll-voters li").length,
|
||||
0
|
||||
);
|
||||
@@ -626,11 +626,11 @@ acceptance("Poll results", function (needs) {
|
||||
});
|
||||
await visit("/t/-/load-more-poll-voters");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
find(".poll-container .results li:nth-child(1) .poll-voters li").length,
|
||||
1
|
||||
);
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
find(".poll-container .results li:nth-child(2) .poll-voters li").length,
|
||||
1
|
||||
);
|
||||
@@ -638,11 +638,11 @@ acceptance("Poll results", function (needs) {
|
||||
await click(".poll-voters-toggle-expand a");
|
||||
await visit("/t/-/load-more-poll-voters");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
find(".poll-container .results li:nth-child(1) .poll-voters li").length,
|
||||
2
|
||||
);
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
find(".poll-container .results li:nth-child(2) .poll-voters li").length,
|
||||
0
|
||||
);
|
||||
@@ -652,13 +652,13 @@ acceptance("Poll results", function (needs) {
|
||||
await visit("/t/-/load-more-poll-voters");
|
||||
await click(".toggle-results");
|
||||
|
||||
assert.equal(count(".poll-container .d-icon-circle"), 1);
|
||||
assert.equal(count(".poll-container .d-icon-far-circle"), 1);
|
||||
assert.strictEqual(count(".poll-container .d-icon-circle"), 1);
|
||||
assert.strictEqual(count(".poll-container .d-icon-far-circle"), 1);
|
||||
|
||||
await click(".remove-vote");
|
||||
|
||||
assert.equal(count(".poll-container .d-icon-circle"), 0);
|
||||
assert.equal(count(".poll-container .d-icon-far-circle"), 2);
|
||||
assert.strictEqual(count(".poll-container .d-icon-circle"), 0);
|
||||
assert.strictEqual(count(".poll-container .d-icon-far-circle"), 2);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -46,15 +46,15 @@ acceptance("Rendering polls with bar charts - desktop", function (needs) {
|
||||
|
||||
const polls = queryAll(".poll");
|
||||
|
||||
assert.equal(polls.length, 2, "it should render the polls correctly");
|
||||
assert.strictEqual(polls.length, 2, "it should render the polls correctly");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll(".info-number", polls[0]).text(),
|
||||
"2",
|
||||
"it should display the right number of votes"
|
||||
);
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll(".info-number", polls[1]).text(),
|
||||
"3",
|
||||
"it should display the right number of votes"
|
||||
@@ -65,11 +65,11 @@ acceptance("Rendering polls with bar charts - desktop", function (needs) {
|
||||
await visit("/t/-/14");
|
||||
|
||||
const polls = queryAll(".poll");
|
||||
assert.equal(polls.length, 1, "it should render the poll correctly");
|
||||
assert.strictEqual(polls.length, 1, "it should render the poll correctly");
|
||||
|
||||
await click("button.toggle-results");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll(".poll-voters:nth-of-type(1) li").length,
|
||||
25,
|
||||
"it should display the right number of voters"
|
||||
@@ -77,7 +77,7 @@ acceptance("Rendering polls with bar charts - desktop", function (needs) {
|
||||
|
||||
await click(".poll-voters-toggle-expand:nth-of-type(1) a");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll(".poll-voters:nth-of-type(1) li").length,
|
||||
26,
|
||||
"it should display the right number of voters"
|
||||
@@ -88,11 +88,11 @@ acceptance("Rendering polls with bar charts - desktop", function (needs) {
|
||||
await visit("/t/-/13");
|
||||
|
||||
const polls = queryAll(".poll");
|
||||
assert.equal(polls.length, 1, "it should render the poll correctly");
|
||||
assert.strictEqual(polls.length, 1, "it should render the poll correctly");
|
||||
|
||||
await click("button.toggle-results");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll(".poll-voters:nth-of-type(1) li").length,
|
||||
25,
|
||||
"it should display the right number of voters"
|
||||
@@ -105,7 +105,7 @@ acceptance("Rendering polls with bar charts - desktop", function (needs) {
|
||||
|
||||
await click(".poll-voters-toggle-expand:nth-of-type(1) a");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll(".poll-voters:nth-of-type(1) li").length,
|
||||
30,
|
||||
"it should display the right number of voters"
|
||||
|
||||
@@ -27,11 +27,11 @@ acceptance("Rendering polls with bar charts - mobile", function (needs) {
|
||||
await visit("/t/-/13");
|
||||
|
||||
const polls = queryAll(".poll");
|
||||
assert.equal(polls.length, 1, "it should render the poll correctly");
|
||||
assert.strictEqual(polls.length, 1, "it should render the poll correctly");
|
||||
|
||||
await click("button.toggle-results");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll(".poll-voters:nth-of-type(1) li").length,
|
||||
25,
|
||||
"it should display the right number of voters"
|
||||
@@ -44,7 +44,7 @@ acceptance("Rendering polls with bar charts - mobile", function (needs) {
|
||||
|
||||
await click(".poll-voters-toggle-expand:nth-of-type(1) a");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll(".poll-voters:nth-of-type(1) li").length,
|
||||
35,
|
||||
"it should display the right number of voters"
|
||||
|
||||
@@ -23,14 +23,14 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
pollOptions: [{ value: "a" }],
|
||||
});
|
||||
|
||||
assert.equal(controller.isMultiple, true, "it should be true");
|
||||
assert.strictEqual(controller.isMultiple, true, "it should be true");
|
||||
|
||||
controller.setProperties({
|
||||
pollType: "random",
|
||||
pollOptions: [{ value: "b" }],
|
||||
});
|
||||
|
||||
assert.equal(controller.isMultiple, false, "it should be false");
|
||||
assert.strictEqual(controller.isMultiple, false, "it should be false");
|
||||
});
|
||||
|
||||
test("isNumber", function (assert) {
|
||||
@@ -38,11 +38,11 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
|
||||
controller.set("pollType", REGULAR_POLL_TYPE);
|
||||
|
||||
assert.equal(controller.isNumber, false, "it should be false");
|
||||
assert.strictEqual(controller.isNumber, false, "it should be false");
|
||||
|
||||
controller.set("pollType", NUMBER_POLL_TYPE);
|
||||
|
||||
assert.equal(controller.isNumber, true, "it should be true");
|
||||
assert.strictEqual(controller.isNumber, true, "it should be true");
|
||||
});
|
||||
|
||||
test("pollOptionsCount", function (assert) {
|
||||
@@ -50,47 +50,47 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
|
||||
controller.set("pollOptions", [{ value: "1" }, { value: "2" }]);
|
||||
|
||||
assert.equal(controller.pollOptionsCount, 2, "it should equal 2");
|
||||
assert.strictEqual(controller.pollOptionsCount, 2, "it should equal 2");
|
||||
|
||||
controller.set("pollOptions", []);
|
||||
|
||||
assert.equal(controller.pollOptionsCount, 0, "it should equal 0");
|
||||
assert.strictEqual(controller.pollOptionsCount, 0, "it should equal 0");
|
||||
});
|
||||
|
||||
test("disableInsert", function (assert) {
|
||||
const controller = setupController(this);
|
||||
controller.siteSettings.poll_maximum_options = 20;
|
||||
|
||||
assert.equal(controller.disableInsert, true, "it should be true");
|
||||
assert.strictEqual(controller.disableInsert, true, "it should be true");
|
||||
|
||||
controller.set("pollOptions", [{ value: "a" }, { value: "b" }]);
|
||||
|
||||
assert.equal(controller.disableInsert, false, "it should be false");
|
||||
assert.strictEqual(controller.disableInsert, false, "it should be false");
|
||||
|
||||
controller.set("pollType", NUMBER_POLL_TYPE);
|
||||
|
||||
assert.equal(controller.disableInsert, false, "it should be false");
|
||||
assert.strictEqual(controller.disableInsert, false, "it should be false");
|
||||
|
||||
controller.setProperties({
|
||||
pollType: REGULAR_POLL_TYPE,
|
||||
pollOptions: [{ value: "a" }, { value: "b" }, { value: "c" }],
|
||||
});
|
||||
|
||||
assert.equal(controller.disableInsert, false, "it should be false");
|
||||
assert.strictEqual(controller.disableInsert, false, "it should be false");
|
||||
|
||||
controller.setProperties({
|
||||
pollType: REGULAR_POLL_TYPE,
|
||||
pollOptions: [],
|
||||
});
|
||||
|
||||
assert.equal(controller.disableInsert, true, "it should be true");
|
||||
assert.strictEqual(controller.disableInsert, true, "it should be true");
|
||||
|
||||
controller.setProperties({
|
||||
pollType: REGULAR_POLL_TYPE,
|
||||
pollOptions: [{ value: "w" }],
|
||||
});
|
||||
|
||||
assert.equal(controller.disableInsert, false, "it should be false");
|
||||
assert.strictEqual(controller.disableInsert, false, "it should be false");
|
||||
});
|
||||
|
||||
test("number pollOutput", async function (assert) {
|
||||
@@ -103,7 +103,7 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
});
|
||||
await settled();
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
controller.pollOutput,
|
||||
"[poll type=number results=always min=1 max=20 step=1]\n[/poll]\n",
|
||||
"it should return the right output"
|
||||
@@ -111,7 +111,7 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
controller.set("pollStep", 2);
|
||||
await settled();
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
controller.pollOutput,
|
||||
"[poll type=number results=always min=1 max=20 step=2]\n[/poll]\n",
|
||||
"it should return the right output"
|
||||
@@ -119,7 +119,7 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
|
||||
controller.set("publicPoll", true);
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
controller.pollOutput,
|
||||
"[poll type=number results=always min=1 max=20 step=2 public=true]\n[/poll]\n",
|
||||
"it should return the right output"
|
||||
@@ -127,7 +127,7 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
|
||||
controller.set("pollStep", 0);
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
controller.pollOutput,
|
||||
"[poll type=number results=always min=1 max=20 step=1 public=true]\n[/poll]\n",
|
||||
"it should return the right output"
|
||||
@@ -143,7 +143,7 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
pollType: REGULAR_POLL_TYPE,
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
controller.pollOutput,
|
||||
"[poll type=regular results=always chartType=bar]\n* 1\n* 2\n[/poll]\n",
|
||||
"it should return the right output"
|
||||
@@ -151,7 +151,7 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
|
||||
controller.set("publicPoll", "true");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
controller.pollOutput,
|
||||
"[poll type=regular results=always public=true chartType=bar]\n* 1\n* 2\n[/poll]\n",
|
||||
"it should return the right output"
|
||||
@@ -159,7 +159,7 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
|
||||
controller.set("pollGroups", "test");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
controller.get("pollOutput"),
|
||||
"[poll type=regular results=always public=true chartType=bar groups=test]\n* 1\n* 2\n[/poll]\n",
|
||||
"it should return the right output"
|
||||
@@ -176,7 +176,7 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
pollOptions: [{ value: "1" }, { value: "2" }],
|
||||
});
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
controller.pollOutput,
|
||||
"[poll type=multiple results=always min=1 max=2 chartType=bar]\n* 1\n* 2\n[/poll]\n",
|
||||
"it should return the right output"
|
||||
@@ -184,7 +184,7 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
|
||||
controller.set("publicPoll", "true");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
controller.pollOutput,
|
||||
"[poll type=multiple results=always min=1 max=2 public=true chartType=bar]\n* 1\n* 2\n[/poll]\n",
|
||||
"it should return the right output"
|
||||
@@ -204,7 +204,7 @@ discourseModule("Unit | Controller | poll-ui-builder", function () {
|
||||
|
||||
test("poll result is always by default", function (assert) {
|
||||
const controller = setupController(this);
|
||||
assert.equal(controller.pollResult, "always");
|
||||
assert.strictEqual(controller.pollResult, "always");
|
||||
});
|
||||
|
||||
test("staff_only option is present for staff", async function (assert) {
|
||||
|
||||
@@ -31,8 +31,8 @@ discourseModule(
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(queryAll(".option .percentage")[0].innerText, "56%");
|
||||
assert.equal(queryAll(".option .percentage")[1].innerText, "44%");
|
||||
assert.strictEqual(queryAll(".option .percentage")[0].innerText, "56%");
|
||||
assert.strictEqual(queryAll(".option .percentage")[1].innerText, "44%");
|
||||
},
|
||||
});
|
||||
|
||||
@@ -50,8 +50,8 @@ discourseModule(
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.equal(queryAll(".option .percentage")[0].innerText, "56%");
|
||||
assert.equal(queryAll(".option .percentage")[1].innerText, "44%");
|
||||
assert.strictEqual(queryAll(".option .percentage")[0].innerText, "56%");
|
||||
assert.strictEqual(queryAll(".option .percentage")[1].innerText, "44%");
|
||||
},
|
||||
});
|
||||
|
||||
@@ -78,17 +78,17 @@ discourseModule(
|
||||
|
||||
test(assert) {
|
||||
let percentages = queryAll(".option .percentage");
|
||||
assert.equal(percentages[0].innerText, "41%");
|
||||
assert.equal(percentages[1].innerText, "33%");
|
||||
assert.equal(percentages[2].innerText, "16%");
|
||||
assert.equal(percentages[3].innerText, "8%");
|
||||
assert.strictEqual(percentages[0].innerText, "41%");
|
||||
assert.strictEqual(percentages[1].innerText, "33%");
|
||||
assert.strictEqual(percentages[2].innerText, "16%");
|
||||
assert.strictEqual(percentages[3].innerText, "8%");
|
||||
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll(".option")[3].querySelectorAll("span")[1].innerText,
|
||||
"a"
|
||||
);
|
||||
assert.equal(percentages[4].innerText, "8%");
|
||||
assert.equal(
|
||||
assert.strictEqual(percentages[4].innerText, "8%");
|
||||
assert.strictEqual(
|
||||
queryAll(".option")[4].querySelectorAll("span")[1].innerText,
|
||||
"b"
|
||||
);
|
||||
|
||||
@@ -123,12 +123,12 @@ discourseModule(
|
||||
await click(
|
||||
"li[data-poll-option-id='1f972d1df351de3ce35a787c89faad29']"
|
||||
);
|
||||
assert.equal(requests, 1);
|
||||
assert.equal(count(".chosen"), 1);
|
||||
assert.equal(queryAll(".chosen").text(), "100%yes");
|
||||
assert.strictEqual(requests, 1);
|
||||
assert.strictEqual(count(".chosen"), 1);
|
||||
assert.strictEqual(queryAll(".chosen").text(), "100%yes");
|
||||
|
||||
await click(".toggle-results");
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll("li[data-poll-option-id='1f972d1df351de3ce35a787c89faad29']")
|
||||
.length,
|
||||
1
|
||||
@@ -171,11 +171,11 @@ discourseModule(
|
||||
await click(
|
||||
"li[data-poll-option-id='1f972d1df351de3ce35a787c89faad29']"
|
||||
);
|
||||
assert.equal(
|
||||
assert.strictEqual(
|
||||
queryAll(".poll-container .alert").text(),
|
||||
I18n.t("poll.results.groups.title", { groups: "foo" })
|
||||
);
|
||||
assert.equal(requests, 0);
|
||||
assert.strictEqual(requests, 0);
|
||||
assert.ok(!exists(".chosen"));
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user