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
Robin Ward 6f25f17360
DEV: Revisit skipped tests (#15769)
* Some are no longer flaky or easily fixed

* Some are out of date or test things we can't do accurately (scroll
  position) and are removed.

* Unwinds some uppy tests and makes sure all promises and runloops are
  resolved.

Everything has been run in legacy/ember cli multiple times to ensure no
obvious suite regressions.
2022-02-02 12:09:03 -05: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);
});
});