discourse/plugins/discourse-gamification/test/javascripts/acceptance/gamification-score-test.js
Sérgio Saquetim 5c0dbd2bac
DEV: Deprecate the widgets rendering system (#33684)
This commit begins the deprecation process for the legacy widget
system in Discourse. The changes include:

- Adding deprecation warnings to existing widget functionality
- Link to a topic on Meta containing guidance about the next steps
- Setting up the foundation for eventual widget removal

The widget system has been superseded by more modern and maintainable
Glimmer component patterns. This deprecation serves as the first step in
the final phase of moving away from widgets to improve code
maintainability and developer experience.

---------

Co-authored-by: Jarek Radosz <jradosz@gmail.com>
2025-07-23 16:05:35 -03:00

49 lines
1.7 KiB
JavaScript

import { click, visit } from "@ember/test-helpers";
import { test } from "qunit";
import { cloneJSON } from "discourse/lib/object";
import userFixtures from "discourse/tests/fixtures/user-fixtures";
import { fixturesByUrl } from "discourse/tests/helpers/create-pretender";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance(
"Discourse Gamification | User Card | Show Gamification Score",
function (needs) {
needs.user();
needs.pretender((server, helper) => {
const cardResponse = cloneJSON(userFixtures["/u/charlie/card.json"]);
cardResponse.user.gamification_score = 10;
server.get("/u/charlie/card.json", () => helper.response(cardResponse));
});
test("user card gamification score - score is present", async function (assert) {
await visit("/t/internationalization-localization/280");
await click(".topic-map__users-trigger");
await click('.topic-map__users-list a[data-user-card="charlie"]');
assert
.dom(".user-card .gamification-score")
.hasText("Cheers 10", "user card has gamification score");
});
}
);
acceptance(
"Discourse Gamification | User Metadata | Show Gamification Score",
function (needs) {
needs.user();
needs.pretender((server, helper) => {
const userResponse = cloneJSON(fixturesByUrl["/u/charlie.json"]);
userResponse.user.gamification_score = 10;
server.get("/u/charlie.json", () => helper.response(userResponse));
});
test("user profile gamification score - score is present", async function (assert) {
await visit("/u/charlie/summary");
assert
.dom(".details .secondary .gamification-score")
.hasText("10", "user metadata has gamification score");
});
}
);