This repository has been archived on 2023-03-18. You can view files and clone it, but cannot push or open issues or pull requests.
osr-discourse-src/app/assets/javascripts/discourse/tests/acceptance/admin-badges-award-test.js
2021-11-08 10:26:28 +01:00

33 lines
1.0 KiB
JavaScript

import {
acceptance,
exists,
query,
} from "discourse/tests/helpers/qunit-helpers";
import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import I18n from "I18n";
acceptance("Admin - Badges - Mass Award", function (needs) {
needs.user();
test("when the badge can be granted multiple times", async function (assert) {
await visit("/admin/badges/award/new");
await click(
'.admin-badge-list-item span[data-badge-name="Both image and icon"]'
);
assert.strictEqual(
query("label.grant-existing-holders").textContent.trim(),
I18n.t("admin.badges.mass_award.grant_existing_holders"),
"checkbox for granting existing holders is displayed"
);
});
test("when the badge can not be granted multiple times", async function (assert) {
await visit("/admin/badges/award/new");
await click('.admin-badge-list-item span[data-badge-name="Only icon"]');
assert.ok(
!exists(".grant-existing-holders"),
"checkbox for granting existing holders is not displayed"
);
});
});