mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: Remove most of jQuery usage from tests (#17474)
This commit is contained in:
@ -1,8 +1,4 @@
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
@ -13,9 +9,9 @@ acceptance("Local Dates - composer", function (needs) {
|
||||
|
||||
test("composer bbcode", async function (assert) {
|
||||
const getAttr = (attr) => {
|
||||
return queryAll(
|
||||
return query(
|
||||
".d-editor-preview .discourse-local-date.cooked-date"
|
||||
).attr(`data-${attr}`);
|
||||
).getAttribute(`data-${attr}`);
|
||||
};
|
||||
|
||||
await visit("/");
|
||||
|
@ -2,7 +2,7 @@ import { cloneJSON } from "discourse-common/lib/object";
|
||||
import topicFixtures from "discourse/tests/fixtures/topic";
|
||||
import {
|
||||
acceptance,
|
||||
queryAll,
|
||||
query,
|
||||
selectText,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { test } from "qunit";
|
||||
@ -15,17 +15,17 @@ acceptance("Local Dates - quoting", function (needs) {
|
||||
needs.pretender((server, helper) => {
|
||||
const topicResponse = cloneJSON(topicFixtures["/t/280/1.json"]);
|
||||
const firstPost = topicResponse.post_stream.posts[0];
|
||||
firstPost.cooked += `<div class='select-local-date-test'>This is a test <span data-date="2022-06-17" data-time="10:00:00" class="discourse-local-date cooked-date past" data-displayed-timezone="Australia/Perth" data-timezone="Australia/Brisbane" data-email-preview="2022-06-17T00:00:00Z UTC" aria-label="Brisbane Friday, June 17, 2022
|
||||
firstPost.cooked += `<div class='select-local-date-test'>This is a test <span data-date="2022-06-17" data-time="10:00:00" class="discourse-local-date cooked-date past" data-displayed-timezone="Australia/Perth" data-timezone="Australia/Brisbane" data-email-preview="2022-06-17T00:00:00Z UTC" aria-label="Brisbane Friday, June 17, 2022
|
||||
<br />
|
||||
<svg class='fa d-icon d-icon-clock svg-icon svg-string'
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<use href="#clock" />
|
||||
</svg> 10:00 AM, Paris Friday, June 17, 2022
|
||||
</svg> 10:00 AM, Paris Friday, June 17, 2022
|
||||
<br />
|
||||
<svg class='fa d-icon d-icon-clock svg-icon svg-string'
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
<use href="#clock" />
|
||||
</svg> 2:00 AM, Los Angeles Thursday, June 16, 2022
|
||||
</svg> 2:00 AM, Los Angeles Thursday, June 16, 2022
|
||||
<br />
|
||||
<svg class='fa d-icon d-icon-clock svg-icon svg-string'
|
||||
xmlns="http://www.w3.org/2000/svg">
|
||||
@ -48,7 +48,7 @@ acceptance("Local Dates - quoting", function (needs) {
|
||||
await selectText("#post_1 .select-local-date-test");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().trim(),
|
||||
query(".d-editor-input").value.trim(),
|
||||
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
||||
This is a test [date=2022-06-17 time=10:00:00 timezone="Australia/Brisbane" displayedTimezone="Australia/Perth"]
|
||||
[/quote]`,
|
||||
@ -87,7 +87,7 @@ acceptance("Local Dates - quoting range", function (needs) {
|
||||
await selectText("#post_1 .select-local-date-test");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().trim(),
|
||||
query(".d-editor-input").value.trim(),
|
||||
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
||||
Some text [date-range from=2022-06-17T09:30:00 to=2022-06-18T10:30:00 format="LL" timezone="Australia/Brisbane" timezones="Africa/Accra|Australia/Brisbane|Europe/Paris"]
|
||||
[/quote]`,
|
||||
@ -129,7 +129,7 @@ acceptance(
|
||||
await selectText("#post_1 .select-local-date-test");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
queryAll(".d-editor-input").val().trim(),
|
||||
query(".d-editor-input").value.trim(),
|
||||
`[quote=\"Uwe Keim, post:1, topic:280, username:uwe_keim\"]
|
||||
Testing countdown [date=2022-06-21 time=09:30:00 format="LL" timezone="Australia/Brisbane" countdown="true"]
|
||||
|
||||
|
Reference in New Issue
Block a user