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 d6f2a63efe FIX: Tests were performing data[] queries but without quotes
This works in jQuery but not querySelectorAll
2020-11-20 12:39:07 -05:00

28 lines
927 B
JavaScript

import { queryAll } from "discourse/tests/helpers/qunit-helpers";
import { click, visit, currentURL } from "@ember/test-helpers";
import { test } from "qunit";
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
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(
queryAll(".user-card.show").length === 0,
"card should not appear"
);
await click('article[data-post-id="3651"] a.mention');
assert.ok(queryAll(".user-card.show").length === 1, "card appear");
assert.equal(currentURL(), "/t/internationalization-localization/280");
assert.ok(!tracked);
});
});