mirror of
https://github.com/discourse/discourse.git
synced 2024-11-21 16:38:15 -06:00
DEV: Use selectors instead of query()
where possible (#29677)
This commit is contained in:
parent
16a9663557
commit
78ed0bb711
@ -16,7 +16,7 @@ acceptance("Emoji", function (needs) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
await simulateKeys(query(".d-editor-input"), "a :blonde_wo\t");
|
||||
await simulateKeys(".d-editor-input", "a :blonde_wo\t");
|
||||
|
||||
assert.strictEqual(
|
||||
normalizeHtml(query(".d-editor-preview").innerHTML.trim()),
|
||||
@ -30,7 +30,7 @@ acceptance("Emoji", function (needs) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
await simulateKeys(query(".d-editor-input"), "an :arrow");
|
||||
await simulateKeys(".d-editor-input", "an :arrow");
|
||||
// the 6th item in the list is the "more..."
|
||||
await click(".autocomplete.ac-emoji ul li:nth-of-type(6)");
|
||||
|
||||
@ -49,7 +49,7 @@ acceptance("Emoji", function (needs) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
|
||||
await fillIn(query(".d-editor-input"), "a :blonde_woman:t5:");
|
||||
await fillIn(".d-editor-input", "a :blonde_woman:t5:");
|
||||
|
||||
assert.strictEqual(
|
||||
normalizeHtml(query(".d-editor-preview").innerHTML.trim()),
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Group logs", function (needs) {
|
||||
needs.user();
|
||||
@ -99,7 +99,7 @@ acceptance("Group logs", function (needs) {
|
||||
.dom("tr.group-manage-logs-row")
|
||||
.exists({ count: 2 }, "displays the right number of logs");
|
||||
|
||||
await click(query(".group-manage-logs-row button"));
|
||||
await click(".group-manage-logs-row button");
|
||||
assert
|
||||
.dom("tr.group-manage-logs-row")
|
||||
.exists({ count: 1 }, "displays the right number of logs");
|
||||
|
@ -2,7 +2,6 @@ import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
simulateKeys,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
@ -55,7 +54,7 @@ acceptance("#hashtag autocompletion in composer", function (needs) {
|
||||
test(":emoji: unescape in autocomplete search results", async function (assert) {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await simulateKeys(query(".d-editor-input"), "abc #o");
|
||||
await simulateKeys(".d-editor-input", "abc #o");
|
||||
|
||||
assert.dom(".hashtag-autocomplete__option").exists({ count: 3 });
|
||||
assert
|
||||
|
@ -80,7 +80,7 @@ acceptance("User Preferences - Account", function (needs) {
|
||||
assert.dom(".username-preference__input").hasValue("eviltrout");
|
||||
assert.dom(".username-preference__submit").isDisabled();
|
||||
|
||||
await fillIn(query(".username-preference__input"), "good_trout");
|
||||
await fillIn(".username-preference__input", "good_trout");
|
||||
assert.dom(".username-preference__submit").isEnabled();
|
||||
|
||||
await click(".username-preference__submit");
|
||||
|
@ -35,8 +35,8 @@ module("Integration | Component | site-setting", function (hooks) {
|
||||
});
|
||||
|
||||
await render(hbs`<SiteSetting @setting={{this.setting}} />`);
|
||||
await fillIn(query(".setting input"), "value");
|
||||
await click(query(".setting .d-icon-check"));
|
||||
await fillIn(".setting input", "value");
|
||||
await click(".setting .d-icon-check");
|
||||
|
||||
assert.strictEqual(query(".validation-error h1").outerHTML, message);
|
||||
});
|
||||
@ -55,8 +55,8 @@ module("Integration | Component | site-setting", function (hooks) {
|
||||
});
|
||||
|
||||
await render(hbs`<SiteSetting @setting={{this.setting}} />`);
|
||||
await fillIn(query(".setting input"), "value");
|
||||
await click(query(".setting .d-icon-check"));
|
||||
await fillIn(".setting input", "value");
|
||||
await click(".setting .d-icon-check");
|
||||
|
||||
assert.dom(".validation-error h1").doesNotExist();
|
||||
});
|
||||
@ -72,13 +72,13 @@ module("Integration | Component | site-setting", function (hooks) {
|
||||
|
||||
assert.dom(".formatted-selection").hasText("jpg, jpeg, png");
|
||||
|
||||
await click(query(".file-types-list__button.image"));
|
||||
await click(".file-types-list__button.image");
|
||||
|
||||
assert
|
||||
.dom(".formatted-selection")
|
||||
.hasText("jpg, jpeg, png, gif, heic, heif, webp, avif, svg");
|
||||
|
||||
await click(query(".file-types-list__button.image"));
|
||||
await click(".file-types-list__button.image");
|
||||
|
||||
assert
|
||||
.dom(".formatted-selection")
|
||||
|
@ -6,7 +6,6 @@ import { Promise } from "rsvp";
|
||||
import { h } from "virtual-dom";
|
||||
import { withPluginApi } from "discourse/lib/plugin-api";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import widgetHbs from "discourse/widgets/hbs-compiler";
|
||||
import { createWidget } from "discourse/widgets/widget";
|
||||
import I18n from "discourse-i18n";
|
||||
@ -171,7 +170,7 @@ module("Integration | Component | Widget | base", function (hooks) {
|
||||
assert.dom("button.test").exists("renders the button");
|
||||
assert.dom("button.test").hasText("0 clicks");
|
||||
|
||||
await click(query("button"));
|
||||
await click("button");
|
||||
assert.dom("button.test").hasText("1 clicks");
|
||||
});
|
||||
|
||||
|
@ -4,7 +4,7 @@ import hbs from "htmlbars-inline-precompile";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender from "discourse/tests/helpers/create-pretender";
|
||||
import { query, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import I18n from "discourse-i18n";
|
||||
import ChatFabricators from "discourse/plugins/chat/discourse/lib/fabricators";
|
||||
|
||||
@ -57,7 +57,7 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {
|
||||
"Notice is present"
|
||||
);
|
||||
|
||||
await click(query(".chat-notices__notice__clear"), "Clear the notice");
|
||||
await click(".chat-notices__notice__clear");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".chat-notices .chat-notices__notice").length,
|
||||
@ -96,10 +96,7 @@ module("Discourse Chat | Component | chat-notice", function (hooks) {
|
||||
return [200, { "Content-Type": "application/json" }, {}];
|
||||
});
|
||||
|
||||
await click(
|
||||
query(".mention-without-membership-notice__body__link"),
|
||||
"Invites the user"
|
||||
);
|
||||
await click(".mention-without-membership-notice__body__link");
|
||||
|
||||
// I would love to test that the invitation sent text is present here but
|
||||
// dismiss is called right away instead of waiting 3 seconds.. Not much we can
|
||||
|
Loading…
Reference in New Issue
Block a user