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/click-track-test.js
2021-11-08 10:26:28 +01:00

31 lines
871 B
JavaScript

import {
acceptance,
count,
exists,
} from "discourse/tests/helpers/qunit-helpers";
import { click, currentURL, visit } from "@ember/test-helpers";
import { test } from "qunit";
acceptance("Click Track", function (needs) {
let tracked = false;
needs.pretender((server, helper) => {
server.post("/clicks/track", () => {
tracked = true;
return helper.response({ success: "OK" });
});
});
test("Do not track mentions", async function (assert) {
await visit("/t/internationalization-localization/280");
assert.ok(!exists(".user-card.show"), "card should not appear");
await click('article[data-post-id="3651"] a.mention');
assert.strictEqual(count(".user-card.show"), 1, "card appear");
assert.strictEqual(
currentURL(),
"/t/internationalization-localization/280"
);
assert.ok(!tracked);
});
});