mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-04 15:13:41 +08:00
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>
49 lines
1.7 KiB
JavaScript
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");
|
|
});
|
|
}
|
|
);
|