FIX: Tests were performing `data[]` queries but without quotes

This works in jQuery but not querySelectorAll
This commit is contained in:
Robin Ward 2020-11-20 11:30:58 -05:00
parent 8a90a5610f
commit d6f2a63efe
10 changed files with 15 additions and 15 deletions

View File

@ -19,7 +19,7 @@ acceptance("Click Track", function (needs) {
"card should not appear" "card should not appear"
); );
await click("article[data-post-id=3651] a.mention"); await click('article[data-post-id="3651"] a.mention');
assert.ok(queryAll(".user-card.show").length === 1, "card appear"); assert.ok(queryAll(".user-card.show").length === 1, "card appear");
assert.equal(currentURL(), "/t/internationalization-localization/280"); assert.equal(currentURL(), "/t/internationalization-localization/280");
assert.ok(!tracked); assert.ok(!tracked);

View File

@ -263,7 +263,7 @@ acceptance("Composer", function (needs) {
await visit("/t/internationalization-localization/280"); await visit("/t/internationalization-localization/280");
assert.ok( assert.ok(
!exists("article[data-post-id=12345]"), !exists('article[data-post-id="12345"]'),
"the post is not in the DOM" "the post is not in the DOM"
); );

View File

@ -7,7 +7,7 @@ import { acceptance } from "discourse/tests/helpers/qunit-helpers";
acceptance("Review", function (needs) { acceptance("Review", function (needs) {
needs.user(); needs.user();
const user = ".reviewable-item[data-reviewable-id=1234]"; const user = '.reviewable-item[data-reviewable-id="1234"]';
test("It returns a list of reviewable items", async function (assert) { test("It returns a list of reviewable items", async function (assert) {
await visit("/review"); await visit("/review");
@ -92,7 +92,7 @@ acceptance("Review", function (needs) {
}); });
test("Editing a reviewable", async function (assert) { test("Editing a reviewable", async function (assert) {
const topic = ".reviewable-item[data-reviewable-id=4321]"; const topic = '.reviewable-item[data-reviewable-id="4321"]';
await visit("/review"); await visit("/review");
assert.ok(queryAll(`${topic} .reviewable-action.approve`).length); assert.ok(queryAll(`${topic} .reviewable-action.approve`).length);
assert.ok(!queryAll(`${topic} .category-name`).length); assert.ok(!queryAll(`${topic} .category-name`).length);

View File

@ -75,12 +75,12 @@ acceptance("Topic Discovery", function (needs) {
test("Clearing state after leaving a category", async function (assert) { test("Clearing state after leaving a category", async function (assert) {
await visit("/c/dev"); await visit("/c/dev");
assert.ok( assert.ok(
exists(".topic-list-item[data-topic-id=11994] .topic-excerpt"), exists('.topic-list-item[data-topic-id="11994"] .topic-excerpt'),
"it expands pinned topics in a subcategory" "it expands pinned topics in a subcategory"
); );
await visit("/"); await visit("/");
assert.ok( assert.ok(
!exists(".topic-list-item[data-topic-id=11557] .topic-excerpt"), !exists('.topic-list-item[data-topic-id="11557"] .topic-excerpt'),
"it doesn't expand all pinned in the latest category" "it doesn't expand all pinned in the latest category"
); );
}); });

View File

@ -19,7 +19,7 @@ acceptance("User Card - Show Local Time", function (needs) {
User.current().changeTimezone("Australia/Brisbane"); User.current().changeTimezone("Australia/Brisbane");
await visit("/t/internationalization-localization/280"); await visit("/t/internationalization-localization/280");
await click("a[data-user-card=charlie]:first"); await click('a[data-user-card="charlie"]:first');
assert.not( assert.not(
exists(".user-card .local-time"), exists(".user-card .local-time"),

View File

@ -285,7 +285,7 @@ export default function selectKit(selector) {
await click( await click(
queryAll(selector) queryAll(selector)
.find(".select-kit-header") .find(".select-kit-header")
.find(`[data-value=${value}]`) .find(`[data-value="${value}"]`)
); );
}, },

View File

@ -113,8 +113,8 @@ discourseModule("Integration | Component | Widget | post-stream", function (
// it renders an article for the body with appropriate attributes // it renders an article for the body with appropriate attributes
assert.equal(queryAll("article#post_2").length, 1); assert.equal(queryAll("article#post_2").length, 1);
assert.equal(queryAll("article[data-user-id=123]").length, 1); assert.equal(queryAll('article[data-user-id="123"]').length, 1);
assert.equal(queryAll("article[data-post-id=3]").length, 1); assert.equal(queryAll('article[data-post-id="3"]').length, 1);
assert.equal(queryAll("article#post_5.via-email").length, 1); assert.equal(queryAll("article#post_5.via-email").length, 1);
assert.equal(queryAll("article#post_6.is-auto-generated").length, 1); assert.equal(queryAll("article#post_6.is-auto-generated").length, 1);

View File

@ -24,7 +24,7 @@ discourseModule("Integration | Component | Widget | poster-name", function (
test(assert) { test(assert) {
assert.ok(queryAll(".names").length); assert.ok(queryAll(".names").length);
assert.ok(queryAll("span.username").length); assert.ok(queryAll("span.username").length);
assert.ok(queryAll("a[data-user-card=eviltrout]").length); assert.ok(queryAll('a[data-user-card="eviltrout"]').length);
assert.equal(queryAll(".username a").text(), "eviltrout"); assert.equal(queryAll(".username a").text(), "eviltrout");
assert.equal(queryAll(".full-name a").text(), "Robin Ward"); assert.equal(queryAll(".full-name a").text(), "Robin Ward");
assert.equal(queryAll(".user-title").text(), "Trout Master"); assert.equal(queryAll(".user-title").text(), "Trout Master");

View File

@ -22,8 +22,8 @@ discourseModule("Integration | Component | Widget | small-user-list", function (
}); });
}, },
async test(assert) { async test(assert) {
assert.ok(queryAll("[data-user-card=eviltrout]").length === 1); assert.ok(queryAll('[data-user-card="eviltrout"]').length === 1);
assert.ok(queryAll("[data-user-card=someone]").length === 0); assert.ok(queryAll('[data-user-card="someone"]').length === 0);
assert.ok(queryAll(".unknown").length, "includes unkown user"); assert.ok(queryAll(".unknown").length, "includes unkown user");
}, },
}); });

View File

@ -119,8 +119,8 @@ discourseModule("Integration | Component | Widget | base", function (hooks) {
}, },
test(assert) { test(assert) {
assert.ok(queryAll(".test[data-evil=trout]").length); assert.ok(queryAll('.test[data-evil="trout"]').length);
assert.ok(queryAll(".test[aria-label=accessibility]").length); assert.ok(queryAll('.test[aria-label="accessibility"]').length);
}, },
}); });