From e381a555339a2b23413a757dbe396e977e978ebf Mon Sep 17 00:00:00 2001 From: David Taylor Date: Thu, 16 Feb 2023 13:50:01 +0000 Subject: [PATCH] DEV: Update section-link-test to ignore order of classes --- .../components/sidebar/section-link-test.js | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/app/assets/javascripts/discourse/tests/integration/components/sidebar/section-link-test.js b/app/assets/javascripts/discourse/tests/integration/components/sidebar/section-link-test.js index 1267cff3962..28cafd27e8d 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/sidebar/section-link-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/sidebar/section-link-test.js @@ -6,6 +6,14 @@ import { render } from "@ember/test-helpers"; import { setupRenderingTest } from "discourse/tests/helpers/component-test"; import { query } from "discourse/tests/helpers/qunit-helpers"; +function containsExactly(assert, expectation, actual, message) { + assert.deepEqual( + Array.from(expectation).sort(), + Array.from(actual).sort(), + message + ); +} + module("Integration | Component | sidebar | section-link", function (hooks) { setupRenderingTest(hooks); @@ -14,9 +22,15 @@ module("Integration | Component | sidebar | section-link", function (hooks) { await render(template); - assert.strictEqual( - query("a").className, - "sidebar-section-link sidebar-section-link-test sidebar-row ember-view", + containsExactly( + assert, + query("a").classList, + [ + "ember-view", + "sidebar-row", + "sidebar-section-link", + "sidebar-section-link-test", + ], "has the right class attribute for the link" ); }); @@ -26,9 +40,17 @@ module("Integration | Component | sidebar | section-link", function (hooks) { await render(template); - assert.strictEqual( - query("a").className, - "sidebar-section-link sidebar-section-link-test sidebar-row 123 abc ember-view", + containsExactly( + assert, + query("a").classList, + [ + "123", + "abc", + "ember-view", + "sidebar-row", + "sidebar-section-link", + "sidebar-section-link-test", + ], "has the right class attribute for the link" ); });