discourse/plugins/poll/test/javascripts/acceptance/poll-pie-chart-test.js
Jarek Radosz 4ad77f3382
DEV: Remove .es6 extensions from core (#14912)
Still supported in plugins though.
2021-11-13 12:51:53 +01:00

46 lines
1.0 KiB
JavaScript

import {
acceptance,
query,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import { test } from "qunit";
import { visit } from "@ember/test-helpers";
acceptance("Rendering polls with pie charts", function (needs) {
needs.user();
needs.settings({
poll_enabled: true,
poll_groupable_user_fields: "something",
});
test("Displays the pie chart", async function (assert) {
await visit("/t/-/topic_with_pie_chart_poll");
const poll = query(".poll");
assert.strictEqual(
query(".info-number", poll).innerHTML,
"2",
"it should display the right number of voters"
);
assert.strictEqual(
queryAll(".info-number", poll)[1].innerHTML,
"5",
"it should display the right number of votes"
);
assert.strictEqual(
poll.classList.contains("pie"),
true,
"pie class is present on poll div"
);
assert.strictEqual(
queryAll(".poll-results-chart", poll).length,
1,
"Renders the chart div instead of bar container"
);
});
});