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