This commit is contained in:
Jarek Radosz 2024-12-01 02:08:53 +01:00
parent 75d85115e8
commit 7186716a4c
No known key found for this signature in database
GPG Key ID: 62D0FBAE5BF9B953
8 changed files with 27 additions and 26 deletions

View File

@ -368,9 +368,9 @@ acceptance("Composer - Image Preview - Plugin API", function (needs) {
"My Custom Button",
"custom-button-class",
"lock",
(event) => {
async (event) => {
if (event.target.classList.contains("custom-button-class")) {
fillIn(".d-editor-input", "custom button change");
await fillIn(".d-editor-input", "custom button change");
}
}
);

View File

@ -154,7 +154,9 @@ acceptance("Composer - Messages - Duplicate links", function (needs) {
await click("button.create");
// Work around the lack of CSS transitions in the test env
triggerEvent("#reply-control", "transitionend", { propertyName: "height" });
await triggerEvent("#reply-control", "transitionend", {
propertyName: "height",
});
assert
.dom(".composer-popup")

View File

@ -15,8 +15,7 @@ import { acceptance, queryAll } from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper";
import { i18n } from "discourse-i18n";
const clickOutside = () =>
triggerEvent(document.querySelector("header.d-header"), "pointerdown");
const clickOutside = () => triggerEvent("header.d-header", "pointerdown");
acceptance("Search - Anonymous", function (needs) {
needs.pretender((server, helper) => {

View File

@ -406,8 +406,7 @@ acceptance("User menu", function (needs) {
});
test("the profile tab", async function (assert) {
const clickOutside = () =>
triggerEvent(document.querySelector("header.d-header"), "pointerdown");
const clickOutside = () => triggerEvent("header.d-header", "pointerdown");
updateCurrentUser({ draft_count: 13 });
await visit("/");

View File

@ -60,8 +60,11 @@ module("Integration | Component | d-editor", function (hooks) {
assert.dom(".d-editor-preview").hasHtml("<p>zogstrip</p>");
});
function jumpEnd(selector) {
const textarea = document.querySelector(selector);
function jumpEnd(textarea) {
if (typeof textarea === "string") {
textarea = document.querySelector(textarea);
}
textarea.selectionStart = textarea.value.length;
textarea.selectionEnd = textarea.value.length;
return textarea;

View File

@ -24,8 +24,8 @@ module("Integration | Component | date-input", function (hooks) {
hbs`<DateInput @date={{this.date}} @onChange={{this.onChange}} />`
);
fillIn(".date-picker", "2019-01-02");
triggerEvent(".date-picker", "change");
await fillIn(".date-picker", "2019-01-02");
await triggerEvent(".date-picker", "change");
assert.true(this.date.isSame(DEFAULT_DATE));
});
@ -38,8 +38,8 @@ module("Integration | Component | date-input", function (hooks) {
hbs`<DateInput @date={{this.date}} @onChange={{this.onChange}} />`
);
fillIn(".date-picker", "2019-02-02");
triggerEvent(".date-picker", "change");
await fillIn(".date-picker", "2019-02-02");
await triggerEvent(".date-picker", "change");
assert.true(this.date.isSame(moment("2019-02-02")));
});

View File

@ -177,9 +177,7 @@ module("Integration | Component | home-logo", function (hooks) {
test("the home logo href url defaults to /", async function (assert) {
await render(<template><HomeLogo @minimized={{false}} /></template>);
assert
.dom(".home-logo-wrapper-outlet a")
.hasAttribute("href", "/", "home logo href equals /");
assert.dom(".title a").hasAttribute("href", "/", "home logo href equals /");
});
test("api.registerHomeLogoHrefCallback can be used to change the logo href url", async function (assert) {
@ -190,7 +188,7 @@ module("Integration | Component | home-logo", function (hooks) {
await render(<template><HomeLogo @minimized={{false}} /></template>);
assert
.dom(".home-logo-wrapper-outlet a")
.dom(".title a")
.hasAttribute(
"href",
"https://example.com",

View File

@ -1,4 +1,4 @@
import { render } from "@ember/test-helpers";
import { find, render } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
@ -14,13 +14,13 @@ module(
);
assert.strictEqual(
document.querySelector(".btn:nth-child(1)").offsetHeight,
document.querySelector(".btn:nth-child(2)").offsetHeight,
find(".btn:nth-child(1)").offsetHeight,
find(".btn:nth-child(2)").offsetHeight,
"have equal height"
);
assert.strictEqual(
document.querySelector(".btn:nth-child(1)").offsetHeight,
document.querySelector(".btn:nth-child(3)").offsetHeight,
find(".btn:nth-child(1)").offsetHeight,
find(".btn:nth-child(3)").offsetHeight,
"have equal height"
);
});
@ -31,8 +31,8 @@ module(
);
assert.strictEqual(
document.querySelector("input").offsetHeight,
document.querySelector(".btn").offsetHeight,
find("input").offsetHeight,
find(".btn").offsetHeight,
"have equal height"
);
});
@ -43,8 +43,8 @@ module(
);
assert.strictEqual(
document.querySelector("input").offsetHeight,
document.querySelector(".combo-box").offsetHeight,
find("input").offsetHeight,
find(".combo-box").offsetHeight,
"have equal height"
);
});