A platform for community discussion. Free, open, simple.
DEV: De-jQ sidebar tests (#18050)
Jarek Radosze21d2ac217e1
diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.jsindex ef91d6d3a6a..1d7a2f79b2f 100644--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-plugin-api-test.js@@ -258,31 +258,31 @@ acceptance("Sidebar - Plugin API", function (needs) {);assert.strictEqual(- links[0].children.item(0).style.color,+ links[0].children[0].style.color,"rgb(255, 0, 0)","has correct prefix color");assert.strictEqual(- $(links[0].children.item(0).children.item(0)).hasClass("d-icon-hashtag"),+ links[0].children[0].children[0].classList.contains("d-icon-hashtag"),true,"displays prefix icon");assert.strictEqual(- $(links[0].children.item(0).children.item(1)).hasClass("d-icon-lock"),+ links[0].children[0].children[1].classList.contains("d-icon-lock"),true,"displays prefix icon badge");assert.strictEqual(- $(links[0].children.item(2).children.item(0)).hasClass("d-icon-circle"),+ links[0].children[2].children[0].classList.contains("d-icon-circle"),true,"displays suffix icon");assert.strictEqual(- $(links[1].children[1])[0].textContent.trim(),+ links[1].children[1].textContent.trim(),"dev channel text","displays second link with correct text");@@ -294,19 +294,19 @@ acceptance("Sidebar - Plugin API", function (needs) {);assert.strictEqual(- links[1].children.item(0).style.color,+ links[1].children[0].style.color,"","has no color style when value is invalid");assert.strictEqual(- $(links[1].children)[0].textContent.trim(),+ links[1].children[0].textContent.trim(),"test text","displays prefix text");assert.strictEqual(- $(links[2].children[1])[0].textContent.trim(),+ links[2].children[1].textContent.trim(),"fun channel text","displays third link with correct text");@@ -318,7 +318,7 @@ acceptance("Sidebar - Plugin API", function (needs) {);assert.strictEqual(- $(links[2].children.item(0).children).attr("src"),+ links[2].children[0].children[0].getAttribute("src"),"/test.png","uses correct prefix image url");@@ -477,22 +477,22 @@ acceptance("Sidebar - Plugin API", function (needs) {await visit("/");- const customlatestSectionLink = query(+ const customLatestSectionLink = query(".sidebar-section-community .sidebar-section-link-latest");assert.ok(- customlatestSectionLink,+ customLatestSectionLink,"adds custom latest section link to community section");assert.ok(- customlatestSectionLink.href.endsWith("/latest"),+ customLatestSectionLink.href.endsWith("/latest"),"sets the right href attribute for the custom latest section link");assert.strictEqual(- customlatestSectionLink.textContent.trim(),+ customLatestSectionLink.textContent.trim(),I18n.t("filters.latest.title"),"displays the right text for custom latest section link");diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.jsindex d68aa801e99..7425f7d5418 100644--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-categories-section-test.js@@ -162,11 +162,9 @@ acceptance("Sidebar - Logged on user - Categories Section", function (needs) {".sidebar-section-categories .sidebar-section-link");- const categoryNames = [];-- categorySectionLinks.each((_index, categorySectionLink) => {- categoryNames.push(categorySectionLink.textContent.trim());- });+ const categoryNames = [...categorySectionLinks].map((categorySectionLink) =>+ categorySectionLink.textContent.trim()+ );assert.deepEqual(categoryNames,diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.jsindex ed85daf0047..e2adb12ffbe 100644--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-tags-section-test.js@@ -126,11 +126,9 @@ acceptance("Sidebar - Logged on user - Tags section", function (needs) {".sidebar-section-tags .sidebar-section-link");- const tagNames = [];-- tagSectionLinks.each((_index, tagSectionLink) => {- tagNames.push(tagSectionLink.textContent.trim());- });+ const tagNames = [...tagSectionLinks].map((tagSectionLink) =>+ tagSectionLink.textContent.trim()+ );assert.deepEqual(tagNames,diff --git a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.jsindex b724efd35ac..5f5aa93fca4 100644--- a/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js+++ b/app/assets/javascripts/discourse/tests/acceptance/sidebar-user-test.js@@ -1,5 +1,4 @@import I18n from "I18n";-import { test } from "qunit";import { click, visit } from "@ember/test-helpers";import { acceptance, exists } from "discourse/tests/helpers/qunit-helpers";@@ -13,7 +12,7 @@ acceptance(enable_experimental_sidebar_hamburger: false,});- test("clicking header hamburger icon displays old hamburger drodown", async function (assert) {+ test("clicking header hamburger icon displays old hamburger dropdown", async function (assert) {await visit("/");await click(".hamburger-dropdown");