From d162229758320648de2c2e59b02a0c1924361fed Mon Sep 17 00:00:00 2001 From: Jarek Radosz Date: Mon, 8 Nov 2021 10:26:28 +0100 Subject: [PATCH] DEV: Replace `equal()` with `strictEqual()` (#14827) --- .../tests/acceptance/account-created-test.js | 16 +- .../acceptance/admin-badges-award-test.js | 2 +- .../acceptance/admin-badges-show-test.js | 4 +- .../tests/acceptance/admin-emails-test.js | 4 +- .../admin-install-theme-modal-test.js | 14 +- .../acceptance/admin-site-settings-test.js | 26 +- .../tests/acceptance/admin-site-text-test.js | 6 +- .../acceptance/admin-suspend-user-test.js | 18 +- .../acceptance/admin-user-emails-test.js | 10 +- .../tests/acceptance/admin-user-index-test.js | 28 +- .../tests/acceptance/admin-users-list-test.js | 12 +- .../acceptance/admin-watched-words-test.js | 16 +- .../tests/acceptance/auth-complete-test.js | 8 +- .../tests/acceptance/bookmarks-test.js | 37 +-- .../tests/acceptance/category-banner-test.js | 2 +- .../tests/acceptance/category-chooser-test.js | 2 +- .../acceptance/category-edit-security-test.js | 36 ++- .../tests/acceptance/category-edit-test.js | 25 +- .../tests/acceptance/category-new-test.js | 6 +- .../tests/acceptance/click-track-test.js | 7 +- .../tests/acceptance/composer-actions-test.js | 155 ++++++---- .../acceptance/composer-attachment-test.js | 48 +-- .../acceptance/composer-draft-saving-test.js | 2 +- .../acceptance/composer-edit-conflict-test.js | 2 +- .../acceptance/composer-hyperlink-test.js | 6 +- .../tests/acceptance/composer-onebox-test.js | 10 +- .../tests/acceptance/composer-tags-test.js | 14 +- .../tests/acceptance/composer-test.js | 125 ++++---- .../acceptance/composer-topic-links-test.js | 24 +- .../acceptance/composer-uploads-uppy-test.js | 16 +- .../create-account-user-fields-test.js | 2 +- .../acceptance/create-invite-modal-test.js | 10 +- .../tests/acceptance/custom-html-set-test.js | 4 +- .../acceptance/custom-html-template-test.js | 2 +- .../tests/acceptance/dashboard-test.js | 14 +- .../tests/acceptance/do-not-disturb-test.js | 5 +- .../edit-notification-click-test.js | 4 +- .../tests/acceptance/emoji-picker-test.js | 10 +- .../discourse/tests/acceptance/emoji-test.js | 4 +- .../acceptance/enforce-second-factor-test.js | 12 +- .../tests/acceptance/fast-edit-test.js | 4 +- .../tests/acceptance/flag-post-test.js | 4 +- .../tests/acceptance/forgot-password-test.js | 14 +- .../tests/acceptance/group-index-test.js | 6 +- .../group-manage-categories-test.js | 4 +- .../group-manage-email-settings-test.js | 36 +-- .../group-manage-interaction-test.js | 26 +- .../acceptance/group-manage-logs-test.js | 4 +- .../group-manage-membership-test.js | 30 +- .../acceptance/group-manage-profile-test.js | 6 +- .../acceptance/group-manage-tags-test.js | 4 +- .../tests/acceptance/group-requests-test.js | 12 +- .../discourse/tests/acceptance/group-test.js | 36 +-- .../tests/acceptance/groups-index-test.js | 10 +- .../tests/acceptance/groups-new-test.js | 12 +- .../tests/acceptance/hamburger-menu-test.js | 2 +- .../tests/acceptance/hashtags-test.js | 2 +- .../tests/acceptance/invite-accept-test.js | 22 +- .../tests/acceptance/jump-to-test.js | 4 +- .../acceptance/keyboard-shortcuts-test.js | 20 +- .../tests/acceptance/login-redirect-test.js | 4 +- .../tests/acceptance/login-required-test.js | 8 +- ...email-and-hide-email-address-taken-test.js | 2 +- .../tests/acceptance/login-with-email-test.js | 8 +- .../tests/acceptance/mobile-discovery-test.js | 2 +- .../tests/acceptance/mobile-pan-test.js | 2 +- .../discourse/tests/acceptance/modal-test.js | 24 +- .../tests/acceptance/new-message-test.js | 6 +- .../tests/acceptance/new-topic-test.js | 8 +- .../tests/acceptance/notifications-test.js | 12 +- .../acceptance/opengraph-tag-updater-test.js | 2 +- .../tests/acceptance/personal-message-test.js | 2 +- .../plugin-keyboard-shortcut-test.js | 2 +- .../plugin-outlet-connector-class-test.js | 6 +- .../plugin-outlet-decorator-test.js | 4 +- .../plugin-outlet-multi-template-test.js | 8 +- .../plugin-outlet-single-template-test.js | 4 +- .../tests/acceptance/preferences-test.js | 26 +- .../acceptance/raw-plugin-outlet-test.js | 2 +- .../tests/acceptance/redirect-to-top-test.js | 14 +- .../tests/acceptance/reports-test.js | 9 +- .../discourse/tests/acceptance/review-test.js | 36 ++- .../tests/acceptance/search-full-test.js | 62 ++-- .../tests/acceptance/search-mobile-test.js | 4 +- .../discourse/tests/acceptance/search-test.js | 62 ++-- .../tests/acceptance/shared-drafts-test.js | 8 +- .../tests/acceptance/sign-in-test.js | 16 +- .../discourse/tests/acceptance/static-test.js | 2 +- .../acceptance/tags-intersection-test.js | 2 +- .../discourse/tests/acceptance/tags-test.js | 32 +- .../tests/acceptance/topic-admin-menu-test.js | 2 +- .../tests/acceptance/topic-discovery-test.js | 4 +- .../tests/acceptance/topic-edit-timer-test.js | 22 +- .../topic-footer-buttons-mobile-test.js | 4 +- .../acceptance/topic-list-tracker-test.js | 6 +- .../tests/acceptance/topic-move-posts-test.js | 6 +- .../topic-notifications-button-test.js | 8 +- .../acceptance/topic-quote-button-test.js | 2 +- .../tests/acceptance/topic-slow-mode-test.js | 8 +- .../discourse/tests/acceptance/topic-test.js | 24 +- .../tests/acceptance/topic-timeline-test.js | 2 +- .../tests/acceptance/unknown-test.js | 11 +- .../acceptance/user-activity-all-test.js | 2 +- .../acceptance/user-activity-likes-test.js | 2 +- .../acceptance/user-activity-replies-test.js | 2 +- .../tests/acceptance/user-anonymous-test.js | 8 +- .../acceptance/user-drafts-stream-test.js | 10 +- .../user-preferences-interface-test.js | 56 ++-- .../user-preferences-notifications-test.js | 16 +- .../acceptance/user-private-messages-test.js | 66 +++-- .../discourse/tests/acceptance/user-test.js | 10 +- .../discourse/tests/acceptance/users-test.js | 23 +- .../integration/components/ace-editor-test.js | 4 +- .../components/admin-report-test.js | 16 +- .../components/badge-title-test.js | 2 +- .../integration/components/bookmark-test.js | 13 +- .../integration/components/cook-text-test.js | 4 +- .../integration/components/d-button-test.js | 32 +- .../integration/components/d-editor-test.js | 270 ++++++++--------- .../integration/components/d-icon-test.js | 4 +- .../integration/components/date-input-test.js | 2 +- .../components/date-time-input-range-test.js | 8 +- .../components/date-time-input-test.js | 4 +- .../components/group-list-setting-test.js | 4 +- .../group-membership-button-test.js | 6 +- .../components/highlighted-code-test.js | 7 +- .../components/iframed-html-test.js | 4 +- .../components/image-uploader-test.js | 12 +- .../integration/components/input-size-test.js | 8 +- .../components/invite-panel-test.js | 2 +- .../components/relative-time-picker-test.js | 40 +-- .../components/secret-value-list-test.js | 10 +- .../components/select-kit/api-test.js | 10 +- .../select-kit/category-chooser-test.js | 70 ++--- .../select-kit/category-drop-test.js | 34 ++- .../components/select-kit/combo-box-test.js | 4 +- .../select-kit/dropdown-select-box-test.js | 2 +- .../select-kit/list-setting-test.js | 8 +- .../select-kit/mini-tag-chooser-test.js | 14 +- .../select-kit/multi-select-test.js | 10 +- .../select-kit/pinned-options-test.js | 8 +- .../select-kit/single-select-test.js | 62 ++-- .../components/select-kit/tag-drop-test.js | 4 +- .../topic-notifications-button-test.js | 22 +- .../topic-notifications-options-test.js | 8 +- .../select-kit/user-chooser-test.js | 4 +- .../components/simple-list-test.js | 8 +- .../components/site-header-test.js | 2 +- .../components/slow-mode-info-test.js | 4 +- .../integration/components/text-field-test.js | 10 +- .../components/themes-list-item-test.js | 6 +- .../components/themes-list-test.js | 38 +-- .../integration/components/time-input-test.js | 6 +- .../integration/components/topic-list-test.js | 6 +- .../components/uppy-image-uploader-test.js | 12 +- .../components/user-avatar-flair-test.js | 10 +- .../components/user-selector-test.js | 14 +- .../integration/components/value-list-test.js | 12 +- .../widgets/actions-summary-test.js | 4 +- .../integration/widgets/avatar-flair-test.js | 2 +- .../tests/integration/widgets/button-test.js | 7 +- .../widgets/default-notification-item-test.js | 6 +- .../widgets/hamburger-menu-test.js | 12 +- .../integration/widgets/home-logo-test.js | 60 ++-- .../integration/widgets/post-links-test.js | 6 +- .../integration/widgets/post-menu-test.js | 2 +- .../integration/widgets/post-stream-test.js | 34 +-- .../tests/integration/widgets/post-test.js | 88 +++--- .../integration/widgets/poster-name-test.js | 6 +- .../widgets/quick-access-item-test.js | 4 +- .../widgets/small-user-list-test.js | 2 +- .../widgets/software-update-prompt-test.js | 2 +- .../integration/widgets/user-menu-test.js | 4 +- .../widgets/widget-dropdown-test.js | 27 +- .../tests/integration/widgets/widget-test.js | 44 +-- .../unit/controllers/avatar-selector-test.js | 6 +- .../unit/controllers/create-account-test.js | 20 +- .../tests/unit/controllers/history-test.js | 10 +- .../controllers/preferences-account-test.js | 8 +- .../controllers/preferences-profile-test.js | 10 +- .../preferences-second-factor-test.js | 2 +- .../controllers/reorder-categories-test.js | 2 +- .../tests/unit/controllers/topic-test.js | 70 +++-- .../tests/unit/ember/resolver-test.js | 2 +- .../discourse/tests/unit/lib/bookmark-test.js | 6 +- .../tests/unit/lib/category-badge-test.js | 18 +- .../unit/lib/click-track-edit-history-test.js | 6 +- .../unit/lib/click-track-profile-page-test.js | 9 +- .../tests/unit/lib/click-track-test.js | 9 +- .../discourse/tests/unit/lib/computed-test.js | 24 +- .../tests/unit/lib/emoji-store-test.js | 4 +- .../discourse/tests/unit/lib/emoji-test.js | 6 +- .../tests/unit/lib/formatter-test.js | 279 ++++++++++-------- .../discourse/tests/unit/lib/get-url-test.js | 92 +++--- .../tests/unit/lib/highlight-search-test.js | 4 +- .../discourse/tests/unit/lib/i18n-test.js | 56 ++-- .../tests/unit/lib/icon-library-test.js | 4 +- .../tests/unit/lib/key-value-store-test.js | 6 +- .../tests/unit/lib/link-mentions-test.js | 11 +- .../tests/unit/lib/load-script-test.js | 8 +- .../discourse/tests/unit/lib/oneboxer-test.js | 4 +- .../tests/unit/lib/parse-bbcode-tag-test.js | 6 +- .../tests/unit/lib/preload-store-test.js | 10 +- .../tests/unit/lib/pretty-text-test.js | 6 +- .../tests/unit/lib/sanitizer-test.js | 54 ++-- .../discourse/tests/unit/lib/search-test.js | 12 +- .../discourse/tests/unit/lib/sharing-test.js | 8 +- .../tests/unit/lib/text-direction-test.js | 14 +- .../tests/unit/lib/time-utils-test.js | 26 +- .../tests/unit/lib/to-markdown-test.js | 102 +++---- .../tests/unit/lib/upload-short-url-test.js | 14 +- .../discourse/tests/unit/lib/uploads-test.js | 14 +- .../unit/lib/uppy-checksum-plugin-test.js | 39 +-- .../uppy-media-optimization-plugin-test.js | 58 ++-- .../discourse/tests/unit/lib/url-test.js | 19 +- .../tests/unit/lib/user-search-test.js | 36 +-- .../tests/unit/lib/utilities-test.js | 58 ++-- .../discourse/tests/unit/localization-test.js | 6 +- .../tests/unit/mixins/setting-object-test.js | 16 +- .../tests/unit/mixins/singleton-test.js | 16 +- .../discourse/tests/unit/models/badge-test.js | 12 +- .../tests/unit/models/category-test.js | 2 +- .../tests/unit/models/composer-test.js | 56 ++-- .../tests/unit/models/email-log-test.js | 2 +- .../discourse/tests/unit/models/group-test.js | 4 +- .../tests/unit/models/nav-item-test.js | 10 +- .../tests/unit/models/post-stream-test.js | 226 ++++++++------ .../discourse/tests/unit/models/post-test.js | 6 +- .../tests/unit/models/report-test.js | 129 ++++---- .../tests/unit/models/rest-model-test.js | 18 +- .../tests/unit/models/result-set-test.js | 12 +- .../discourse/tests/unit/models/site-test.js | 10 +- .../discourse/tests/unit/models/theme-test.js | 10 +- .../tests/unit/models/topic-details-test.js | 2 +- .../discourse/tests/unit/models/topic-test.js | 48 +-- .../unit/models/topic-tracking-state-test.js | 166 +++++++---- .../tests/unit/models/user-action-test.js | 6 +- .../tests/unit/models/user-badge-test.js | 10 +- .../tests/unit/models/user-drafts-test.js | 10 +- .../tests/unit/models/user-stream-test.js | 12 +- .../discourse/tests/unit/models/user-test.js | 14 +- .../unit/services/document-title-test.js | 22 +- .../tests/unit/services/presence-test.js | 76 ++--- .../tests/unit/services/store-test.js | 58 ++-- .../tests/unit/utils/decorators-test.js | 4 +- .../wizard/test/acceptance/wizard-test.js | 2 +- .../test/components/invite-list-test.js | 6 +- .../acceptance/details-button-test.js.es6 | 22 +- .../lib/details-cooked-test.js.es6 | 2 +- .../acceptance/download-calendar-test.js.es6 | 2 +- .../local-dates-composer-test.js.es6 | 24 +- .../lib/date-with-zone-helper-test.js.es6 | 18 +- .../lib/local-date-builder-test.js.es6 | 2 +- .../acceptance/discourse-presence-test.js | 26 +- .../acceptance/poll-breakdown-test.js.es6 | 8 +- .../acceptance/poll-pie-chart-test.js.es6 | 8 +- .../acceptance/poll-quote-test.js.es6 | 4 +- .../acceptance/poll-results-test.js.es6 | 20 +- .../polls-bar-chart-test-desktop.js.es6 | 18 +- .../polls-bar-chart-test-mobile.js.es6 | 6 +- .../controllers/poll-ui-builder-test.js.es6 | 44 +-- ...iscourse-poll-standard-results-test.js.es6 | 22 +- .../widgets/discourse-poll-test.js.es6 | 12 +- 263 files changed, 2827 insertions(+), 2363 deletions(-) diff --git a/app/assets/javascripts/discourse/tests/acceptance/account-created-test.js b/app/assets/javascripts/discourse/tests/acceptance/account-created-test.js index 0eac23bc6fe..f2cd00f4704 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/account-created-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/account-created-test.js @@ -15,7 +15,7 @@ acceptance("Account Created", function () { await visit("/u/account-created"); assert.ok(exists(".account-created")); - assert.equal( + assert.strictEqual( queryAll(".account-created .ac-message").text().trim(), "Hello World", "it displays the message" @@ -34,7 +34,7 @@ acceptance("Account Created", function () { await visit("/u/account-created"); assert.ok(exists(".account-created")); - assert.equal( + assert.strictEqual( queryAll(".account-created .ac-message").text().trim(), "Hello World", "it displays the message" @@ -42,9 +42,9 @@ acceptance("Account Created", function () { await click(".activation-controls .resend"); - assert.equal(currentRouteName(), "account-created.resent"); + assert.strictEqual(currentRouteName(), "account-created.resent"); const email = queryAll(".account-created .ac-message b").text(); - assert.equal(email, "eviltrout@example.com"); + assert.strictEqual(email, "eviltrout@example.com"); }); test("account created - update email - cancel", async function (assert) { @@ -59,12 +59,12 @@ acceptance("Account Created", function () { await click(".activation-controls .edit-email"); - assert.equal(currentRouteName(), "account-created.edit-email"); + assert.strictEqual(currentRouteName(), "account-created.edit-email"); assert.ok(exists(".activation-controls .btn-primary:disabled")); await click(".activation-controls .edit-cancel"); - assert.equal(currentRouteName(), "account-created.index"); + assert.strictEqual(currentRouteName(), "account-created.index"); }); test("account created - update email - submit", async function (assert) { @@ -87,8 +87,8 @@ acceptance("Account Created", function () { await click(".activation-controls .btn-primary"); - assert.equal(currentRouteName(), "account-created.resent"); + assert.strictEqual(currentRouteName(), "account-created.resent"); const email = queryAll(".account-created .ac-message b").text(); - assert.equal(email, "newemail@example.com"); + assert.strictEqual(email, "newemail@example.com"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-badges-award-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-badges-award-test.js index c2c6e66119e..8f9ad67e772 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-badges-award-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-badges-award-test.js @@ -14,7 +14,7 @@ acceptance("Admin - Badges - Mass Award", function (needs) { await click( '.admin-badge-list-item span[data-badge-name="Both image and icon"]' ); - assert.equal( + assert.strictEqual( query("label.grant-existing-holders").textContent.trim(), I18n.t("admin.badges.mass_award.grant_existing_holders"), "checkbox for granting existing holders is displayed" diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-badges-show-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-badges-show-test.js index e0a52b16451..531342e2fff 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-badges-show-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-badges-show-test.js @@ -51,7 +51,7 @@ acceptance("Admin - Badges - Show", function (needs) { ); assert.ok(exists(".icon-picker"), "icon picker is visible"); assert.ok(!exists(".image-uploader"), "image uploader is not visible"); - assert.equal(query(".icon-picker").textContent.trim(), "fa-rocket"); + assert.strictEqual(query(".icon-picker").textContent.trim(), "fa-rocket"); }); test("existing badge that has an image URL", async function (assert) { @@ -92,6 +92,6 @@ acceptance("Admin - Badges - Show", function (needs) { await click("input#badge-icon"); assert.ok(exists(".icon-picker"), "icon picker is becomes visible"); assert.ok(!exists(".image-uploader"), "image uploader becomes hidden"); - assert.equal(query(".icon-picker").textContent.trim(), "fa-rocket"); + assert.strictEqual(query(".icon-picker").textContent.trim(), "fa-rocket"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-emails-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-emails-test.js index 0b2342b9dc6..12af83c2bbe 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-emails-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-emails-test.js @@ -32,8 +32,8 @@ acceptance("Admin - Emails", function (needs) { await fillIn("textarea.email-body", EMAIL.trim()); await click(".email-advanced-test button"); - assert.equal(queryAll(".text pre").text(), "Hello, this is a test!"); - assert.equal( + assert.strictEqual(queryAll(".text pre").text(), "Hello, this is a test!"); + assert.strictEqual( queryAll(".elided pre").text(), "---\n\nThis part should be elided." ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js index 8c85c6e6250..27eaf158d75 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-install-theme-modal-test.js @@ -20,8 +20,8 @@ acceptance("Admin - Themes - Install modal", function (needs) { await click(".install-theme-content .inputs .advanced-repo"); await fillIn(branchInput, "tests-passed"); await click(privateRepoCheckbox); - assert.equal(query(urlInput).value, themeUrl, "url input is filled"); - assert.equal( + assert.strictEqual(query(urlInput).value, themeUrl, "url input is filled"); + assert.strictEqual( query(branchInput).value, "tests-passed", "branch input is filled" @@ -36,8 +36,8 @@ acceptance("Admin - Themes - Install modal", function (needs) { await click(".create-actions .btn-primary"); await click("#remote"); - assert.equal(query(urlInput).value, "", "url input is reset"); - assert.equal(query(branchInput).value, "", "branch input is reset"); + assert.strictEqual(query(urlInput).value, "", "url input is reset"); + assert.strictEqual(query(branchInput).value, "", "branch input is reset"); assert.ok( !query(privateRepoCheckbox).checked, "private repo checkbox unchecked" @@ -60,7 +60,7 @@ acceptance("Admin - Themes - Install modal", function (needs) { await fillIn(urlInput, themeUrl); await click(".install-theme-content .inputs .advanced-repo"); await click(privateRepoCheckbox); - assert.equal(query(urlInput).value, themeUrl, "url input is filled"); + assert.strictEqual(query(urlInput).value, themeUrl, "url input is filled"); assert.ok( query(privateRepoCheckbox).checked, "private repo checkbox is checked" @@ -84,7 +84,7 @@ acceptance("Admin - Themes - Install modal", function (needs) { test("modal can be auto-opened with the right query params", async function (assert) { await visit("/admin/customize/themes?repoUrl=testUrl&repoName=testName"); assert.ok(query(".admin-install-theme-modal"), "modal is visible"); - assert.equal( + assert.strictEqual( query(".install-theme code").textContent.trim(), "testUrl", "repo url is visible" @@ -101,7 +101,7 @@ acceptance("Admin - Themes - Install modal", function (needs) { ), "no install button is shown for installed themes" ); - assert.equal( + assert.strictEqual( query( '.popular-theme-item[data-name="Graceful"] .popular-theme-buttons' ).textContent.trim(), diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-site-settings-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-site-settings-test.js index af086ac6d91..d5ace605562 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-site-settings-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-site-settings-test.js @@ -54,7 +54,7 @@ acceptance("Admin - Site Settings", function (needs) { test("links to staff action log", async function (assert) { await visit("/admin/site_settings"); - assert.equal( + assert.strictEqual( queryAll(".row.setting .setting-label h3 a").attr("href"), "/admin/logs/staff_action_logs?filters=%7B%22subject%22%3A%22title%22%2C%22action_name%22%3A%22change_site_setting%22%7D&force_refresh=true", "it links to the staff action log" @@ -64,7 +64,11 @@ acceptance("Admin - Site Settings", function (needs) { test("changing value updates dirty state", async function (assert) { await visit("/admin/site_settings"); await fillIn("#setting-filter", " title "); - assert.equal(count(".row.setting"), 1, "filter returns 1 site setting"); + assert.strictEqual( + count(".row.setting"), + 1, + "filter returns 1 site setting" + ); assert.ok(!exists(".row.setting.overridden"), "setting isn't overriden"); await fillIn(".input-setting-string", "Test"); @@ -111,31 +115,31 @@ acceptance("Admin - Site Settings", function (needs) { test("always shows filtered site settings if a filter is set", async function (assert) { await visit("/admin/site_settings"); await fillIn("#setting-filter", "title"); - assert.equal(count(".row.setting"), 1); + assert.strictEqual(count(".row.setting"), 1); // navigate away to the "Dashboard" page await click(".nav.nav-pills li:nth-child(1) a"); - assert.equal(count(".row.setting"), 0); + assert.strictEqual(count(".row.setting"), 0); // navigate back to the "Settings" page await click(".nav.nav-pills li:nth-child(2) a"); - assert.equal(count(".row.setting"), 1); + assert.strictEqual(count(".row.setting"), 1); }); test("filter settings by plugin name", async function (assert) { await visit("/admin/site_settings"); await fillIn("#setting-filter", "plugin:discourse-logo"); - assert.equal(count(".row.setting"), 1); + assert.strictEqual(count(".row.setting"), 1); // inexistent plugin await fillIn("#setting-filter", "plugin:discourse-plugin"); - assert.equal(count(".row.setting"), 0); + assert.strictEqual(count(".row.setting"), 0); }); test("category name is preserved", async function (assert) { await visit("admin/site_settings/category/basic?filter=menu"); - assert.equal( + assert.strictEqual( currentURL(), "admin/site_settings/category/basic?filter=menu" ); @@ -145,16 +149,16 @@ acceptance("Admin - Site Settings", function (needs) { await visit("admin/site_settings"); await click(".admin-nav .basic a"); - assert.equal(currentURL(), "/admin/site_settings/category/basic"); + assert.strictEqual(currentURL(), "/admin/site_settings/category/basic"); await fillIn("#setting-filter", "menu"); - assert.equal( + assert.strictEqual( currentURL(), "/admin/site_settings/category/basic?filter=menu" ); await fillIn("#setting-filter", "contact"); - assert.equal( + assert.strictEqual( currentURL(), "/admin/site_settings/category/all_results?filter=contact" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-site-text-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-site-text-test.js index 5cfcb3b7ecc..b61f9f71571 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-site-text-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-site-text-test.js @@ -18,14 +18,14 @@ acceptance("Admin - Site Texts", function (needs) { await fillIn(".site-text-search", "Test"); - assert.equal(currentURL(), "/admin/customize/site_texts?q=Test"); + assert.strictEqual(currentURL(), "/admin/customize/site_texts?q=Test"); assert.ok(exists(".site-text")); assert.ok(exists(".site-text:not(.overridden)")); assert.ok(exists(".site-text.overridden")); // Only show overridden await click(".search-area .filter-options input"); - assert.equal( + assert.strictEqual( currentURL(), "/admin/customize/site_texts?overridden=true&q=Test" ); @@ -37,7 +37,7 @@ acceptance("Admin - Site Texts", function (needs) { test("edit and revert a site text by key", async function (assert) { await visit("/admin/customize/site_texts/site.test?locale=en"); - assert.equal(queryAll(".title h3").text(), "site.test"); + assert.strictEqual(queryAll(".title h3").text(), "site.test"); assert.ok(!exists(".saved")); assert.ok(!exists(".revert-site-text")); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-suspend-user-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-suspend-user-test.js index 2c66f4dbb65..ade2b2cafaa 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-suspend-user-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-suspend-user-test.js @@ -35,7 +35,7 @@ acceptance("Admin - Suspend User", function (needs) { await visit("/admin/users/1234/regular"); await click(".suspend-user"); - assert.equal(count(".suspend-user-modal:visible"), 1); + assert.strictEqual(count(".suspend-user-modal:visible"), 1); await click(".d-modal-cancel"); @@ -46,24 +46,24 @@ acceptance("Admin - Suspend User", function (needs) { await visit("/admin/users/1234/regular"); await click(".suspend-user"); - assert.equal(count(".suspend-user-modal:visible"), 1); + assert.strictEqual(count(".suspend-user-modal:visible"), 1); await fillIn("input.suspend-reason", "for breaking the rules"); await fillIn(".suspend-message", "this is an email reason why"); await click(".d-modal-cancel"); - assert.equal(count(".bootbox.modal:visible"), 1); + assert.strictEqual(count(".bootbox.modal:visible"), 1); await click(".modal-footer .btn-default"); - assert.equal(count(".suspend-user-modal:visible"), 1); - assert.equal( + assert.strictEqual(count(".suspend-user-modal:visible"), 1); + assert.strictEqual( query(".suspend-message").value, "this is an email reason why" ); await click(".d-modal-cancel"); - assert.equal(count(".bootbox.modal:visible"), 1); + assert.strictEqual(count(".bootbox.modal:visible"), 1); assert.ok(!exists(".suspend-user-modal:visible")); await click(".modal-footer .btn-primary"); @@ -81,7 +81,11 @@ acceptance("Admin - Suspend User", function (needs) { await click(".suspend-user"); - assert.equal(count(".perform-suspend[disabled]"), 1, "disabled by default"); + assert.strictEqual( + count(".perform-suspend[disabled]"), + 1, + "disabled by default" + ); await suspendUntilCombobox.expand(); await suspendUntilCombobox.selectRowByValue("tomorrow"); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js index 400d03e5c8f..15fba577945 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-user-emails-test.js @@ -4,13 +4,13 @@ import I18n from "I18n"; import { test } from "qunit"; function assertNoSecondary(assert) { - assert.equal( + assert.strictEqual( queryAll(".display-row.email .value a").text(), "eviltrout@example.com", "it should display the primary email" ); - assert.equal( + assert.strictEqual( queryAll(".display-row.secondary-emails .value").text().trim(), I18n.t("user.email.no_secondary"), "it should not display secondary emails" @@ -18,13 +18,13 @@ function assertNoSecondary(assert) { } function assertMultipleSecondary(assert, firstEmail, secondEmail) { - assert.equal( + assert.strictEqual( queryAll(".display-row.secondary-emails .value li:first-of-type a").text(), firstEmail, "it should display the first secondary email" ); - assert.equal( + assert.strictEqual( queryAll(".display-row.secondary-emails .value li:last-of-type a").text(), secondEmail, "it should display the second secondary email" @@ -43,7 +43,7 @@ acceptance("Admin - User Emails", function (needs) { test("viewing self with multiple secondary emails", async function (assert) { await visit("/admin/users/3/markvanlan"); - assert.equal( + assert.strictEqual( queryAll(".display-row.email .value a").text(), "markvanlan@example.com", "it should display the user's primary email" diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js index c1403fa8609..bb766e5ca80 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-user-index-test.js @@ -101,19 +101,25 @@ acceptance("Admin - User Index", function (needs) { test("can edit username", async function (assert) { await visit("/admin/users/2/sam"); - assert.equal(queryAll(".display-row.username .value").text().trim(), "sam"); + assert.strictEqual( + queryAll(".display-row.username .value").text().trim(), + "sam" + ); // Trying cancel. await click(".display-row.username button"); await fillIn(".display-row.username .value input", "new-sam"); await click(".display-row.username a"); - assert.equal(queryAll(".display-row.username .value").text().trim(), "sam"); + assert.strictEqual( + queryAll(".display-row.username .value").text().trim(), + "sam" + ); // Doing edit. await click(".display-row.username button"); await fillIn(".display-row.username .value input", "new-sam"); await click(".display-row.username button"); - assert.equal( + assert.strictEqual( queryAll(".display-row.username .value").text().trim(), "new-sam" ); @@ -122,7 +128,7 @@ acceptance("Admin - User Index", function (needs) { test("shows the number of post edits", async function (assert) { await visit("/admin/users/1/eviltrout"); - assert.equal(queryAll(".post-edits-count .value").text().trim(), "6"); + assert.strictEqual(queryAll(".post-edits-count .value").text().trim(), "6"); assert.ok( exists(".post-edits-count .controls .btn.btn-icon"), @@ -137,7 +143,7 @@ acceptance("Admin - User Index", function (needs) { await click(".post-edits-count .controls .btn.btn-icon"); - assert.equal( + assert.strictEqual( currentURL(), `/admin/reports/post_edits?filters=${filter}`, "it redirects to the right admin report" @@ -156,7 +162,7 @@ acceptance("Admin - User Index", function (needs) { test("will clear unsaved groups when switching user", async function (assert) { await visit("/admin/users/2/sam"); - assert.equal( + assert.strictEqual( queryAll(".display-row.username .value").text().trim(), "sam", "the name should be correct" @@ -165,11 +171,15 @@ acceptance("Admin - User Index", function (needs) { const groupChooser = selectKit(".group-chooser"); await groupChooser.expand(); await groupChooser.selectRowByValue(42); - assert.equal(groupChooser.header().value(), 42, "group should be set"); + assert.strictEqual( + groupChooser.header().value(), + "42", + "group should be set" + ); await visit("/admin/users/1/eviltrout"); - assert.equal( + assert.strictEqual( queryAll(".display-row.username .value").text().trim(), "eviltrout", "the name should be correct" @@ -185,7 +195,7 @@ acceptance("Admin - User Index", function (needs) { await visit("/admin/users/3/user1"); await click(".grant-admin"); assert.ok(exists(".bootbox")); - assert.equal( + assert.strictEqual( I18n.t("admin.user.grant_admin_confirm"), query(".modal-body").textContent.trim() ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js index 86d4bbee413..a15c4d69244 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-users-list-test.js @@ -48,7 +48,7 @@ acceptance("Admin - Users List", function (needs) { await click(".show-emails"); - assert.equal( + assert.strictEqual( queryAll(".users-list .user:nth-child(1) .email").text(), "eviltrout@example.com", "shows the emails" @@ -56,7 +56,7 @@ acceptance("Admin - Users List", function (needs) { await click(".hide-emails"); - assert.equal( + assert.strictEqual( queryAll(".users-list .user:nth-child(1) .email").text(), "", "hides the emails" @@ -71,7 +71,7 @@ acceptance("Admin - Users List", function (needs) { await visit("/admin/users/list/active"); - assert.equal(queryAll(".admin-title h2").text(), activeTitle); + assert.strictEqual(queryAll(".admin-title h2").text(), activeTitle); assert.ok( queryAll(".users-list .user:nth-child(1) .username") .text() @@ -80,7 +80,7 @@ acceptance("Admin - Users List", function (needs) { await click('a[href="/admin/users/list/new"]'); - assert.equal(queryAll(".admin-title h2").text(), suspectTitle); + assert.strictEqual(queryAll(".admin-title h2").text(), suspectTitle); assert.ok( queryAll(".users-list .user:nth-child(1) .username") .text() @@ -89,7 +89,7 @@ acceptance("Admin - Users List", function (needs) { await click(".users-list .sortable:nth-child(4)"); - assert.equal(queryAll(".admin-title h2").text(), suspectTitle); + assert.strictEqual(queryAll(".admin-title h2").text(), suspectTitle); assert.ok( queryAll(".users-list .user:nth-child(1) .username") .text() @@ -98,7 +98,7 @@ acceptance("Admin - Users List", function (needs) { await click('a[href="/admin/users/list/active"]'); - assert.equal(queryAll(".admin-title h2").text(), activeTitle); + assert.strictEqual(queryAll(".admin-title h2").text(), activeTitle); assert.ok( queryAll(".users-list .user:nth-child(1) .username") .text() diff --git a/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js b/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js index 5e40f78497f..31c994435dc 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/admin-watched-words-test.js @@ -27,7 +27,7 @@ acceptance("Admin - Watched Words", function (needs) { await fillIn(".admin-controls .controls input[type=text]", "li"); - assert.equal( + assert.strictEqual( count(".watched-words-list .watched-word"), 1, "When filtering, show words even if checkbox is unchecked." @@ -67,7 +67,7 @@ acceptance("Admin - Watched Words", function (needs) { found.push(true); } }); - assert.equal(found.length, 1); + assert.strictEqual(found.length, 1); }); test("remove words", async function (assert) { @@ -84,23 +84,23 @@ acceptance("Admin - Watched Words", function (needs) { await click(`#${$(word).attr("id")} .delete-word-record`); - assert.equal(count(".watched-words-list .watched-word"), 2); + assert.strictEqual(count(".watched-words-list .watched-word"), 2); }); test("test modal - replace", async function (assert) { await visit("/admin/customize/watched_words/action/replace"); await click(".watched-word-test"); await fillIn(".modal-body textarea", "Hi there!"); - assert.equal(find(".modal-body li .match").text(), "Hi"); - assert.equal(find(".modal-body li .replacement").text(), "hello"); + assert.strictEqual(find(".modal-body li .match").text(), "Hi"); + assert.strictEqual(find(".modal-body li .replacement").text(), "hello"); }); test("test modal - tag", async function (assert) { await visit("/admin/customize/watched_words/action/tag"); await click(".watched-word-test"); await fillIn(".modal-body textarea", "Hello world!"); - assert.equal(find(".modal-body li .match").text(), "Hello"); - assert.equal(find(".modal-body li .tag").text(), "greeting"); + assert.strictEqual(find(".modal-body li .match").text(), "Hello"); + assert.strictEqual(find(".modal-body li .tag").text(), "greeting"); }); }); @@ -131,6 +131,6 @@ acceptance("Admin - Watched Words - Bad regular expressions", function (needs) { test("shows an error message if regex is invalid", async function (assert) { await visit("/admin/customize/watched_words/action/block"); - assert.equal(count(".admin-watched-words .alert-error"), 1); + assert.strictEqual(count(".admin-watched-words .alert-error"), 1); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/auth-complete-test.js b/app/assets/javascripts/discourse/tests/acceptance/auth-complete-test.js index c2a71a4adf3..0545939c499 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/auth-complete-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/auth-complete-test.js @@ -22,7 +22,7 @@ acceptance("Auth Complete", function (needs) { test("when login not required", async function (assert) { await visit("/"); - assert.equal( + assert.strictEqual( currentRouteName(), "discovery.latest", "it stays on the homepage" @@ -38,7 +38,11 @@ acceptance("Auth Complete", function (needs) { this.siteSettings.login_required = true; await visit("/"); - assert.equal(currentRouteName(), "login", "it redirects to the login page"); + assert.strictEqual( + currentRouteName(), + "login", + "it redirects to the login page" + ); assert.ok( exists("#discourse-modal div.create-account-body"), diff --git a/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js b/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js index d5eadc0748a..cd0a9bf3182 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/bookmarks-test.js @@ -167,7 +167,10 @@ acceptance("Bookmarking", function (needs) { exists(".bookmark-options-panel"), "it should reopen the options panel" ); - assert.equal(selectKit(".bookmark-option-selector").header().value(), 1); + assert.strictEqual( + selectKit(".bookmark-option-selector").header().value(), + "1" + ); }); test("Saving a bookmark with no reminder or name", async function (assert) { @@ -236,17 +239,17 @@ acceptance("Bookmarking", function (needs) { await click("#tap_tile_tomorrow"); await openEditBookmarkModal(); - assert.equal( + assert.strictEqual( queryAll("#bookmark-name").val(), "Test name", "it should prefill the bookmark name" ); - assert.equal( + assert.strictEqual( queryAll("#custom-date > input").val(), tomorrow, "it should prefill the bookmark date" ); - assert.equal( + assert.strictEqual( queryAll("#custom-time").val(), "08:00", "it should prefill the bookmark time" @@ -265,17 +268,17 @@ acceptance("Bookmarking", function (needs) { await click("#tap_tile_post_local_date"); await openEditBookmarkModal(); - assert.equal( + assert.strictEqual( queryAll("#bookmark-name").val(), "Test name", "it should prefill the bookmark name" ); - assert.equal( + assert.strictEqual( queryAll("#custom-date > input").val(), postDateFormatted, "it should prefill the bookmark date" ); - assert.equal( + assert.strictEqual( queryAll("#custom-time").val(), "10:35", "it should prefill the bookmark time" @@ -342,7 +345,7 @@ acceptance("Bookmarking", function (needs) { await openBookmarkModal(1); await click("#save-bookmark"); - assert.equal( + assert.strictEqual( query("#topic-footer-button-bookmark").innerText, I18n.t("bookmarked.edit_bookmark"), "A topic level bookmark button has a label 'Edit Bookmark'" @@ -360,7 +363,7 @@ acceptance("Bookmarking", function (needs) { await visit("/t/internationalization-localization/280"); await click("#topic-footer-button-bookmark"); - assert.equal( + assert.strictEqual( query("#discourse-modal-title").innerText, I18n.t("post.bookmarks.create_for_topic"), "The create modal says creating a topic bookmark" @@ -373,7 +376,7 @@ acceptance("Bookmarking", function (needs) { "the first post is not marked as being bookmarked" ); - assert.equal( + assert.strictEqual( query("#topic-footer-button-bookmark").innerText, I18n.t("bookmarked.edit_bookmark"), "A topic level bookmark button has a label 'Edit Bookmark'" @@ -381,7 +384,7 @@ acceptance("Bookmarking", function (needs) { await click("#topic-footer-button-bookmark"); - assert.equal( + assert.strictEqual( query("#discourse-modal-title").innerText, I18n.t("post.bookmarks.edit_for_topic"), "The edit modal says editing a topic bookmark" @@ -392,7 +395,7 @@ acceptance("Bookmarking", function (needs) { await click("#topic-footer-button-bookmark"); - assert.equal( + assert.strictEqual( query("input#bookmark-name").value, "Test name", "The topic level bookmark editing preserves the values entered" @@ -409,7 +412,7 @@ acceptance("Bookmarking", function (needs) { ); // deleting all bookmarks in the topic - assert.equal( + assert.strictEqual( query("#topic-footer-button-bookmark").innerText, I18n.t("bookmarked.clear_bookmarks"), "the footer button says Clear Bookmarks because there is more than one" @@ -421,7 +424,7 @@ acceptance("Bookmarking", function (needs) { !exists(".topic-post:first-child button.bookmark.bookmarked"), "the first post bookmark is deleted" ); - assert.equal( + assert.strictEqual( query("#topic-footer-button-bookmark").innerText, I18n.t("bookmarked.title"), "the topic level bookmark is deleted" @@ -433,7 +436,7 @@ acceptance("Bookmarking", function (needs) { await click("#topic-footer-button-bookmark"); await click("#save-bookmark"); - assert.equal( + assert.strictEqual( query("#topic-footer-button-bookmark").innerText, I18n.t("bookmarked.edit_bookmark"), "A topic level bookmark button has a label 'Edit Bookmark'" @@ -456,7 +459,7 @@ acceptance("Bookmarking", function (needs) { await click(".bootbox.modal .btn-primary"); - assert.equal( + assert.strictEqual( query("#topic-footer-button-bookmark").innerText, I18n.t("bookmarked.title"), "A topic level bookmark button no longer says 'Edit Bookmark' after deletion" @@ -468,7 +471,7 @@ acceptance("Bookmarking", function (needs) { await openBookmarkModal(2); await click("#save-bookmark"); - assert.equal( + assert.strictEqual( query("#topic-footer-button-bookmark").innerText, I18n.t("bookmarked.edit_bookmark"), "A topic level bookmark button has a label 'Edit Bookmark'" diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-banner-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-banner-test.js index 28116183515..8e9f67798d7 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/category-banner-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/category-banner-test.js @@ -60,7 +60,7 @@ acceptance("Category Banners", function (needs) { await click(".modal-footer>.btn-primary"); assert.ok(!visible(".bootbox.modal"), "it closes the modal"); assert.ok(visible(".category-read-only-banner"), "it shows a banner"); - assert.equal( + assert.strictEqual( count(".category-read-only-banner .inner"), 1, "it allows staff to embed html in the message" diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-chooser-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-chooser-test.js index 81d2b9abdfe..7708c8b6a89 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/category-chooser-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/category-chooser-test.js @@ -22,6 +22,6 @@ acceptance("CategoryChooser", function (needs) { test("prefill category when category_id is set", async function (assert) { await visit("/new-topic?category_id=1"); - assert.equal(selectKit(".category-chooser").header().value(), 1); + assert.strictEqual(selectKit(".category-chooser").header().value(), "1"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js index 072fba5ae57..efdbf1ab7c3 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/category-edit-security-test.js @@ -17,10 +17,10 @@ acceptance("Category Edit - security", function (needs) { const firstRow = queryAll(".row-body").first(); const badgeName = firstRow.find(".group-name-label").text(); - assert.equal(badgeName, "everyone"); + assert.strictEqual(badgeName, "everyone"); const permission = firstRow.find(".d-icon-check-square"); - assert.equal(permission.length, 3); + assert.strictEqual(permission.length, 3); }); test("removing a permission", async function (assert) { @@ -58,8 +58,8 @@ acceptance("Category Edit - security", function (needs) { const addedRow = queryAll(".row-body").last(); - assert.equal(addedRow.find(".group-name-label").text(), "staff"); - assert.equal( + assert.strictEqual(addedRow.find(".group-name-label").text(), "staff"); + assert.strictEqual( addedRow.find(".d-icon-check-square").length, 3, "new row permissions match default 'everyone' permissions" @@ -78,12 +78,16 @@ acceptance("Category Edit - security", function (needs) { await availableGroups.expand(); await availableGroups.selectRowByValue("everyone"); - assert.equal(count(".row-body"), 1, "adds back the permission tp the list"); + assert.strictEqual( + count(".row-body"), + 1, + "adds back the permission tp the list" + ); const firstRow = queryAll(".row-body").first(); - assert.equal(firstRow.find(".group-name-label").text(), "everyone"); - assert.equal( + assert.strictEqual(firstRow.find(".group-name-label").text(), "everyone"); + assert.strictEqual( firstRow.find(".d-icon-check-square").length, 1, "adds only 'See' permission for a new row" @@ -97,7 +101,7 @@ acceptance("Category Edit - security", function (needs) { const everyoneRow = queryAll(".row-body").first(); - assert.equal( + assert.strictEqual( everyoneRow.find(".reply-granted, .create-granted").length, 2, "everyone has full permissions by default" @@ -108,7 +112,7 @@ acceptance("Category Edit - security", function (needs) { const staffRow = queryAll(".row-body").last(); - assert.equal( + assert.strictEqual( staffRow.find(".reply-granted, .create-granted").length, 2, "staff group also has full permissions" @@ -116,13 +120,13 @@ acceptance("Category Edit - security", function (needs) { await click(everyoneRow.find(".reply-toggle")[0]); - assert.equal( + assert.strictEqual( everyoneRow.find(".reply-granted, .create-granted").length, 0, "everyone does not have reply or create" ); - assert.equal( + assert.strictEqual( staffRow.find(".reply-granted, .create-granted").length, 2, "staff group still has full permissions" @@ -130,19 +134,19 @@ acceptance("Category Edit - security", function (needs) { await click(staffRow.find(".reply-toggle")[0]); - assert.equal( + assert.strictEqual( everyoneRow.find(".reply-granted, .create-granted").length, 0, "everyone permission unchanged" ); - assert.equal( + assert.strictEqual( staffRow.find(".reply-granted").length, 0, "staff does not have reply permission" ); - assert.equal( + assert.strictEqual( staffRow.find(".create-granted").length, 0, "staff does not have create permission" @@ -150,13 +154,13 @@ acceptance("Category Edit - security", function (needs) { await click(everyoneRow.find(".create-toggle")[0]); - assert.equal( + assert.strictEqual( everyoneRow.find(".reply-granted, .create-granted").length, 2, "everyone has full permissions" ); - assert.equal( + assert.strictEqual( staffRow.find(".reply-granted, .create-granted").length, 2, "staff group has full permissions (inherited from everyone)" diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js index 8ed7bcfa584..606daae3980 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/category-edit-test.js @@ -17,22 +17,22 @@ acceptance("Category Edit", function (needs) { await visit("/c/bug"); await click("button.edit-category"); - assert.equal( + assert.strictEqual( currentURL(), "/c/bug/edit/general", "it jumps to the correct screen" ); - assert.equal( + assert.strictEqual( queryAll(".category-breadcrumb .badge-category").text(), "bug" ); - assert.equal( + assert.strictEqual( queryAll(".category-color-editor .badge-category").text(), "bug" ); await fillIn("input.category-name", "testing"); - assert.equal( + assert.strictEqual( queryAll(".category-color-editor .badge-category").text(), "testing" ); @@ -43,7 +43,7 @@ acceptance("Category Edit", function (needs) { await fillIn(".d-editor-input", "this is the new topic template"); await click("#save-category"); - assert.equal( + assert.strictEqual( currentURL(), "/c/bug/edit/general", "it stays on the edit screen" @@ -55,7 +55,7 @@ acceptance("Category Edit", function (needs) { await searchPriorityChooser.selectRowByValue(1); await click("#save-category"); - assert.equal( + assert.strictEqual( currentURL(), "/c/bug/edit/settings", "it stays on the edit screen" @@ -72,7 +72,7 @@ acceptance("Category Edit", function (needs) { test("Index Route", async function (assert) { await visit("/c/bug/edit"); - assert.equal( + assert.strictEqual( currentURL(), "/c/bug/edit/general", "it redirects to the general tab" @@ -81,12 +81,12 @@ acceptance("Category Edit", function (needs) { test("Slugless Route", async function (assert) { await visit("/c/1-category/edit"); - assert.equal( + assert.strictEqual( currentURL(), "/c/1-category/edit/general", "it goes to the general tab" ); - assert.equal(queryAll("input.category-name").val(), "bug"); + assert.strictEqual(queryAll("input.category-name").val(), "bug"); }); test("Error Saving", async function (assert) { @@ -95,7 +95,10 @@ acceptance("Category Edit", function (needs) { await click("#save-category"); assert.ok(visible(".bootbox")); - assert.equal(queryAll(".bootbox .modal-body").html(), "duplicate email"); + assert.strictEqual( + queryAll(".bootbox .modal-body").html(), + "duplicate email" + ); await click(".bootbox .btn-primary"); assert.ok(!visible(".bootbox")); @@ -156,6 +159,6 @@ acceptance("Category Edit - no permission to edit", function (needs) { test("returns 404", async function (assert) { await visit("/c/bug/edit"); - assert.equal(currentURL(), "/404"); + assert.strictEqual(currentURL(), "/404"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js b/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js index 8d19fc5b2f8..adfd895391b 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/category-new-test.js @@ -19,17 +19,17 @@ acceptance("Category New", function (needs) { assert.notOk(exists(".category-breadcrumb")); await fillIn("input.category-name", "testing"); - assert.equal(queryAll(".badge-category").text(), "testing"); + assert.strictEqual(queryAll(".badge-category").text(), "testing"); await click("#save-category"); - assert.equal( + assert.strictEqual( currentURL(), "/c/testing/edit/general", "it transitions to the category edit route" ); - assert.equal( + assert.strictEqual( queryAll(".edit-category-title h2").text(), I18n.t("category.edit_dialog_title", { categoryName: "testing", diff --git a/app/assets/javascripts/discourse/tests/acceptance/click-track-test.js b/app/assets/javascripts/discourse/tests/acceptance/click-track-test.js index a8beee4272c..3fde9f90b2c 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/click-track-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/click-track-test.js @@ -20,8 +20,11 @@ acceptance("Click Track", function (needs) { assert.ok(!exists(".user-card.show"), "card should not appear"); await click('article[data-post-id="3651"] a.mention'); - assert.equal(count(".user-card.show"), 1, "card appear"); - assert.equal(currentURL(), "/t/internationalization-localization/280"); + assert.strictEqual(count(".user-card.show"), 1, "card appear"); + assert.strictEqual( + currentURL(), + "/t/internationalization-localization/280" + ); assert.ok(!tracked); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js index 1771a57f326..65b353ef8a0 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-actions-test.js @@ -41,15 +41,21 @@ acceptance("Composer Actions", function (needs) { await click("article#post_3 button.reply"); await composerActions.expand(); - assert.equal(composerActions.rowByIndex(0).value(), "reply_as_new_topic"); - assert.equal( + assert.strictEqual( + composerActions.rowByIndex(0).value(), + "reply_as_new_topic" + ); + assert.strictEqual( composerActions.rowByIndex(1).value(), "reply_as_private_message" ); - assert.equal(composerActions.rowByIndex(2).value(), "reply_to_topic"); - assert.equal(composerActions.rowByIndex(3).value(), "toggle_whisper"); - assert.equal(composerActions.rowByIndex(4).value(), "toggle_topic_bump"); - assert.equal(composerActions.rowByIndex(5).value(), undefined); + assert.strictEqual(composerActions.rowByIndex(2).value(), "reply_to_topic"); + assert.strictEqual(composerActions.rowByIndex(3).value(), "toggle_whisper"); + assert.strictEqual( + composerActions.rowByIndex(4).value(), + "toggle_topic_bump" + ); + assert.strictEqual(composerActions.rowByIndex(5).value(), null); }); test("replying to post - reply_as_private_message", async function (assert) { @@ -62,7 +68,7 @@ acceptance("Composer Actions", function (needs) { await composerActions.selectRowByValue("reply_as_private_message"); const privateMessageUsers = selectKit("#private-message-users"); - assert.equal(privateMessageUsers.header().value(), "codinghorror"); + assert.strictEqual(privateMessageUsers.header().value(), "codinghorror"); assert.ok( queryAll(".d-editor-input").val().indexOf("Continuing the discussion") >= 0 @@ -82,15 +88,15 @@ acceptance("Composer Actions", function (needs) { await composerActions.expand(); await composerActions.selectRowByValue("reply_to_topic"); - assert.equal( + assert.strictEqual( queryAll(".action-title .topic-link").text().trim(), "Internationalization / localization" ); - assert.equal( + assert.strictEqual( queryAll(".action-title .topic-link").attr("href"), "/t/internationalization-localization/280" ); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "test replying to topic when initially replied to post" ); @@ -110,7 +116,7 @@ acceptance("Composer Actions", function (needs) { !exists(".composer-actions svg.d-icon-far-eye-slash"), "whisper icon is not visible" ); - assert.equal( + assert.strictEqual( count(".composer-actions svg.d-icon-share"), 1, "reply icon is visible" @@ -119,7 +125,7 @@ acceptance("Composer Actions", function (needs) { await composerActions.expand(); await composerActions.selectRowByValue("toggle_whisper"); - assert.equal( + assert.strictEqual( count(".composer-actions svg.d-icon-far-eye-slash"), 1, "whisper icon is visible" @@ -152,8 +158,8 @@ acceptance("Composer Actions", function (needs) { await composerActions.expand(); await composerActions.selectRowByValue("reply_as_new_topic"); - assert.equal(categoryChooserReplyArea.header().name(), "faq"); - assert.equal( + assert.strictEqual(categoryChooserReplyArea.header().name(), "faq"); + assert.strictEqual( queryAll(".action-title").text().trim(), I18n.t("topic.create_long") ); @@ -190,11 +196,11 @@ acceptance("Composer Actions", function (needs) { await composerActions.selectRowByValue("reply_as_private_message"); assert.ok(composerActions.el().hasClass("is-hidden")); - assert.equal(composerActions.el().children().length, 0); + assert.strictEqual(composerActions.el().children().length, 0); await click("button#create-topic"); await composerActions.expand(); - assert.equal(composerActions.rows().length, 2); + assert.strictEqual(composerActions.rows().length, 2); }); test("interactions", async function (assert) { @@ -207,64 +213,76 @@ acceptance("Composer Actions", function (needs) { await composerActions.expand(); await composerActions.selectRowByValue("reply_to_topic"); - assert.equal( + assert.strictEqual( queryAll(".action-title").text().trim(), "Internationalization / localization" ); - assert.equal(queryAll(".d-editor-input").val(), quote); + assert.strictEqual(queryAll(".d-editor-input").val(), quote); await composerActions.expand(); - assert.equal(composerActions.rowByIndex(0).value(), "reply_as_new_topic"); - assert.equal(composerActions.rowByIndex(1).value(), "reply_to_post"); - assert.equal( + assert.strictEqual( + composerActions.rowByIndex(0).value(), + "reply_as_new_topic" + ); + assert.strictEqual(composerActions.rowByIndex(1).value(), "reply_to_post"); + assert.strictEqual( composerActions.rowByIndex(2).value(), "reply_as_private_message" ); - assert.equal(composerActions.rowByIndex(3).value(), "toggle_whisper"); - assert.equal(composerActions.rowByIndex(4).value(), "toggle_topic_bump"); - assert.equal(composerActions.rows().length, 5); + assert.strictEqual(composerActions.rowByIndex(3).value(), "toggle_whisper"); + assert.strictEqual( + composerActions.rowByIndex(4).value(), + "toggle_topic_bump" + ); + assert.strictEqual(composerActions.rows().length, 5); await composerActions.selectRowByValue("reply_to_post"); await composerActions.expand(); assert.ok(exists(".action-title img.avatar")); - assert.equal( + assert.strictEqual( queryAll(".action-title .user-link").text().trim(), "codinghorror" ); - assert.equal(queryAll(".d-editor-input").val(), quote); - assert.equal(composerActions.rowByIndex(0).value(), "reply_as_new_topic"); - assert.equal( + assert.strictEqual(queryAll(".d-editor-input").val(), quote); + assert.strictEqual( + composerActions.rowByIndex(0).value(), + "reply_as_new_topic" + ); + assert.strictEqual( composerActions.rowByIndex(1).value(), "reply_as_private_message" ); - assert.equal(composerActions.rowByIndex(2).value(), "reply_to_topic"); - assert.equal(composerActions.rowByIndex(3).value(), "toggle_whisper"); - assert.equal(composerActions.rowByIndex(4).value(), "toggle_topic_bump"); - assert.equal(composerActions.rows().length, 5); + assert.strictEqual(composerActions.rowByIndex(2).value(), "reply_to_topic"); + assert.strictEqual(composerActions.rowByIndex(3).value(), "toggle_whisper"); + assert.strictEqual( + composerActions.rowByIndex(4).value(), + "toggle_topic_bump" + ); + assert.strictEqual(composerActions.rows().length, 5); await composerActions.selectRowByValue("reply_as_new_topic"); await composerActions.expand(); - assert.equal( + assert.strictEqual( queryAll(".action-title").text().trim(), I18n.t("topic.create_long") ); assert.ok(queryAll(".d-editor-input").val().includes(quote)); - assert.equal(composerActions.rowByIndex(0).value(), "reply_to_post"); - assert.equal( + assert.strictEqual(composerActions.rowByIndex(0).value(), "reply_to_post"); + assert.strictEqual( composerActions.rowByIndex(1).value(), "reply_as_private_message" ); - assert.equal(composerActions.rowByIndex(2).value(), "reply_to_topic"); - assert.equal(composerActions.rowByIndex(3).value(), "shared_draft"); - assert.equal(composerActions.rows().length, 4); + assert.strictEqual(composerActions.rowByIndex(2).value(), "reply_to_topic"); + assert.strictEqual(composerActions.rowByIndex(3).value(), "shared_draft"); + assert.strictEqual(composerActions.rows().length, 4); await composerActions.selectRowByValue("reply_as_private_message"); await composerActions.expand(); - assert.equal( + assert.strictEqual( queryAll(".action-title").text().trim(), I18n.t("topic.private_message") ); @@ -272,10 +290,13 @@ acceptance("Composer Actions", function (needs) { queryAll(".d-editor-input").val().indexOf("Continuing the discussion") === 0 ); - assert.equal(composerActions.rowByIndex(0).value(), "reply_as_new_topic"); - assert.equal(composerActions.rowByIndex(1).value(), "reply_to_post"); - assert.equal(composerActions.rowByIndex(2).value(), "reply_to_topic"); - assert.equal(composerActions.rows().length, 3); + assert.strictEqual( + composerActions.rowByIndex(0).value(), + "reply_as_new_topic" + ); + assert.strictEqual(composerActions.rowByIndex(1).value(), "reply_to_post"); + assert.strictEqual(composerActions.rowByIndex(2).value(), "reply_to_topic"); + assert.strictEqual(composerActions.rows().length, 3); }); test("replying to post - toggle_topic_bump", async function (assert) { @@ -288,7 +309,7 @@ acceptance("Composer Actions", function (needs) { !exists(".composer-actions svg.d-icon-anchor"), "no-bump icon is not visible" ); - assert.equal( + assert.strictEqual( count(".composer-actions svg.d-icon-share"), 1, "reply icon is visible" @@ -297,7 +318,7 @@ acceptance("Composer Actions", function (needs) { await composerActions.expand(); await composerActions.selectRowByValue("toggle_topic_bump"); - assert.equal( + assert.strictEqual( count(".composer-actions svg.d-icon-anchor"), 1, "no-bump icon is visible" @@ -314,7 +335,7 @@ acceptance("Composer Actions", function (needs) { !exists(".composer-actions svg.d-icon-anchor"), "no-bump icon is not visible" ); - assert.equal( + assert.strictEqual( count(".composer-actions svg.d-icon-share"), 1, "reply icon is visible" @@ -335,7 +356,7 @@ acceptance("Composer Actions", function (needs) { !exists(".composer-fields .whisper .d-icon-anchor"), "no-bump icon is not visible" ); - assert.equal( + assert.strictEqual( count(".composer-actions svg.d-icon-share"), 1, "reply icon is visible" @@ -346,12 +367,12 @@ acceptance("Composer Actions", function (needs) { await composerActions.expand(); await composerActions.selectRowByValue("toggle_whisper"); - assert.equal( + assert.strictEqual( count(".composer-actions svg.d-icon-far-eye-slash"), 1, "whisper icon is visible" ); - assert.equal( + assert.strictEqual( count(".composer-fields .no-bump .d-icon-anchor"), 1, "no-bump icon is visible" @@ -370,8 +391,11 @@ acceptance("Composer Actions", function (needs) { await click("article#post_3 button.reply"); await composerActions.expand(); - assert.equal(composerActions.rows().length, 5); - assert.equal(composerActions.rowByIndex(4).value(), "toggle_topic_bump"); + assert.strictEqual(composerActions.rows().length, 5); + assert.strictEqual( + composerActions.rowByIndex(4).value(), + "toggle_topic_bump" + ); }); test("replying to post as TL3 user", async function (assert) { @@ -382,9 +406,9 @@ acceptance("Composer Actions", function (needs) { await click("article#post_3 button.reply"); await composerActions.expand(); - assert.equal(composerActions.rows().length, 3); + assert.strictEqual(composerActions.rows().length, 3); Array.from(composerActions.rows()).forEach((row) => { - assert.notEqual( + assert.notStrictEqual( row.value, "toggle_topic_bump", "toggle button is not visible" @@ -400,8 +424,11 @@ acceptance("Composer Actions", function (needs) { await click("article#post_3 button.reply"); await composerActions.expand(); - assert.equal(composerActions.rows().length, 4); - assert.equal(composerActions.rowByIndex(3).value(), "toggle_topic_bump"); + assert.strictEqual(composerActions.rows().length, 4); + assert.strictEqual( + composerActions.rowByIndex(3).value(), + "toggle_topic_bump" + ); }); test("replying to first post - reply_as_private_message", async function (assert) { @@ -414,7 +441,7 @@ acceptance("Composer Actions", function (needs) { await composerActions.selectRowByValue("reply_as_private_message"); const privateMessageUsers = selectKit("#private-message-users"); - assert.equal(privateMessageUsers.header().value(), "uwe_keim"); + assert.strictEqual(privateMessageUsers.header().value(), "uwe_keim"); assert.ok( queryAll(".d-editor-input").val().indexOf("Continuing the discussion") >= 0 @@ -429,8 +456,8 @@ acceptance("Composer Actions", function (needs) { await click("article#post_1 button.edit"); await composerActions.expand(); - assert.equal(composerActions.rows().length, 1); - assert.equal(composerActions.rowByIndex(0).value(), "reply_to_post"); + assert.strictEqual(composerActions.rows().length, 1); + assert.strictEqual(composerActions.rowByIndex(0).value(), "reply_to_post"); }); }); @@ -477,24 +504,24 @@ acceptance("Composer Actions With New Topic Draft", function (needs) { await composerActions.expand(); await composerActions.selectRowByValue("shared_draft"); - assert.equal(tags.header().value(), "monkey", "tags are not reset"); + assert.strictEqual(tags.header().value(), "monkey", "tags are not reset"); - assert.equal( + assert.strictEqual( queryAll("#reply-title").val(), "This is the new text for the title using 'quotes'" ); - assert.equal( + assert.strictEqual( queryAll("#reply-control .btn-primary.create .d-button-label").text(), I18n.t("composer.create_shared_draft") ); - assert.equal( + assert.strictEqual( count(".composer-actions svg.d-icon-far-clipboard"), 1, "shared draft icon is visible" ); - assert.equal(count("#reply-control.composing-shared-draft"), 1); + assert.strictEqual(count("#reply-control.composing-shared-draft"), 1); await click(".modal-footer .btn.btn-default"); } finally { toggleCheckDraftPopup(false); @@ -509,7 +536,7 @@ acceptance("Composer Actions With New Topic Draft", function (needs) { await composerActions.expand(); stubDraftResponse(); await composerActions.selectRowByValue("reply_as_new_topic"); - assert.equal( + assert.strictEqual( queryAll(".bootbox .modal-body").text(), I18n.t("composer.composer_actions.reply_as_new_topic.confirm") ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-attachment-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-attachment-test.js index 1fe8845f4e0..37ed65aca3e 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-attachment-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-attachment-test.js @@ -27,7 +27,7 @@ async function writeInComposer(assert) { await fillIn(".d-editor-input", "[test](upload://abcdefg.png)"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview:visible").html().trim(), '

test

' ); @@ -41,7 +41,7 @@ acceptance("Composer Attachment - Cooking", function (needs) { test("attachments are cooked properly", async function (assert) { await writeInComposer(assert); - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview:visible").html().trim(), '

test

' ); @@ -55,7 +55,7 @@ acceptance("Composer Attachment - Secure Media Enabled", function (needs) { test("attachments are cooked properly when secure media is enabled", async function (assert) { await writeInComposer(assert); - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview:visible").html().trim(), '

test

' ); @@ -71,13 +71,13 @@ acceptance("Composer Attachment - Upload Placeholder", function (needs) { const image = createImage("avatar.png", "/images/avatar.png?1", 200, 300); await queryAll(".wmd-controls").trigger("fileuploadsend", image); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "[Uploading: avatar.png...]()\n" ); await queryAll(".wmd-controls").trigger("fileuploaddone", image); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "![avatar|200x300](/images/avatar.png?1)\n" ); @@ -91,13 +91,13 @@ acceptance("Composer Attachment - Upload Placeholder", function (needs) { const image = createImage("avatar.png", "/images/avatar.png?1", 200, 300); await queryAll(".wmd-controls").trigger("fileuploadsend", image); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "The image:\n[Uploading: avatar.png...]()\n" ); await queryAll(".wmd-controls").trigger("fileuploaddone", image); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "The image:\n![avatar|200x300](/images/avatar.png?1)\n" ); @@ -111,13 +111,13 @@ acceptance("Composer Attachment - Upload Placeholder", function (needs) { const image = createImage("avatar.png", "/images/avatar.png?1", 200, 300); await queryAll(".wmd-controls").trigger("fileuploadsend", image); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "The image:\n[Uploading: avatar.png...]()\n" ); await queryAll(".wmd-controls").trigger("fileuploaddone", image); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "The image:\n![avatar|200x300](/images/avatar.png?1)\n" ); @@ -134,13 +134,13 @@ acceptance("Composer Attachment - Upload Placeholder", function (needs) { const image = createImage("avatar.png", "/images/avatar.png?1", 200, 300); await queryAll(".wmd-controls").trigger("fileuploadsend", image); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "The image \n[Uploading: avatar.png...]()\nText after the image." ); await queryAll(".wmd-controls").trigger("fileuploaddone", image); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "The image \n![avatar|200x300](/images/avatar.png?1)\nText after the image." ); @@ -159,13 +159,13 @@ acceptance("Composer Attachment - Upload Placeholder", function (needs) { textArea.selectionEnd = 23; await queryAll(".wmd-controls").trigger("fileuploadsend", image); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "The image \n[Uploading: avatar.png...]()\n Text after the image." ); await queryAll(".wmd-controls").trigger("fileuploaddone", image); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "The image \n![avatar|200x300](/images/avatar.png?1)\n Text after the image." ); @@ -181,43 +181,43 @@ acceptance("Composer Attachment - Upload Placeholder", function (needs) { const image4 = createImage("image.png", "/images/avatar.png?4", 300, 400); await queryAll(".wmd-controls").trigger("fileuploadsend", image1); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "[Uploading: test.png...]()\n" ); await queryAll(".wmd-controls").trigger("fileuploadsend", image2); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "[Uploading: test.png...]()\n[Uploading: test.png(1)...]()\n" ); await queryAll(".wmd-controls").trigger("fileuploadsend", image4); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "[Uploading: test.png...]()\n[Uploading: test.png(1)...]()\n[Uploading: image.png...]()\n" ); await queryAll(".wmd-controls").trigger("fileuploadsend", image3); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "[Uploading: test.png...]()\n[Uploading: test.png(1)...]()\n[Uploading: image.png...]()\n[Uploading: image.png(1)...]()\n" ); await queryAll(".wmd-controls").trigger("fileuploaddone", image2); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "[Uploading: test.png...]()\n![test|100x200](/images/avatar.png?2)\n[Uploading: image.png...]()\n[Uploading: image.png(1)...]()\n" ); await queryAll(".wmd-controls").trigger("fileuploaddone", image3); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "[Uploading: test.png...]()\n![test|100x200](/images/avatar.png?2)\n[Uploading: image.png...]()\n![image|300x400](/images/avatar.png?3)\n" ); await queryAll(".wmd-controls").trigger("fileuploaddone", image1); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "![test|200x300](/images/avatar.png?1)\n![test|100x200](/images/avatar.png?2)\n[Uploading: image.png...]()\n![image|300x400](/images/avatar.png?3)\n" ); @@ -230,13 +230,13 @@ acceptance("Composer Attachment - Upload Placeholder", function (needs) { const image = createImage("ima++ge.png", "/images/avatar.png?4", 300, 400); await queryAll(".wmd-controls").trigger("fileuploadsend", image); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "[Uploading: ima++ge.png...]()\n" ); await queryAll(".wmd-controls").trigger("fileuploaddone", image); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "![ima++ge|300x400](/images/avatar.png?4)\n" ); @@ -279,7 +279,7 @@ acceptance("Composer Attachment - Upload Handler", function (needs) { await fillIn(".d-editor-input", "This is a handler test."); await queryAll(".wmd-controls").trigger("fileuploadsubmit", image); - assert.equal( + assert.strictEqual( queryAll(".bootbox .modal-body").html(), "This is an upload handler test for handlertest.png", "it should show the bootbox triggered by the upload handler" @@ -305,7 +305,7 @@ acceptance("Composer Attachment - File input", function (needs) { await click("#create-topic"); assert.ok(exists("input#file-uploader"), "An input is rendered"); - assert.equal( + assert.strictEqual( query("input#file-uploader").accept, ".jpg,.jpeg,.png", "Accepted values are correct" diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-draft-saving-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-draft-saving-test.js index 22676e94145..d6944293fd8 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-draft-saving-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-draft-saving-test.js @@ -34,7 +34,7 @@ acceptance("Composer - Draft saving", function (needs) { ); await fillIn(".d-editor-input", "This won't be saved because of error"); - assert.equal( + assert.strictEqual( query("div#draft-status span").innerText.trim(), I18n.t("composer.drafts_offline"), "the draft wasn't saved, a warning is rendered" diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js index 841545e9e4e..7bb48699321 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-edit-conflict-test.js @@ -22,7 +22,7 @@ acceptance("Composer - Edit conflict", function (needs) { await click(".topic-post:nth-of-type(1) button.edit"); await fillIn(".d-editor-input", "this will 409"); await click("#reply-control button.create"); - assert.equal( + assert.strictEqual( queryAll("#reply-control button.create").text().trim(), I18n.t("composer.overwrite_edit"), "it shows the overwrite button" diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-hyperlink-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-hyperlink-test.js index a780a6a27b6..507641d7228 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-hyperlink-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-hyperlink-test.js @@ -27,7 +27,7 @@ acceptance("Composer - Hyperlink", function (needs) { await fillIn(".modal-body .link-text", "Google"); await click(".modal-footer button.btn-primary"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "This is a link to [Google](https://google.com)", "adds link with url and text, prepends 'https://'" @@ -45,7 +45,7 @@ acceptance("Composer - Hyperlink", function (needs) { await fillIn(".modal-body .link-text", "Google"); await click(".modal-footer button.btn-danger"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "Reset textarea contents.", "doesn’t insert anything after cancelling" @@ -64,7 +64,7 @@ acceptance("Composer - Hyperlink", function (needs) { await fillIn(".modal-body .link-url", "somelink.com"); await click(".modal-footer button.btn-primary"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "[Reset](https://somelink.com) textarea contents.", "adds link to a selected text" diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-onebox-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-onebox-test.js index fd5f09d1d43..7a875def554 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-onebox-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-onebox-test.js @@ -28,7 +28,7 @@ http://www.example.com/has-title.html ` ); - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview:visible").html().trim(), `


@@ -66,15 +66,15 @@ acceptance("Composer - Inline Onebox", function (needs) { await click("#topic-footer-buttons .btn.create"); await fillIn(".d-editor-input", `Test www.example.com/page`); - assert.equal(requestsCount, 1); - assert.equal( + assert.strictEqual(requestsCount, 1); + assert.strictEqual( queryAll(".d-editor-preview").html().trim(), '

Test www.example.com/page

' ); await fillIn(".d-editor-input", `Test www.example.com/page Test`); - assert.equal(requestsCount, 1); - assert.equal( + assert.strictEqual(requestsCount, 1); + assert.strictEqual( queryAll(".d-editor-preview").html().trim(), '

Test www.example.com/page Test

' ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-tags-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-tags-test.js index 5363c3edd34..eeb74e7dace 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-tags-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-tags-test.js @@ -32,7 +32,7 @@ acceptance("Composer - Tags", function (needs) { await categoryChooser.selectRowByValue(2); await click("#reply-control button.create"); - assert.notEqual(currentURL(), "/"); + assert.notStrictEqual(currentURL(), "/"); }); test("users do not bypass tag validation rule", async function (assert) { @@ -51,8 +51,8 @@ acceptance("Composer - Tags", function (needs) { updateCurrentUser({ moderator: false, admin: false, trust_level: 1 }); await click("#reply-control button.create"); - assert.equal(currentURL(), "/"); - assert.equal( + assert.strictEqual(currentURL(), "/"); + assert.strictEqual( queryAll(".popup-tip.bad").text().trim(), I18n.t("composer.error.tags_missing", { count: 1 }), "it should display the right alert" @@ -63,7 +63,7 @@ acceptance("Composer - Tags", function (needs) { await tags.selectRowByValue("monkey"); await click("#reply-control button.create"); - assert.notEqual(currentURL(), "/"); + assert.notStrictEqual(currentURL(), "/"); }); test("users do not bypass min required tags in tag group validation rule", async function (assert) { @@ -85,8 +85,8 @@ acceptance("Composer - Tags", function (needs) { updateCurrentUser({ moderator: false, admin: false, trust_level: 1 }); await click("#reply-control button.create"); - assert.equal(currentURL(), "/"); - assert.equal( + assert.strictEqual(currentURL(), "/"); + assert.strictEqual( queryAll(".popup-tip.bad").text().trim(), I18n.t("composer.error.tags_missing", { count: 1 }), "it should display the right alert" @@ -97,6 +97,6 @@ acceptance("Composer - Tags", function (needs) { await tags.selectRowByValue("monkey"); await click("#reply-control button.create"); - assert.notEqual(currentURL(), "/"); + assert.notStrictEqual(currentURL(), "/"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-test.js index e7d3ec797ba..28831241ff9 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-test.js @@ -84,7 +84,7 @@ acceptance("Composer", function (needs) { assert.ok(exists(".title-input .popup-tip.good"), "the title is now good"); await fillIn(".d-editor-input", "this is the *content* of a post"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview").html().trim(), "

this is the content of a post

", "it previews content" @@ -109,7 +109,7 @@ acceptance("Composer", function (needs) { run(() => textarea.dispatchEvent(event)); const example = I18n.t(`composer.bold_text`); - assert.equal( + assert.strictEqual( queryAll("#reply-control .d-editor-input").val().trim(), `this is the *content* of a post**${example}**`, "it supports keyboard shortcuts" @@ -143,7 +143,7 @@ acceptance("Composer", function (needs) { "this is the *content* of a new topic post" ); await click("#reply-control button.create"); - assert.equal( + assert.strictEqual( currentURL(), "/t/internationalization-localization/280", "it transitions to the newly created topic URL" @@ -157,7 +157,7 @@ acceptance("Composer", function (needs) { await fillIn(".d-editor-input", "enqueue this content please"); await click("#reply-control button.create"); assert.ok(visible(".d-modal"), "it pops up a modal"); - assert.equal(currentURL(), "/", "it doesn't change routes"); + assert.strictEqual(currentURL(), "/", "it doesn't change routes"); await click(".modal-footer button"); assert.ok(invisible(".d-modal"), "the modal can be dismissed"); @@ -169,14 +169,14 @@ acceptance("Composer", function (needs) { await fillIn("#reply-title", "This title doesn't matter"); await fillIn(".d-editor-input", "custom message"); await click("#reply-control button.create"); - assert.equal( + assert.strictEqual( queryAll(".bootbox .modal-body").text(), "This is a custom response" ); - assert.equal(currentURL(), "/", "it doesn't change routes"); + assert.strictEqual(currentURL(), "/", "it doesn't change routes"); await click(".bootbox .btn-primary"); - assert.equal( + assert.strictEqual( currentURL(), "/faq", "can navigate to a `route_to` destination" @@ -200,7 +200,7 @@ acceptance("Composer", function (needs) { await fillIn(".d-editor-input", "this is the content of my reply"); await click("#reply-control button.create"); - assert.equal( + assert.strictEqual( queryAll(".cooked:last p").text(), "If you use gettext format you could leverage Launchpad 13 translations and the community behind it." ); @@ -217,7 +217,7 @@ acceptance("Composer", function (needs) { await click(".modal-footer button.keep-editing"); assert.ok(invisible(".discard-draft-modal.modal")); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "this is the content of my reply", "composer does not switch when using Keep Editing button" @@ -227,7 +227,7 @@ acceptance("Composer", function (needs) { await click(".modal-footer button.save-draft"); assert.ok(invisible(".discard-draft-modal.modal")); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), queryAll(".topic-post:nth-of-type(1) .cooked > p").text(), "composer has contents of post to be edited" @@ -243,12 +243,15 @@ acceptance("Composer", function (needs) { ); await visit("/t/1-3-0beta9-no-rate-limit-popups/28830"); - assert.equal(currentURL(), "/t/1-3-0beta9-no-rate-limit-popups/28830"); + assert.strictEqual( + currentURL(), + "/t/1-3-0beta9-no-rate-limit-popups/28830" + ); await click("#reply-control button.create"); assert.ok(visible(".reply-where-modal"), "it pops up a modal"); await click(".btn-reply-here"); - assert.equal( + assert.strictEqual( queryAll(".cooked:last p").text(), "If you use gettext format you could leverage Launchpad 13 translations and the community behind it." ); @@ -260,7 +263,7 @@ acceptance("Composer", function (needs) { await fillIn(".d-editor-input", "this is the content of the first reply"); await visit("/t/this-is-a-test-topic/9"); - assert.equal(currentURL(), "/t/this-is-a-test-topic/9"); + assert.strictEqual(currentURL(), "/t/this-is-a-test-topic/9"); await click("#topic-footer-buttons .btn.create"); assert.ok( exists(".discard-draft-modal.modal"), @@ -278,7 +281,7 @@ acceptance("Composer", function (needs) { await click(".modal-footer button.discard-draft"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "", "discards draft and reset composer textarea" @@ -322,7 +325,7 @@ acceptance("Composer", function (needs) { await click(".topic-post:nth-of-type(1) button.show-more-actions"); await click(".topic-post:nth-of-type(1) button.edit"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().indexOf("Any plans to support"), 0, "it populates the input with the post text" @@ -369,11 +372,11 @@ acceptance("Composer", function (needs) { await promise; // at this point, request is in flight, so post is staged - assert.equal(count(".topic-post.staged"), 1); + assert.strictEqual(count(".topic-post.staged"), 1); assert.ok( find(".topic-post:nth-of-type(1)")[0].className.includes("staged") ); - assert.equal( + assert.strictEqual( find(".topic-post.staged .cooked").text().trim(), "will return empty json" ); @@ -382,7 +385,7 @@ acceptance("Composer", function (needs) { window.resolveLastPromise(); await visit("/t/internationalization-localization/280"); - assert.equal(count(".topic-post.staged"), 0); + assert.strictEqual(count(".topic-post.staged"), 0); }); QUnit.skip( @@ -397,7 +400,7 @@ acceptance("Composer", function (needs) { await click("#reply-control button.create"); assert.ok(!exists(".topic-post.staged")); - assert.equal( + assert.strictEqual( find(".topic-post .cooked")[0].innerText, "Any plans to support localization of UI elements, so that I (for example) could set up a completely German speaking forum?" ); @@ -410,13 +413,13 @@ acceptance("Composer", function (needs) { await visit("/t/this-is-a-test-topic/9"); await click(".topic-post:nth-of-type(1) button.edit"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().indexOf("This is the first post."), 0, "it populates the input with the post text" ); await click(".topic-post:nth-of-type(2) button.edit"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().indexOf("This is the second post."), 0, "it populates the input with the post text" @@ -435,7 +438,7 @@ acceptance("Composer", function (needs) { ); await click(".modal-footer button.discard-draft"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().indexOf("This is the second post."), 0, "it populates the input with the post text" @@ -446,15 +449,19 @@ acceptance("Composer", function (needs) { await visit("/t/this-is-a-test-topic/9"); await click(".topic-post:nth-of-type(1) button.edit"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().indexOf("This is the first post."), 0, "it populates the input with the post text" ); await click(".topic-post:nth-of-type(1) button.reply"); - assert.equal(queryAll(".d-editor-input").val(), "", "it clears the input"); + assert.strictEqual( + queryAll(".d-editor-input").val(), + "", + "it clears the input" + ); await click(".topic-post:nth-of-type(1) button.edit"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().indexOf("This is the first post."), 0, "it populates the input with the post text" @@ -470,7 +477,7 @@ acceptance("Composer", function (needs) { await menu.expand(); await menu.selectRowByValue("toggleWhisper"); - assert.equal( + assert.strictEqual( count(".composer-actions svg.d-icon-far-eye-slash"), 1, "it sets the post type to whisper" @@ -501,7 +508,7 @@ acceptance("Composer", function (needs) { await visit("/t/this-is-a-test-topic/9"); await click(".topic-post:nth-of-type(1) button.reply"); - assert.equal( + assert.strictEqual( count("#reply-control.open"), 1, "it starts in open state by default" @@ -509,7 +516,7 @@ acceptance("Composer", function (needs) { await click(".toggle-fullscreen"); - assert.equal( + assert.strictEqual( count("#reply-control.fullscreen"), 1, "it expands composer to full screen" @@ -517,7 +524,7 @@ acceptance("Composer", function (needs) { await click(".toggle-fullscreen"); - assert.equal( + assert.strictEqual( count("#reply-control.open"), 1, "it collapses composer to regular size" @@ -526,7 +533,7 @@ acceptance("Composer", function (needs) { await fillIn(".d-editor-input", "This is a dirty reply"); await click(".toggler"); - assert.equal( + assert.strictEqual( count("#reply-control.draft"), 1, "it collapses composer to draft bar" @@ -534,7 +541,7 @@ acceptance("Composer", function (needs) { await click(".toggle-fullscreen"); - assert.equal( + assert.strictEqual( count("#reply-control.open"), 1, "from draft, it expands composer back to open state" @@ -550,7 +557,7 @@ acceptance("Composer", function (needs) { "toggleWhisper" ); - assert.equal( + assert.strictEqual( count(".composer-actions svg.d-icon-far-eye-slash"), 1, "it sets the post type to whisper" @@ -597,7 +604,7 @@ acceptance("Composer", function (needs) { "it pops up a confirmation dialog" ); await click(".modal-footer button.discard-draft"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().indexOf("This is the first post."), 0, "it populates the input with the post text" @@ -615,18 +622,18 @@ acceptance("Composer", function (needs) { exists(".discard-draft-modal.modal"), "it pops up a confirmation dialog" ); - assert.equal( + assert.strictEqual( queryAll(".modal-footer button.save-draft").text().trim(), I18n.t("post.cancel_composer.save_draft"), "has save draft button" ); - assert.equal( + assert.strictEqual( queryAll(".modal-footer button.keep-editing").text().trim(), I18n.t("post.cancel_composer.keep_editing"), "has keep editing button" ); await click(".modal-footer button.save-draft"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().indexOf("This is the second post."), 0, "it populates the input with the post text" @@ -646,18 +653,18 @@ acceptance("Composer", function (needs) { exists(".discard-draft-modal.modal"), "it pops up a confirmation dialog" ); - assert.equal( + assert.strictEqual( queryAll(".modal-footer button.save-draft").text().trim(), I18n.t("post.cancel_composer.save_draft"), "has save draft button" ); - assert.equal( + assert.strictEqual( queryAll(".modal-footer button.keep-editing").text().trim(), I18n.t("post.cancel_composer.keep_editing"), "has keep editing button" ); await click(".modal-footer button.save-draft"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "", "it clears the composer input" @@ -673,7 +680,7 @@ acceptance("Composer", function (needs) { await click(".topic-post:nth-of-type(1) button.show-more-actions"); await click(".topic-post:nth-of-type(1) button.edit"); - assert.equal( + assert.strictEqual( queryAll(".modal-body").text(), I18n.t("drafts.abandon.confirm") ); @@ -752,7 +759,7 @@ acceptance("Composer", function (needs) { await click(".modal .btn-default"); const privateMessageUsers = selectKit("#private-message-users"); - assert.equal(privateMessageUsers.header().value(), "codinghorror"); + assert.strictEqual(privateMessageUsers.header().value(), "codinghorror"); } finally { toggleCheckDraftPopup(false); } @@ -771,14 +778,17 @@ acceptance("Composer", function (needs) { ); await visit("/latest"); - assert.equal( + assert.strictEqual( queryAll("#create-topic").text().trim(), I18n.t("topic.open_draft") ); await click("#create-topic"); - assert.equal(selectKit(".category-chooser").header().value(), "2"); - assert.equal(selectKit(".mini-tag-chooser").header().value(), "fun,times"); + assert.strictEqual(selectKit(".category-chooser").header().value(), "2"); + assert.strictEqual( + selectKit(".mini-tag-chooser").header().value(), + "fun,times" + ); }); test("Deleting the text content of the first post in a private message", async function (assert) { @@ -790,7 +800,7 @@ acceptance("Composer", function (needs) { await fillIn(".d-editor-input", ""); - assert.equal( + assert.strictEqual( queryAll(".d-editor-container textarea").attr("placeholder"), I18n.t("composer.reply_placeholder"), "it should not block because of missing category" @@ -798,7 +808,7 @@ acceptance("Composer", function (needs) { }); const assertImageResized = (assert, uploads) => { - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), uploads.join("\n"), "it resizes uploaded image" @@ -808,12 +818,12 @@ acceptance("Composer", function (needs) { test("reply button has envelope icon when replying to private message", async function (assert) { await visit("/t/34"); await click("article#post_3 button.reply"); - assert.equal( + assert.strictEqual( queryAll(".save-or-cancel button.create").text().trim(), I18n.t("composer.create_pm"), "reply button says Message" ); - assert.equal( + assert.strictEqual( count(".save-or-cancel button.create svg.d-icon-envelope"), 1, "reply button has envelope icon" @@ -825,12 +835,12 @@ acceptance("Composer", function (needs) { await click("article#post_3 button.show-more-actions"); await click("article#post_3 button.edit"); - assert.equal( + assert.strictEqual( queryAll(".save-or-cancel button.create").text().trim(), I18n.t("composer.save_edit"), "save button says Save Edit" ); - assert.equal( + assert.strictEqual( count(".save-or-cancel button.create svg.d-icon-pencil-alt"), 1, "save button has pencil icon" @@ -871,7 +881,7 @@ acceptance("Composer", function (needs) { await fillIn(".d-editor-input", uploads.join("\n")); - assert.equal( + assert.strictEqual( count(".button-wrapper"), 10, "it adds correct amount of scaling button groups" @@ -981,7 +991,7 @@ acceptance("Composer", function (needs) { assert.ok(!exists(".composer-popup")); await fillIn(".d-editor-input", "[](https://github.com)"); - assert.equal(count(".composer-popup"), 1); + assert.strictEqual(count(".composer-popup"), 1); }); test("Shows the 'group_mentioned' notice", async function (assert) { @@ -1042,16 +1052,19 @@ acceptance("Composer - Customizations", function (needs) { test("Supports text customization", async function (assert) { await visit("/"); await click("#create-topic"); - assert.equal(query(".action-title").innerText, I18n.t("topic.create_long")); - assert.equal( + assert.strictEqual( + query(".action-title").innerText, + I18n.t("topic.create_long") + ); + assert.strictEqual( query(".save-or-cancel button").innerText, I18n.t("composer.create_topic") ); const tags = selectKit(".mini-tag-chooser"); await tags.expand(); await tags.selectRowByValue("monkey"); - assert.equal(query(".action-title").innerText, "custom text"); - assert.equal( + assert.strictEqual(query(".action-title").innerText, "custom text"); + assert.strictEqual( query(".save-or-cancel button").innerText, I18n.t("composer.emoji") ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-topic-links-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-topic-links-test.js index 67587ee9c86..ce2e1468813 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-topic-links-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-topic-links-test.js @@ -26,7 +26,7 @@ acceptance("Composer topic featured links", function (needs) { exists(".d-editor-textarea-wrapper .popup-tip.good"), "the body is now good" ); - assert.equal( + assert.strictEqual( queryAll(".title-input input").val(), "An interesting article", "title is from the oneboxed article" @@ -45,7 +45,7 @@ acceptance("Composer topic featured links", function (needs) { exists(".d-editor-textarea-wrapper .popup-tip.good"), "the body is now good" ); - assert.equal( + assert.strictEqual( queryAll(".title-input input").val(), "http://www.example.com/no-title.html", "title is unchanged" @@ -56,7 +56,7 @@ acceptance("Composer topic featured links", function (needs) { await visit("/"); await click("#create-topic"); await fillIn("#reply-title", "https://www.youtube.com/watch?v=dQw4w9WgXcQ"); - assert.equal( + assert.strictEqual( queryAll(".title-input input").val(), "Rick Astley - Never Gonna Give You Up (Video)", "title is from the oneboxed article" @@ -75,7 +75,7 @@ acceptance("Composer topic featured links", function (needs) { exists(".d-editor-textarea-wrapper .popup-tip.good"), "link is pasted into body" ); - assert.equal( + assert.strictEqual( queryAll(".title-input input").val(), "http://www.example.com/nope-onebox.html", "title is unchanged" @@ -87,17 +87,17 @@ acceptance("Composer topic featured links", function (needs) { await click("#create-topic"); const title = "http://" + window.location.hostname + "/internal-page.html"; await fillIn("#reply-title", title); - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview").html().trim().indexOf("onebox"), -1, "onebox preview doesn't show" ); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().length, 0, "link isn't put into the post" ); - assert.equal( + assert.strictEqual( queryAll(".title-input input").val(), title, "title is unchanged" @@ -119,7 +119,7 @@ acceptance("Composer topic featured links", function (needs) { exists(".d-editor-textarea-wrapper .popup-tip.good"), "the body is now good" ); - assert.equal( + assert.strictEqual( queryAll(".title-input input").val(), "An interesting article", "title is from the oneboxed article" @@ -130,17 +130,17 @@ acceptance("Composer topic featured links", function (needs) { await visit("/"); await click("#create-topic"); await fillIn("#reply-title", "http://www.example.com/has-title.html test"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview").html().trim().indexOf("onebox"), -1, "onebox preview doesn't show" ); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().length, 0, "link isn't put into the post" ); - assert.equal( + assert.strictEqual( queryAll(".title-input input").val(), "http://www.example.com/has-title.html test", "title is unchanged" @@ -193,7 +193,7 @@ acceptance( exists(".d-editor-textarea-wrapper .popup-tip.good"), "the body is now good" ); - assert.equal( + assert.strictEqual( queryAll(".title-input input").val(), "An interesting article", "title is from the oneboxed article" diff --git a/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js b/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js index 8148f1b4ecd..773e8bbae59 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/composer-uploads-uppy-test.js @@ -71,7 +71,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) { const done = assert.async(); appEvents.on("composer:all-uploads-complete", () => { - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n" ); @@ -79,7 +79,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) { }); appEvents.on("composer:upload-started", () => { - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "The image:\n[Uploading: avatar.png...]()\n" ); @@ -98,7 +98,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) { const image2 = createFile("avatar2.png"); const done = assert.async(); appEvents.on("composer:uploads-aborted", async () => { - assert.equal( + assert.strictEqual( queryAll(".bootbox .modal-body").html(), I18n.t("post.errors.too_many_dragged_and_dropped_files", { count: 2, @@ -122,7 +122,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) { const done = assert.async(); appEvents.on("composer:uploads-aborted", async () => { - assert.equal( + assert.strictEqual( queryAll(".bootbox .modal-body").html(), I18n.t("post.errors.upload_not_authorized", { authorized_extensions: authorizedExtensions( @@ -153,7 +153,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) { // const done = assert.async(); // appEvents.on("composer:uploads-cancelled", () => { - // assert.equal( + // assert.strictEqual( // queryAll(".d-editor-input").val(), // "The image:\n", // "it should clear the cancelled placeholders" @@ -166,7 +166,7 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) { // uploadStarted++; // if (uploadStarted === 2) { - // assert.equal( + // assert.strictEqual( // queryAll(".d-editor-input").val(), // "The image:\n[Uploading: avatar.png...]()\n[Uploading: avatar2.png...]()\n", // "it should show the upload placeholders when the upload starts" @@ -209,7 +209,7 @@ acceptance("Uppy Composer Attachment - Upload Error", function (needs) { const done = assert.async(); appEvents.on("composer:upload-error", async () => { - assert.equal( + assert.strictEqual( queryAll(".bootbox .modal-body").html(), "There was an error uploading the file, the gif was way too cool.", "it should show the error message from the server" @@ -248,7 +248,7 @@ acceptance("Uppy Composer Attachment - Upload Handler", function (needs) { const done = assert.async(); appEvents.on("composer:uploads-aborted", async () => { - assert.equal( + assert.strictEqual( queryAll(".bootbox .modal-body").html(), "This is an upload handler test for handlertest.png", "it should show the bootbox triggered by the upload handler" diff --git a/app/assets/javascripts/discourse/tests/acceptance/create-account-user-fields-test.js b/app/assets/javascripts/discourse/tests/acceptance/create-account-user-fields-test.js index a5548ab424a..bfeb8222e11 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/create-account-user-fields-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/create-account-user-fields-test.js @@ -38,7 +38,7 @@ acceptance("Create Account - User Fields", function (needs) { assert.ok(exists(".user-field"), "it has at least one user field"); await click(".modal-footer .btn-primary"); - assert.equal( + assert.strictEqual( query("#account-email-validation").innerText.trim(), "Please enter an email address" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/create-invite-modal-test.js b/app/assets/javascripts/discourse/tests/acceptance/create-invite-modal-test.js index 5f521e5993f..71a33eab9a5 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/create-invite-modal-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/create-invite-modal-test.js @@ -52,7 +52,7 @@ acceptance("Invites - Create & Edit Invite Modal", function (needs) { test("basic functionality", async function (assert) { await visit("/u/eviltrout/invited/pending"); await click(".user-invite-buttons .btn:first-child"); - assert.equal( + assert.strictEqual( find("input.invite-link")[0].value, "http://example.com/invites/52641ae8878790bc7b79916247cfe6ba", "shows an invite link when modal is opened" @@ -75,7 +75,11 @@ acceptance("Invites - Create & Edit Invite Modal", function (needs) { await click(".btn-primary"); - assert.equal(count("tbody tr"), 1, "adds invite to list after saving"); + assert.strictEqual( + count("tbody tr"), + 1, + "adds invite to list after saving" + ); await click(".modal-close"); assert.notOk(deleted, "does not delete invite on close"); @@ -97,7 +101,7 @@ acceptance("Invites - Create & Edit Invite Modal", function (needs) { await fillIn("#invite-email", "error"); await click(".invite-link .btn"); - assert.equal( + assert.strictEqual( find("#modal-alert").text(), "error isn't a valid email address." ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/custom-html-set-test.js b/app/assets/javascripts/discourse/tests/acceptance/custom-html-set-test.js index 8266f7a9df3..bd5222b34ec 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/custom-html-set-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/custom-html-set-test.js @@ -18,7 +18,7 @@ acceptance("CustomHTML set", function () { setCustomHTML("top", 'HTML'); await visit("/static/faq"); - assert.equal( + assert.strictEqual( queryAll("span.custom-html-test").text(), "HTML", "it inserted the markup" @@ -31,7 +31,7 @@ acceptance("CustomHTML set", function () { }); await visit("/static/faq"); - assert.equal( + assert.strictEqual( queryAll("span.cookie").text(), "monster", "it inserted the markup" diff --git a/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js b/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js index a1d52f58118..1d81a2c726e 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/custom-html-template-test.js @@ -14,7 +14,7 @@ acceptance("CustomHTML template", function (needs) { test("renders custom template", async function (assert) { await visit("/static/faq"); - assert.equal( + assert.strictEqual( queryAll("span.top-span").text(), "TOP", "it inserted the template" diff --git a/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js b/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js index ac67b052df5..fac3c52d7ea 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/dashboard-test.js @@ -58,7 +58,7 @@ acceptance("Dashboard", function (needs) { "new-contributors report" ); - assert.equal( + assert.strictEqual( $(".section.dashboard-problems .problem-messages ul li:first-child") .html() .trim(), @@ -80,7 +80,7 @@ acceptance("Dashboard", function (needs) { await visit("/admin"); await click(".dashboard .navigation-item.reports .navigation-link"); - assert.equal( + assert.strictEqual( queryAll(".dashboard .reports-index.section .reports-list .report") .length, 1 @@ -88,7 +88,7 @@ acceptance("Dashboard", function (needs) { await fillIn(".dashboard .filter-reports-input", "flags"); - assert.equal( + assert.strictEqual( queryAll(".dashboard .reports-index.section .reports-list .report") .length, 0 @@ -97,7 +97,7 @@ acceptance("Dashboard", function (needs) { await click(".dashboard .navigation-item.security .navigation-link"); await click(".dashboard .navigation-item.reports .navigation-link"); - assert.equal( + assert.strictEqual( queryAll(".dashboard .reports-index.section .reports-list .report") .length, 1, @@ -106,7 +106,7 @@ acceptance("Dashboard", function (needs) { await fillIn(".dashboard .filter-reports-input", "activities"); - assert.equal( + assert.strictEqual( queryAll(".dashboard .reports-index.section .reports-list .report") .length, 1, @@ -121,9 +121,9 @@ acceptance("Dashboard", function (needs) { const groupFilter = selectKit(".group-filter .combo-box"); - assert.equal( + assert.strictEqual( groupFilter.header().value(), - 88, + "88", "its set the value of the filter from the query params" ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/do-not-disturb-test.js b/app/assets/javascripts/discourse/tests/acceptance/do-not-disturb-test.js index 7f376eafbde..2e27ca50425 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/do-not-disturb-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/do-not-disturb-test.js @@ -56,7 +56,10 @@ acceptance("Do not disturb", function (needs) { await visit("/"); await click(".header-dropdown-toggle.current-user"); await click(".menu-links-row .user-preferences-link"); - assert.equal(query(".do-not-disturb .relative-date").textContent, "1h"); + assert.strictEqual( + query(".do-not-disturb .relative-date").textContent, + "1h" + ); await click(".do-not-disturb"); diff --git a/app/assets/javascripts/discourse/tests/acceptance/edit-notification-click-test.js b/app/assets/javascripts/discourse/tests/acceptance/edit-notification-click-test.js index 00f5fa61c1b..e9aace5b6db 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/edit-notification-click-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/edit-notification-click-test.js @@ -43,12 +43,12 @@ acceptance("Edit Notification Click", function (needs) { await click(".d-header-icons #current-user"); await click("#quick-access-notifications .edited"); const [v1, v2] = queryAll(".history-modal .revision-content"); - assert.equal( + assert.strictEqual( v1.textContent.trim(), "Hello world this is a test", "history modal for the edited post is shown" ); - assert.equal( + assert.strictEqual( v2.textContent.trim(), "Hello world this is a testThis is an edit!", "history modal for the edited post is shown" diff --git a/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js b/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js index fdaaabb1f20..3b05a635128 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/emoji-picker-test.js @@ -34,7 +34,7 @@ acceptance("EmojiPicker", function (needs) { await click("button.emoji.btn"); await click(".emoji-picker-emoji-area img.emoji[title='grinning']"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), ":grinning:", "it adds the emoji code in the editor when selected" @@ -49,7 +49,7 @@ acceptance("EmojiPicker", function (needs) { await fillIn(".d-editor-input", "This is a test input"); await click("button.emoji.btn"); await click(".emoji-picker-emoji-area img.emoji[title='grinning']"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "This is a test input :grinning:", "it adds the emoji code and a leading whitespace when there is text" @@ -59,7 +59,7 @@ acceptance("EmojiPicker", function (needs) { await fillIn(".d-editor-input", "This is a test input "); await click(".emoji-picker-emoji-area img.emoji[title='grinning']"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val(), "This is a test input :grinning:", "it adds the emoji code and no leading whitespace when user already entered whitespace" @@ -111,14 +111,14 @@ acceptance("EmojiPicker", function (needs) { await click(".emoji-picker-emoji-area img.emoji[title='sunglasses']"); await click(".emoji-picker-emoji-area img.emoji[title='grinning']"); - assert.equal( + assert.strictEqual( queryAll('.section[data-section="recent"] .section-group img.emoji') .length, 2, "it has multiple recent emojis" ); - assert.equal( + assert.strictEqual( /grinning/.test( queryAll(".section.recent .section-group img.emoji").first().attr("src") ), diff --git a/app/assets/javascripts/discourse/tests/acceptance/emoji-test.js b/app/assets/javascripts/discourse/tests/acceptance/emoji-test.js index 9d5a8cd7bc7..fed440044be 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/emoji-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/emoji-test.js @@ -11,7 +11,7 @@ acceptance("Emoji", function (needs) { await click("#topic-footer-buttons .btn.create"); await fillIn(".d-editor-input", "this is an emoji :blonde_woman:"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview:visible").html().trim(), `

this is an emoji :blonde_woman:

` ); @@ -22,7 +22,7 @@ acceptance("Emoji", function (needs) { await click("#topic-footer-buttons .btn.create"); await fillIn(".d-editor-input", "this is an emoji :blonde_woman:t5:"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview:visible").html().trim(), `

this is an emoji :blonde_woman:t5:

` ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/enforce-second-factor-test.js b/app/assets/javascripts/discourse/tests/acceptance/enforce-second-factor-test.js index 86ce29be17f..8503e16654d 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/enforce-second-factor-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/enforce-second-factor-test.js @@ -34,7 +34,7 @@ acceptance("Enforce Second Factor", function (needs) { await catchAbortedTransition(); - assert.equal( + assert.strictEqual( queryAll(".control-label").text(), "Password", "it will not transition from second-factor preferences" @@ -43,7 +43,7 @@ acceptance("Enforce Second Factor", function (needs) { await click("#toggle-hamburger-menu"); await click("a.admin-link"); - assert.equal( + assert.strictEqual( queryAll(".control-label").text(), "Password", "it stays at second-factor preferences" @@ -58,7 +58,7 @@ acceptance("Enforce Second Factor", function (needs) { await catchAbortedTransition(); - assert.equal( + assert.strictEqual( queryAll(".control-label").text(), "Password", "it will not transition from second-factor preferences" @@ -67,7 +67,7 @@ acceptance("Enforce Second Factor", function (needs) { await click("#toggle-hamburger-menu"); await click("a.about-link"); - assert.equal( + assert.strictEqual( queryAll(".control-label").text(), "Password", "it stays at second-factor preferences" @@ -83,7 +83,7 @@ acceptance("Enforce Second Factor", function (needs) { await catchAbortedTransition(); - assert.notEqual( + assert.notStrictEqual( queryAll(".control-label").text(), "Password", "it will transition from second-factor preferences" @@ -92,7 +92,7 @@ acceptance("Enforce Second Factor", function (needs) { await click("#toggle-hamburger-menu"); await click("a.about-link"); - assert.notEqual( + assert.notStrictEqual( queryAll(".control-label").text(), "Password", "it is possible to navigate to other pages" diff --git a/app/assets/javascripts/discourse/tests/acceptance/fast-edit-test.js b/app/assets/javascripts/discourse/tests/acceptance/fast-edit-test.js index 65caf809644..15ef006f361 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/fast-edit-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/fast-edit-test.js @@ -22,7 +22,7 @@ acceptance("Fast Edit", function (needs) { await click(".quote-button .quote-edit-label"); assert.ok(exists("#fast-edit-input"), "fast editor is open"); - assert.equal( + assert.strictEqual( queryAll("#fast-edit-input").val(), "Any plans", "contains selected text" @@ -43,7 +43,7 @@ acceptance("Fast Edit", function (needs) { await triggerKeyEvent(document, "keypress", "e".charCodeAt(0)); assert.ok(exists("#fast-edit-input"), "fast editor is open"); - assert.equal( + assert.strictEqual( queryAll("#fast-edit-input").val(), "Any plans", "contains selected text" diff --git a/app/assets/javascripts/discourse/tests/acceptance/flag-post-test.js b/app/assets/javascripts/discourse/tests/acceptance/flag-post-test.js index 0fbfa0a2517..5fc5a754b8b 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/flag-post-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/flag-post-test.js @@ -141,14 +141,14 @@ acceptance("flagging", function (needs) { await silenceUntilCombobox.selectRowByValue("tomorrow"); await fillIn(".silence-reason", "for breaking the rules"); await click(".d-modal-cancel"); - assert.equal(count(".bootbox.modal:visible"), 1); + assert.strictEqual(count(".bootbox.modal:visible"), 1); await click(".modal-footer .btn-default"); assert.ok(!exists(".bootbox.modal:visible")); assert.ok(exists(".silence-user-modal"), "it shows the silence modal"); await click(".d-modal-cancel"); - assert.equal(count(".bootbox.modal:visible"), 1); + assert.strictEqual(count(".bootbox.modal:visible"), 1); await click(".modal-footer .btn-primary"); assert.ok(!exists(".bootbox.modal:visible")); diff --git a/app/assets/javascripts/discourse/tests/acceptance/forgot-password-test.js b/app/assets/javascripts/discourse/tests/acceptance/forgot-password-test.js index 278f57b676f..e675c72ffa2 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/forgot-password-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/forgot-password-test.js @@ -23,7 +23,7 @@ acceptance("Forgot password", function (needs) { await click("header .login-button"); await click("#forgot-password-link"); - assert.equal( + assert.strictEqual( queryAll(".forgot-password-reset").attr("disabled"), "disabled", "it should disable the button until the field is filled" @@ -32,7 +32,7 @@ acceptance("Forgot password", function (needs) { await fillIn("#username-or-email", "someuser"); await click(".forgot-password-reset"); - assert.equal( + assert.strictEqual( queryAll(".alert-error").html().trim(), I18n.t("forgot_password.complete_username_not_found", { username: "someuser", @@ -43,7 +43,7 @@ acceptance("Forgot password", function (needs) { await fillIn("#username-or-email", "someuser@gmail.com"); await click(".forgot-password-reset"); - assert.equal( + assert.strictEqual( queryAll(".alert-error").html().trim(), I18n.t("forgot_password.complete_email_not_found", { email: "someuser@gmail.com", @@ -62,7 +62,7 @@ acceptance("Forgot password", function (needs) { "it should remove the flash error when succeeding" ); - assert.equal( + assert.strictEqual( queryAll(".modal-body").html().trim(), I18n.t("forgot_password.complete_username_found", { username: "someuser", @@ -76,7 +76,7 @@ acceptance("Forgot password", function (needs) { await fillIn("#username-or-email", "someuser@gmail.com"); await click(".forgot-password-reset"); - assert.equal( + assert.strictEqual( queryAll(".modal-body").html().trim(), I18n.t("forgot_password.complete_email_found", { email: "someuser@gmail.com", @@ -100,7 +100,7 @@ acceptance( await click("header .login-button"); await click("#forgot-password-link"); - assert.equal( + assert.strictEqual( queryAll(".forgot-password-reset").attr("disabled"), "disabled", "it should disable the button until the field is filled" @@ -109,7 +109,7 @@ acceptance( await fillIn("#username-or-email", "someuser"); await click(".forgot-password-reset"); - assert.equal( + assert.strictEqual( queryAll(".modal-body").html().trim(), I18n.t("forgot_password.complete_username", { username: "someuser", diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-index-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-index-test.js index 1c284bb6224..0aa2399c4f4 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/group-index-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/group-index-test.js @@ -25,7 +25,7 @@ acceptance("Group Members - Anonymous", function () { "it does not allow anon user to manage group members" ); - assert.equal( + assert.strictEqual( queryAll(".group-username-filter").attr("placeholder"), I18n.t("groups.members.filter_placeholder"), "it should display the right filter placeholder" @@ -48,7 +48,7 @@ acceptance("Group Members", function (needs) { await visit("/g/discourse"); await click(".group-members-add"); - assert.equal( + assert.strictEqual( count(".user-chooser"), 1, "it should display the add members modal" @@ -63,7 +63,7 @@ acceptance("Group Members", function (needs) { "it allows admin user to manage group members" ); - assert.equal( + assert.strictEqual( queryAll(".group-username-filter").attr("placeholder"), I18n.t("groups.members.filter_placeholder_admin"), "it should display the right filter placeholder" diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-categories-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-categories-test.js index 62187603a4a..1e36361608c 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-categories-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-categories-test.js @@ -23,7 +23,7 @@ acceptance("Managing Group Category Notification Defaults", function (needs) { test("As an admin", async function (assert) { await visit("/g/discourse/manage/categories"); - assert.equal( + assert.strictEqual( count(".groups-notifications-form .category-selector"), 5, "it should display category inputs" @@ -35,7 +35,7 @@ acceptance("Managing Group Category Notification Defaults", function (needs) { await visit("/g/discourse/manage/categories"); - assert.equal( + assert.strictEqual( count(".groups-notifications-form .category-selector"), 5, "it should display category inputs" diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js index f021f0b55eb..49ae5dd9f2a 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-email-settings-test.js @@ -17,7 +17,7 @@ acceptance("Managing Group Email Settings - SMTP Disabled", function (needs) { query(".user-secondary-navigation").innerText.includes("Email"), "email link is not shown in the sidebar" ); - assert.equal( + assert.strictEqual( currentRouteName(), "group.manage.profile", "it redirects to the group profile page" @@ -37,7 +37,7 @@ acceptance( query(".user-secondary-navigation").innerText.includes("Email"), "email link is shown in the sidebar" ); - assert.equal( + assert.strictEqual( currentRouteName(), "group.manage.email", "it redirects to the group email page" @@ -84,12 +84,12 @@ acceptance( assert.ok(exists(".group-smtp-email-settings")); await click("#prefill_smtp_gmail"); - assert.equal( + assert.strictEqual( query("input[name='smtp_server']").value, "smtp.gmail.com", "prefills SMTP server settings for gmail" ); - assert.equal( + assert.strictEqual( query("input[name='smtp_port']").value, "587", "prefills SMTP port settings for gmail" @@ -112,7 +112,7 @@ acceptance( await click(".group-manage-save"); - assert.equal( + assert.strictEqual( query(".group-manage-save-button > span").innerText, "Saved!" ); @@ -123,7 +123,7 @@ acceptance( ); await click("#enable_smtp"); - assert.equal( + assert.strictEqual( query(".modal-body").innerText, I18n.t("groups.manage.email.smtp_disable_confirm"), "shows a confirm dialogue warning SMTP settings will be wiped" @@ -155,12 +155,12 @@ acceptance( ); await click("#prefill_imap_gmail"); - assert.equal( + assert.strictEqual( query("input[name='imap_server']").value, "imap.gmail.com", "prefills IMAP server settings for gmail" ); - assert.equal( + assert.strictEqual( query("input[name='imap_port']").value, "993", "prefills IMAP port settings for gmail" @@ -175,7 +175,7 @@ acceptance( await click(".group-manage-save"); - assert.equal( + assert.strictEqual( query(".group-manage-save-button > span").innerText, "Saved!" ); @@ -199,7 +199,7 @@ acceptance( ); await click("#enable_imap"); - assert.equal( + assert.strictEqual( query(".modal-body").innerText, I18n.t("groups.manage.email.imap_disable_confirm"), "shows a confirm dialogue warning IMAP settings will be wiped" @@ -277,38 +277,38 @@ acceptance( assert.notOk(exists("#enable_smtp:disabled"), "SMTP is not disabled"); assert.notOk(exists("#enable_imap:disabled"), "IMAP is not disabled"); - assert.equal( + assert.strictEqual( query("[name='username']").value, "test@test.com", "email username is prefilled" ); - assert.equal( + assert.strictEqual( query("[name='password']").value, "password", "email password is prefilled" ); - assert.equal( + assert.strictEqual( query("[name='smtp_server']").value, "smtp.gmail.com", "smtp server is prefilled" ); - assert.equal( + assert.strictEqual( query("[name='smtp_port']").value, "587", "smtp port is prefilled" ); - assert.equal( + assert.strictEqual( query("[name='imap_server']").value, "imap.gmail.com", "imap server is prefilled" ); - assert.equal( + assert.strictEqual( query("[name='imap_port']").value, "993", "imap port is prefilled" ); - assert.equal( + assert.strictEqual( selectKit("#imap_mailbox").header().value(), "INBOX", "imap mailbox is prefilled" @@ -359,7 +359,7 @@ acceptance( await fillIn('input[name="password"]', "password@gmail.com"); await click(".test-smtp-settings"); - assert.equal( + assert.strictEqual( query(".modal-body").innerText, "There was an issue with the SMTP credentials provided, check the username and password and try again.", "shows a dialogue with the error message from the server" diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-interaction-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-interaction-test.js index c45f70501ae..f16080b70c2 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-interaction-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-interaction-test.js @@ -20,31 +20,31 @@ acceptance("Managing Group Interaction Settings", function (needs) { await visit("/g/alternative-group/manage/interaction"); - assert.equal( + assert.strictEqual( count(".groups-form-visibility-level"), 1, "it should display visibility level selector" ); - assert.equal( + assert.strictEqual( count(".groups-form-mentionable-level"), 1, "it should display mentionable level selector" ); - assert.equal( + assert.strictEqual( count(".groups-form-messageable-level"), 1, "it should display messageable level selector" ); - assert.equal( + assert.strictEqual( count(".groups-form-incoming-email"), 1, "it should display incoming email input" ); - assert.equal( + assert.strictEqual( count(".groups-form-default-notification-level"), 1, "it should display default notification level input" @@ -60,31 +60,31 @@ acceptance("Managing Group Interaction Settings", function (needs) { await visit("/g/discourse/manage/interaction"); - assert.equal( + assert.strictEqual( count(".groups-form-visibility-level"), 0, "it should not display visibility level selector" ); - assert.equal( + assert.strictEqual( count(".groups-form-mentionable-level"), 1, "it should display mentionable level selector" ); - assert.equal( + assert.strictEqual( count(".groups-form-messageable-level"), 1, "it should display messageable level selector" ); - assert.equal( + assert.strictEqual( count(".groups-form-incoming-email"), 0, "it should not display incoming email input" ); - assert.equal( + assert.strictEqual( count(".groups-form-default-notification-level"), 1, "it should display default notification level input" @@ -101,7 +101,7 @@ acceptance( await visit("/g/alternative-group/manage/interaction"); await assert.ok(exists(".groups-form"), "should have the form"); - await assert.equal( + await assert.strictEqual( selectKit(".groups-form-default-notification-level").header().value(), "0", "it should select Muted as the notification level" @@ -112,7 +112,7 @@ acceptance( await visit("/g/discourse/manage/interaction"); await assert.ok(exists(".groups-form"), "should have the form"); - await assert.equal( + await assert.strictEqual( selectKit(".groups-form-default-notification-level").header().value(), "3", "it should select Watching as the notification level" @@ -123,7 +123,7 @@ acceptance( await visit("/g/support/manage/interaction"); await assert.ok(exists(".groups-form"), "should have the form"); - await assert.equal( + await assert.strictEqual( selectKit(".groups-form-default-notification-level").header().value(), "2", "it should select Tracking as the notification level" diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-logs-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-logs-test.js index 4d1046a019c..543e41afe24 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-logs-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-logs-test.js @@ -99,14 +99,14 @@ acceptance("Group logs", function (needs) { test("Browsing group logs", async function (assert) { await visit("/g/snorlax/manage/logs"); - assert.equal( + assert.strictEqual( count("tr.group-manage-logs-row"), 2, "it should display the right number of logs" ); await click(query(".group-manage-logs-row button")); - assert.equal( + assert.strictEqual( count("tr.group-manage-logs-row"), 1, "it should display the right number of logs" diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-membership-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-membership-test.js index 0637892b675..15c5c0d56fe 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-membership-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-membership-test.js @@ -16,49 +16,49 @@ acceptance("Managing Group Membership", function (needs) { await visit("/g/alternative-group/manage/membership"); - assert.equal( + assert.strictEqual( count('label[for="automatic_membership"]'), 1, "it should display automatic membership label" ); - assert.equal( + assert.strictEqual( count(".groups-form-primary-group"), 1, "it should display set as primary group checkbox" ); - assert.equal( + assert.strictEqual( count(".groups-form-grant-trust-level"), 1, "it should display grant trust level selector" ); - assert.equal( + assert.strictEqual( count(".group-form-public-admission"), 1, "it should display group public admission input" ); - assert.equal( + assert.strictEqual( count(".group-form-public-exit"), 1, "it should display group public exit input" ); - assert.equal( + assert.strictEqual( count(".group-form-allow-membership-requests"), 1, "it should display group allow_membership_request input" ); - assert.equal( + assert.strictEqual( count(".group-form-allow-membership-requests[disabled]"), 1, "it should disable group allow_membership_request input" ); - assert.equal( + assert.strictEqual( count(".group-flair-inputs"), 1, "it should display avatar flair inputs" @@ -67,7 +67,7 @@ acceptance("Managing Group Membership", function (needs) { await click(".group-form-public-admission"); await click(".group-form-allow-membership-requests"); - assert.equal( + assert.strictEqual( count(".group-form-public-admission[disabled]"), 1, "it should disable group public admission input" @@ -78,7 +78,7 @@ acceptance("Managing Group Membership", function (needs) { "it should not disable group public exit input" ); - assert.equal( + assert.strictEqual( count(".group-form-membership-request-template"), 1, "it should display the membership request template field" @@ -91,7 +91,7 @@ acceptance("Managing Group Membership", function (needs) { await emailDomains.fillInFilter("foo.com"); await emailDomains.selectRowByValue("foo.com"); - assert.equal(emailDomains.header().value(), "foo.com"); + assert.strictEqual(emailDomains.header().value(), "foo.com"); }); test("As a group owner", async function (assert) { @@ -119,25 +119,25 @@ acceptance("Managing Group Membership", function (needs) { "it should not display grant trust level selector" ); - assert.equal( + assert.strictEqual( count(".group-form-public-admission"), 1, "it should display group public admission input" ); - assert.equal( + assert.strictEqual( count(".group-form-public-exit"), 1, "it should display group public exit input" ); - assert.equal( + assert.strictEqual( count(".group-form-allow-membership-requests"), 1, "it should display group allow_membership_request input" ); - assert.equal( + assert.strictEqual( count(".group-form-allow-membership-requests[disabled]"), 1, "it should disable group allow_membership_request input" diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-profile-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-profile-test.js index 70fda0422fa..aa436364a53 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-profile-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-profile-test.js @@ -24,17 +24,17 @@ acceptance("Managing Group Profile", function (needs) { test("As an admin", async function (assert) { await visit("/g/discourse/manage/profile"); - assert.equal( + assert.strictEqual( count(".group-form-bio"), 1, "it should display group bio input" ); - assert.equal( + assert.strictEqual( count(".group-form-name"), 1, "it should display group name input" ); - assert.equal( + assert.strictEqual( count(".group-form-full-name"), 1, "it should display group full name input" diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-manage-tags-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-manage-tags-test.js index 6b235c88d00..2d75056e83d 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/group-manage-tags-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/group-manage-tags-test.js @@ -24,7 +24,7 @@ acceptance("Managing Group Tag Notification Defaults", function (needs) { test("As an admin", async function (assert) { await visit("/g/discourse/manage/tags"); - assert.equal( + assert.strictEqual( count(".groups-notifications-form .tag-chooser"), 5, "it should display tag inputs" @@ -36,7 +36,7 @@ acceptance("Managing Group Tag Notification Defaults", function (needs) { await visit("/g/discourse/manage/tags"); - assert.equal( + assert.strictEqual( count(".groups-notifications-form .tag-chooser"), 5, "it should display tag inputs" diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-requests-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-requests-test.js index fbfca35e2dd..08f8e5f0766 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/group-requests-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/group-requests-test.js @@ -89,23 +89,23 @@ acceptance("Group Requests", function (needs) { test("Group Requests", async function (assert) { await visit("/g/Macdonald/requests"); - assert.equal(count(".group-members tr"), 2); - assert.equal( + assert.strictEqual(count(".group-members tr"), 2); + assert.strictEqual( queryAll(".group-members tr:first-child td:nth-child(1)") .text() .trim() .replace(/\s+/g, " "), "Robin Ward eviltrout" ); - assert.equal( + assert.strictEqual( queryAll(".group-members tr:first-child td:nth-child(3)").text().trim(), "Please accept my membership request." ); - assert.equal( + assert.strictEqual( queryAll(".group-members tr:first-child .btn-primary").text().trim(), "Accept" ); - assert.equal( + assert.strictEqual( queryAll(".group-members tr:first-child .btn-danger").text().trim(), "Deny" ); @@ -120,7 +120,7 @@ acceptance("Group Requests", function (needs) { assert.deepEqual(requests, [["19", "true"]]); await click(".group-members tr:last-child .btn-danger"); - assert.equal( + assert.strictEqual( queryAll(".group-members tr:last-child td:nth-child(4)").text().trim(), "denied" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/group-test.js b/app/assets/javascripts/discourse/tests/acceptance/group-test.js index 2a4d38edf49..d1f436f6b24 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/group-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/group-test.js @@ -41,7 +41,7 @@ acceptance("Group - Anonymous", function (needs) { await click(".activity-nav li a[href='/g/discourse/activity/topics']"); assert.ok(queryAll(".topic-list"), "it shows the topic list"); - assert.equal(count(".topic-list-item"), 2, "it lists stream items"); + assert.strictEqual(count(".topic-list-item"), 2, "it lists stream items"); await click(".activity-nav li a[href='/g/discourse/activity/mentions']"); @@ -59,9 +59,9 @@ acceptance("Group - Anonymous", function (needs) { const groupDropdown = selectKit(".group-dropdown"); await groupDropdown.expand(); - assert.equal(groupDropdown.rowByIndex(1).name(), "discourse"); + assert.strictEqual(groupDropdown.rowByIndex(1).name(), "discourse"); - assert.equal( + assert.strictEqual( groupDropdown.rowByIndex(0).name(), I18n.t("groups.index.all") ); @@ -191,19 +191,19 @@ acceptance("Group - Authenticated", function (needs) { await visit("/g"); await click(".group-index-request"); - assert.equal( + assert.strictEqual( queryAll(".modal-header .title").text().trim(), I18n.t("groups.membership_request.title", { group_name: "Macdonald" }) ); - assert.equal( + assert.strictEqual( queryAll(".request-group-membership-form textarea").val(), "Please add me" ); await click(".modal-footer .btn-primary"); - assert.equal( + assert.strictEqual( queryAll(".fancy-title").text().trim(), "Internationalization / localization" ); @@ -212,9 +212,9 @@ acceptance("Group - Authenticated", function (needs) { await click(".group-message-button"); - assert.equal(count("#reply-control"), 1, "it opens the composer"); + assert.strictEqual(count("#reply-control"), 1, "it opens the composer"); const privateMessageUsers = selectKit("#private-message-users"); - assert.equal( + assert.strictEqual( privateMessageUsers.header().value(), "discourse", "it prefills the group name" @@ -227,7 +227,7 @@ acceptance("Group - Authenticated", function (needs) { await visit("/g/alternative-group"); await click(".nav-pills li a[title='Messages']"); - assert.equal( + assert.strictEqual( query("span.empty-state-title").innerText.trim(), I18n.t("no_group_messages_title"), "it should display the right text" @@ -238,7 +238,7 @@ acceptance("Group - Authenticated", function (needs) { await visit("/g/discourse"); await click(".nav-pills li a[title='Messages']"); - assert.equal( + assert.strictEqual( queryAll(".topic-list-item .link-top-line").text().trim(), "This is a private message 1", "it should display the list of group topics" @@ -247,7 +247,7 @@ acceptance("Group - Authenticated", function (needs) { await click("#search-button"); await fillIn("#search-term", "smth"); - assert.equal( + assert.strictEqual( query( ".search-menu .results .search-menu-assistant-item:first-child" ).innerText.trim(), @@ -259,18 +259,18 @@ acceptance("Group - Authenticated", function (needs) { test("Admin Viewing Group", async function (assert) { await visit("/g/discourse"); - assert.equal( + assert.strictEqual( count(".nav-pills li a[title='Manage']"), 1, "it should show manage group tab if user is admin" ); - assert.equal( + assert.strictEqual( count(".group-message-button"), 1, "it displays show group message button" ); - assert.equal( + assert.strictEqual( queryAll(".group-info-name").text(), "Awesome Team", "it should display the group name" @@ -278,7 +278,7 @@ acceptance("Group - Authenticated", function (needs) { await click(".group-details-button button.btn-danger"); - assert.equal( + assert.strictEqual( queryAll(".bootbox .modal-body").html(), I18n.t("admin.groups.delete_with_messages_confirm", { count: 2, @@ -292,7 +292,7 @@ acceptance("Group - Authenticated", function (needs) { test("Moderator Viewing Group", async function (assert) { await visit("/g/alternative-group"); - assert.equal( + assert.strictEqual( count(".nav-pills li a[title='Manage']"), 1, "it should show manage group tab if user can_admin_group" @@ -310,11 +310,11 @@ acceptance("Group - Authenticated", function (needs) { const memberDropdown = selectKit(".group-member-dropdown:nth-of-type(1)"); await memberDropdown.expand(); - assert.equal( + assert.strictEqual( memberDropdown.rowByIndex(0).name(), I18n.t("groups.members.remove_member") ); - assert.equal( + assert.strictEqual( memberDropdown.rowByIndex(1).name(), I18n.t("groups.members.make_owner") ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/groups-index-test.js b/app/assets/javascripts/discourse/tests/acceptance/groups-index-test.js index 22a425a1892..eb7c9f47964 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/groups-index-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/groups-index-test.js @@ -12,17 +12,17 @@ acceptance("Groups", function () { test("Browsing Groups", async function (assert) { await visit("/g?username=eviltrout"); - assert.equal(count(".group-box"), 1, "it displays user's groups"); + assert.strictEqual(count(".group-box"), 1, "it displays user's groups"); await visit("/g"); - assert.equal(count(".group-box"), 2, "it displays visible groups"); - assert.equal( + assert.strictEqual(count(".group-box"), 2, "it displays visible groups"); + assert.strictEqual( count(".group-index-join"), 1, "it shows button to join group" ); - assert.equal( + assert.strictEqual( count(".group-index-request"), 1, "it shows button to request for group membership" @@ -42,7 +42,7 @@ acceptance("Groups", function () { await click("a[href='/g/discourse/members']"); - assert.equal( + assert.strictEqual( queryAll(".group-info-name").text().trim(), "Awesome Team", "it displays the group page" diff --git a/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js b/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js index c79299dcdc8..b3d1ebf1c41 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/groups-new-test.js @@ -25,7 +25,7 @@ acceptance("New Group - Authenticated", function (needs) { await visit("/g"); await click(".groups-header-new"); - assert.equal( + assert.strictEqual( count(".group-form-save[disabled]"), 1, "save button should be disabled" @@ -33,13 +33,13 @@ acceptance("New Group - Authenticated", function (needs) { await fillIn("input[name='name']", "1"); - assert.equal( + assert.strictEqual( queryAll(".tip.bad").text().trim(), I18n.t("admin.groups.new.name.too_short"), "it should show the right validation tooltip" ); - assert.equal( + assert.strictEqual( count(".group-form-save:disabled"), 1, "it should disable the save button" @@ -50,7 +50,7 @@ acceptance("New Group - Authenticated", function (needs) { "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" ); - assert.equal( + assert.strictEqual( queryAll(".tip.bad").text().trim(), I18n.t("admin.groups.new.name.too_long"), "it should show the right validation tooltip" @@ -58,7 +58,7 @@ acceptance("New Group - Authenticated", function (needs) { await fillIn("input[name='name']", ""); - assert.equal( + assert.strictEqual( queryAll(".tip.bad").text().trim(), I18n.t("admin.groups.new.name.blank"), "it should show the right validation tooltip" @@ -66,7 +66,7 @@ acceptance("New Group - Authenticated", function (needs) { await fillIn("input[name='name']", "goodusername"); - assert.equal( + assert.strictEqual( queryAll(".tip.good").text().trim(), I18n.t("admin.groups.new.name.available"), "it should show the right validation tooltip" diff --git a/app/assets/javascripts/discourse/tests/acceptance/hamburger-menu-test.js b/app/assets/javascripts/discourse/tests/acceptance/hamburger-menu-test.js index d073b449421..09bd99c6f07 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/hamburger-menu-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/hamburger-menu-test.js @@ -19,7 +19,7 @@ acceptance( await visit("/"); await click(".hamburger-dropdown"); - assert.equal( + assert.strictEqual( queryAll(".review .badge-notification.reviewables").text(), "3" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/hashtags-test.js b/app/assets/javascripts/discourse/tests/acceptance/hashtags-test.js index 1524ac1e3e7..ffce64bfaff 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/hashtags-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/hashtags-test.js @@ -32,7 +32,7 @@ category vs tag: #bug vs #bug::tag uppercase hashtag works too #BUG, #BUG::tag` ); - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview:visible").html().trim(), `

this is a category hashtag #bug

this is a tag hashtag #monkey

diff --git a/app/assets/javascripts/discourse/tests/acceptance/invite-accept-test.js b/app/assets/javascripts/discourse/tests/acceptance/invite-accept-test.js index 432f5c37e33..a7adf016a4f 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/invite-accept-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/invite-accept-test.js @@ -100,7 +100,7 @@ acceptance("Invite accept", function (needs) { await visit("/invites/myvalidinvitetoken"); assert.ok(exists("#new-account-email"), "shows the email input"); assert.ok(exists("#new-account-username"), "shows the username input"); - assert.equal( + assert.strictEqual( queryAll("#new-account-username").val(), "invited", "username is prefilled" @@ -277,18 +277,18 @@ acceptance("Invite link with authentication data", function (needs) { "email field is disabled" ); - assert.equal( + assert.strictEqual( queryAll("#account-email-validation").text().trim(), I18n.t("user.email.authenticated", { provider: "Facebook" }) ); - assert.equal( + assert.strictEqual( queryAll("#new-account-username").val(), "foobar", "username is prefilled" ); - assert.equal( + assert.strictEqual( queryAll("#new-account-name").val(), "barfoo", "name is prefilled" @@ -312,7 +312,7 @@ acceptance("Email Invite link with authentication data", function (needs) { await visit("/invites/myvalidinvitetoken"); - assert.equal( + assert.strictEqual( queryAll("#account-email-validation").text().trim(), I18n.t("user.email.invite_auth_email_invalid", { provider: "Facebook" }) ); @@ -350,18 +350,18 @@ acceptance( ); assert.ok(!exists("#new-account-email"), "does not show email field"); - assert.equal( + assert.strictEqual( queryAll("#account-email-validation").text().trim(), I18n.t("user.email.authenticated", { provider: "Facebook" }) ); - assert.equal( + assert.strictEqual( queryAll("#new-account-username").val(), "foobar", "username is prefilled" ); - assert.equal( + assert.strictEqual( queryAll("#new-account-name").val(), "barfoo", "name is prefilled" @@ -388,7 +388,7 @@ acceptance( await visit("/invites/myvalidinvitetoken"); - assert.equal( + assert.strictEqual( query(".bad").textContent.trim(), "Your invitation email does not match the email authenticated by Facebook" ); @@ -416,7 +416,7 @@ acceptance( assert.ok(!exists("#new-account-email"), "does not show email field"); - assert.equal( + assert.strictEqual( queryAll("#account-email-validation").text().trim(), I18n.t("user.email.authenticated_by_invite") ); @@ -444,7 +444,7 @@ acceptance( assert.ok(!exists("#new-account-email"), "does not show email field"); - assert.equal( + assert.strictEqual( queryAll("#account-email-validation").text().trim(), I18n.t("user.email.ok") ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/jump-to-test.js b/app/assets/javascripts/discourse/tests/acceptance/jump-to-test.js index 3afb2a1bab4..94d60b9ab85 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/jump-to-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/jump-to-test.js @@ -30,7 +30,7 @@ acceptance("Jump to", function (needs) { await fillIn("input.date-picker", "2014-02-24"); await click(".jump-to-post-modal .btn-primary"); - assert.equal( + assert.strictEqual( currentURL(), "/t/internationalization-localization/280/3", "it jumps to the correct post" @@ -44,7 +44,7 @@ acceptance("Jump to", function (needs) { await fillIn("input.date-picker", "2094-02-24"); await click(".jump-to-post-modal .btn-primary"); - assert.equal( + assert.strictEqual( currentURL(), "/t/internationalization-localization/280/20", "it jumps to the last post if no post found" diff --git a/app/assets/javascripts/discourse/tests/acceptance/keyboard-shortcuts-test.js b/app/assets/javascripts/discourse/tests/acceptance/keyboard-shortcuts-test.js index 85895d83d8a..4ab616174cc 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/keyboard-shortcuts-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/keyboard-shortcuts-test.js @@ -34,18 +34,18 @@ acceptance("Keyboard Shortcuts - Anonymous Users", function (needs) { await visit("/t/this-is-a-test-topic/9"); await triggerKeyEvent(document, "keypress", "g".charCodeAt(0)); await triggerKeyEvent(document, "keypress", "s".charCodeAt(0)); - assert.equal(currentURL(), "/t/this-is-a-test-topic/9"); + assert.strictEqual(currentURL(), "/t/this-is-a-test-topic/9"); // Suggested topics elements exist. await visit("/t/internationalization-localization/280"); await triggerKeyEvent(document, "keypress", "g".charCodeAt(0)); await triggerKeyEvent(document, "keypress", "s".charCodeAt(0)); - assert.equal(currentURL(), "/t/polls-are-still-very-buggy/27331/4"); + assert.strictEqual(currentURL(), "/t/polls-are-still-very-buggy/27331/4"); await visit("/t/1-3-0beta9-no-rate-limit-popups/28830"); await triggerKeyEvent(document, "keypress", "g".charCodeAt(0)); await triggerKeyEvent(document, "keypress", "s".charCodeAt(0)); - assert.equal(currentURL(), "/t/keyboard-shortcuts-are-awesome/27331"); + assert.strictEqual(currentURL(), "/t/keyboard-shortcuts-are-awesome/27331"); }); }); @@ -99,12 +99,12 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) { exists("#dismiss-read-confirm"), "confirmation modal to dismiss unread is present" ); - assert.equal( + assert.strictEqual( query(".modal-body").innerText, I18n.t("topics.bulk.also_dismiss_topics") ); await click("#dismiss-read-confirm"); - assert.equal( + assert.strictEqual( markReadCalled, 1, "mark read has been called on the backend once" @@ -129,13 +129,13 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) { exists("#dismiss-read-confirm"), "confirmation modal to dismiss unread is present" ); - assert.equal( + assert.strictEqual( query(".modal-body").innerText, "Stop tracking these topics so they never show up as unread for me again" ); await click("#dismiss-read-confirm"); - assert.equal( + assert.strictEqual( markReadCalled, 2, "mark read has been called on the backend twice" @@ -154,7 +154,7 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) { assert.ok(exists("#dismiss-new-top"), "dismiss new top button is present"); await triggerKeyEvent(document, "keypress", "x".charCodeAt(0)); await triggerKeyEvent(document, "keypress", "r".charCodeAt(0)); - assert.equal(resetNewCalled, 1); + assert.strictEqual(resetNewCalled, 1); // we get rid of all but one topic so the top dismiss button doesn't // show up, as it only appears if there are too many topics pushing @@ -171,7 +171,7 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) { ); await triggerKeyEvent(document, "keypress", "x".charCodeAt(0)); await triggerKeyEvent(document, "keypress", "r".charCodeAt(0)); - assert.equal(resetNewCalled, 2); + assert.strictEqual(resetNewCalled, 2); // restore the original topic list topicList.topic_list.topics = originalTopics; @@ -195,6 +195,6 @@ acceptance("Keyboard Shortcuts - Authenticated Users", function (needs) { await triggerKeyEvent(document, "keypress", "x".charCodeAt(0)); await triggerKeyEvent(document, "keypress", "r".charCodeAt(0)); - assert.equal(resetNewCalled, 1); + assert.strictEqual(resetNewCalled, 1); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/login-redirect-test.js b/app/assets/javascripts/discourse/tests/acceptance/login-redirect-test.js index 2731a37854a..7b72de09a68 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/login-redirect-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/login-redirect-test.js @@ -5,7 +5,7 @@ import { test } from "qunit"; acceptance("Login redirect - anonymous", function () { test("redirects login to default homepage", async function (assert) { await visit("/login"); - assert.equal( + assert.strictEqual( currentRouteName(), "discovery.latest", "it works when latest is the homepage" @@ -20,7 +20,7 @@ acceptance("Login redirect - categories default", function (needs) { test("when site setting is categories", async function (assert) { await visit("/login"); - assert.equal( + assert.strictEqual( currentRouteName(), "discovery.categories", "it works when categories is the homepage" diff --git a/app/assets/javascripts/discourse/tests/acceptance/login-required-test.js b/app/assets/javascripts/discourse/tests/acceptance/login-required-test.js index 283ad787377..206cfdacfb2 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/login-required-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/login-required-test.js @@ -11,10 +11,14 @@ acceptance("Login Required", function (needs) { test("redirect", async function (assert) { await visit("/latest"); - assert.equal(currentRouteName(), "login", "it redirects them to login"); + assert.strictEqual( + currentRouteName(), + "login", + "it redirects them to login" + ); await click("#site-logo"); - assert.equal( + assert.strictEqual( currentRouteName(), "login", "clicking the logo keeps them on login" diff --git a/app/assets/javascripts/discourse/tests/acceptance/login-with-email-and-hide-email-address-taken-test.js b/app/assets/javascripts/discourse/tests/acceptance/login-with-email-and-hide-email-address-taken-test.js index fdb7114bf3a..f2264fd98b1 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/login-with-email-and-hide-email-address-taken-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/login-with-email-and-hide-email-address-taken-test.js @@ -21,7 +21,7 @@ acceptance("Login with email - hide email address taken", function (needs) { await fillIn("#login-account-name", "someuser@example.com"); await click("#email-login-link"); - assert.equal( + assert.strictEqual( queryAll(".alert-success").html().trim(), I18n.t("email_login.complete_email_found", { email: "someuser@example.com", diff --git a/app/assets/javascripts/discourse/tests/acceptance/login-with-email-test.js b/app/assets/javascripts/discourse/tests/acceptance/login-with-email-test.js index ad9edeeffac..b009495530d 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/login-with-email-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/login-with-email-test.js @@ -37,7 +37,7 @@ acceptance("Login with email", function (needs) { await fillIn("#login-account-name", "someuser"); await click("#email-login-link"); - assert.equal( + assert.strictEqual( queryAll(".alert-error").html(), I18n.t("email_login.complete_username_not_found", { username: "someuser", @@ -48,7 +48,7 @@ acceptance("Login with email", function (needs) { await fillIn("#login-account-name", "someuser@gmail.com"); await click("#email-login-link"); - assert.equal( + assert.strictEqual( queryAll(".alert-error").html(), I18n.t("email_login.complete_email_not_found", { email: "someuser@gmail.com", @@ -62,7 +62,7 @@ acceptance("Login with email", function (needs) { await click("#email-login-link"); - assert.equal( + assert.strictEqual( queryAll(".alert-success").html().trim(), I18n.t("email_login.complete_username_found", { username: "someuser" }), "it should display a success message for a valid username" @@ -73,7 +73,7 @@ acceptance("Login with email", function (needs) { await fillIn("#login-account-name", "someuser@gmail.com"); await click("#email-login-link"); - assert.equal( + assert.strictEqual( queryAll(".alert-success").html().trim(), I18n.t("email_login.complete_email_found", { email: "someuser@gmail.com", diff --git a/app/assets/javascripts/discourse/tests/acceptance/mobile-discovery-test.js b/app/assets/javascripts/discourse/tests/acceptance/mobile-discovery-test.js index 373896fe0d1..43be07e2f92 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/mobile-discovery-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/mobile-discovery-test.js @@ -13,7 +13,7 @@ acceptance("Topic Discovery - Mobile", function (needs) { assert.ok(exists(".topic-list"), "The list of topics was rendered"); assert.ok(exists(".topic-list .topic-list-item"), "has topics"); - assert.equal( + assert.strictEqual( queryAll("a[data-user-card=codinghorror] img.avatar").attr("loading"), "lazy", "it adds loading=`lazy` to topic list avatars" diff --git a/app/assets/javascripts/discourse/tests/acceptance/mobile-pan-test.js b/app/assets/javascripts/discourse/tests/acceptance/mobile-pan-test.js index 0aa70c8abe3..0c7b589afde 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/mobile-pan-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/mobile-pan-test.js @@ -108,7 +108,7 @@ acceptance("Mobile - menu swipes", function (needs) { await triggerSwipeMove(swipe); await triggerSwipeEnd(swipe); - assert.equal( + assert.strictEqual( count(".panel-body"), 1, "it should re-open hamburger on a right swipe" diff --git a/app/assets/javascripts/discourse/tests/acceptance/modal-test.js b/app/assets/javascripts/discourse/tests/acceptance/modal-test.js index 72ce0b2101f..08b193e9537 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/modal-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/modal-test.js @@ -36,20 +36,20 @@ acceptance("Modal", function (needs) { assert.ok(!exists(".d-modal:visible"), "there is no modal at first"); await click(".login-button"); - assert.equal(count(".d-modal:visible"), 1, "modal should appear"); + assert.strictEqual(count(".d-modal:visible"), 1, "modal should appear"); let controller = controllerFor("modal"); - assert.equal(controller.name, "login"); + assert.strictEqual(controller.name, "login"); await click(".modal-outer-container"); assert.ok( !exists(".d-modal:visible"), "modal should disappear when you click outside" ); - assert.equal(controller.name, null); + assert.strictEqual(controller.name, null); await click(".login-button"); - assert.equal(count(".d-modal:visible"), 1, "modal should reappear"); + assert.strictEqual(count(".d-modal:visible"), 1, "modal should reappear"); await triggerKeyEvent("#main-outlet", "keyup", 27); assert.ok(!exists(".d-modal:visible"), "ESC should close the modal"); @@ -60,16 +60,16 @@ acceptance("Modal", function (needs) { run(() => showModal("not-dismissable", {})); - assert.equal(count(".d-modal:visible"), 1, "modal should appear"); + assert.strictEqual(count(".d-modal:visible"), 1, "modal should appear"); await click(".modal-outer-container"); - assert.equal( + assert.strictEqual( count(".d-modal:visible"), 1, "modal should not disappear when you click outside" ); await triggerKeyEvent("#main-outlet", "keyup", 27); - assert.equal( + assert.strictEqual( count(".d-modal:visible"), 1, "ESC should not close the modal" @@ -86,7 +86,7 @@ acceptance("Modal", function (needs) { await visit("/"); run(() => showModal("test-raw-title-panels", { panels })); - assert.equal( + assert.strictEqual( queryAll(".d-modal .modal-tab:first-child").text().trim(), "Test 1", "it should display the raw title" @@ -102,7 +102,7 @@ acceptance("Modal", function (needs) { await visit("/"); run(() => showModal("test-title", { title: "test_title" })); - assert.equal( + assert.strictEqual( queryAll(".d-modal .title").text().trim(), "Test title", "it should display the title" @@ -111,7 +111,7 @@ acceptance("Modal", function (needs) { await click(".d-modal .close"); run(() => showModal("test-title-with-body", { title: "test_title" })); - assert.equal( + assert.strictEqual( queryAll(".d-modal .title").text().trim(), "Test title", "it should display the title when used with d-modal-body" @@ -136,12 +136,12 @@ acceptance("Modal Keyboard Events", function (needs) { await click(".admin-topic-timer-update button"); await triggerKeyEvent(".d-modal", "keydown", 13); - assert.equal( + assert.strictEqual( count("#modal-alert:visible"), 1, "hitting Enter triggers modal action" ); - assert.equal( + assert.strictEqual( count(".d-modal:visible"), 1, "hitting Enter does not dismiss modal due to alert error" diff --git a/app/assets/javascripts/discourse/tests/acceptance/new-message-test.js b/app/assets/javascripts/discourse/tests/acceptance/new-message-test.js index 96ffed16843..9ecd8abb17d 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/new-message-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/new-message-test.js @@ -26,19 +26,19 @@ acceptance("New Message - Authenticated", function (needs) { ); assert.ok(exists(".composer-fields"), "it opens composer"); - assert.equal( + assert.strictEqual( queryAll("#reply-title").val().trim(), "message title", "it pre-fills message title" ); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().trim(), "message body", "it pre-fills message body" ); const privateMessageUsers = selectKit("#private-message-users"); - assert.equal( + assert.strictEqual( privateMessageUsers.header().value(), "charlie", "it selects correct username" diff --git a/app/assets/javascripts/discourse/tests/acceptance/new-topic-test.js b/app/assets/javascripts/discourse/tests/acceptance/new-topic-test.js index 1d5a9bdbf6c..311a91837d3 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/new-topic-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/new-topic-test.js @@ -23,19 +23,19 @@ acceptance("New Topic - Authenticated", function (needs) { ); assert.ok(exists(".composer-fields"), "it opens composer"); - assert.equal( + assert.strictEqual( queryAll("#reply-title").val().trim(), "topic title", "it pre-fills topic title" ); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().trim(), "topic body", "it pre-fills topic body" ); - assert.equal( + assert.strictEqual( selectKit(".category-chooser").header().value(), - 1, + "1", "it selects desired category" ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/notifications-test.js b/app/assets/javascripts/discourse/tests/acceptance/notifications-test.js index 3eda729a3bc..c1571cdcf8c 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/notifications-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/notifications-test.js @@ -36,7 +36,7 @@ acceptance("User Notifications", function (needs) { await visit("/"); // wait for re-render - assert.equal(count("#quick-access-notifications li"), 6); + assert.strictEqual(count("#quick-access-notifications li"), 6); // high priority, unread notification - should be first @@ -80,8 +80,8 @@ acceptance("User Notifications", function (needs) { await visit("/"); // wait for re-render - assert.equal(count("#quick-access-notifications li"), 6); - assert.equal( + assert.strictEqual(count("#quick-access-notifications li"), 6); + assert.strictEqual( query("#quick-access-notifications li span[data-topic-id]").innerText, "First notification" ); @@ -129,8 +129,8 @@ acceptance("User Notifications", function (needs) { await visit("/"); // wait for re-render - assert.equal(count("#quick-access-notifications li"), 7); - assert.equal( + assert.strictEqual(count("#quick-access-notifications li"), 7); + assert.strictEqual( queryAll("#quick-access-notifications li span[data-topic-id]")[1] .innerText, "Second notification" @@ -179,7 +179,7 @@ acceptance("User Notifications", function (needs) { }); await visit("/"); // wait for re-render - assert.equal(count("#quick-access-notifications li"), 8); + assert.strictEqual(count("#quick-access-notifications li"), 8); const texts = []; queryAll("#quick-access-notifications li").each((_, el) => texts.push(el.innerText.trim()) diff --git a/app/assets/javascripts/discourse/tests/acceptance/opengraph-tag-updater-test.js b/app/assets/javascripts/discourse/tests/acceptance/opengraph-tag-updater-test.js index ab3a72e1e98..622c183a710 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/opengraph-tag-updater-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/opengraph-tag-updater-test.js @@ -14,7 +14,7 @@ acceptance("Opengraph Tag Updater", function (needs) { await click("#toggle-hamburger-menu"); await click("a.about-link"); - assert.equal( + assert.strictEqual( document .querySelector("meta[property='og:title']") .getAttribute("content"), diff --git a/app/assets/javascripts/discourse/tests/acceptance/personal-message-test.js b/app/assets/javascripts/discourse/tests/acceptance/personal-message-test.js index 1558b244eed..c7f705c1820 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/personal-message-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/personal-message-test.js @@ -22,7 +22,7 @@ acceptance("Personal Message", function (needs) { test("suggested messages", async function (assert) { await visit("/t/pm-for-testing/12"); - assert.equal( + assert.strictEqual( queryAll("#suggested-topics .suggested-topics-title").text().trim(), I18n.t("suggested_topics.pm_title") ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-keyboard-shortcut-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-keyboard-shortcut-test.js index b2831ec7d00..591942331f8 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/plugin-keyboard-shortcut-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/plugin-keyboard-shortcut-test.js @@ -22,7 +22,7 @@ acceptance("Plugin Keyboard Shortcuts - Logged In", function (needs) { await visit("/t/this-is-a-test-topic/9"); await triggerKeyEvent(document, "keypress", "]".charCodeAt(0)); - assert.equal( + assert.strictEqual( $("#added-element").length, 1, "the keyboard shortcut callback fires successfully" diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-connector-class-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-connector-class-test.js index e69156dd531..824152bffd0 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-connector-class-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-connector-class-test.js @@ -70,7 +70,7 @@ acceptance("Plugin Outlet - Connector Class", function (needs) { test("Renders a template into the outlet", async function (assert) { await visit("/u/eviltrout"); - assert.equal( + assert.strictEqual( count(".user-profile-primary-outlet.hello"), 1, "it has class names" @@ -81,14 +81,14 @@ acceptance("Plugin Outlet - Connector Class", function (needs) { ); await click(".say-hello"); - assert.equal( + assert.strictEqual( queryAll(".hello-result").text(), "hello!", "actions delegate properly" ); await click(".say-hi"); - assert.equal( + assert.strictEqual( queryAll(".hi-result").text(), "hi!", "actions delegate properly" diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-decorator-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-decorator-test.js index 99f0e800c8e..8ed094ef2ba 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-decorator-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-decorator-test.js @@ -52,8 +52,8 @@ acceptance("Plugin Outlet - Decorator", function (needs) { )[0]; assert.ok(exists(fooConnector)); - assert.equal(fooConnector.style.backgroundColor, "yellow"); - assert.equal(barConnector.style.backgroundColor, ""); + assert.strictEqual(fooConnector.style.backgroundColor, "yellow"); + assert.strictEqual(barConnector.style.backgroundColor, ""); await visit("/c/bug"); diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-multi-template-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-multi-template-test.js index ae0e298abff..4299f3d1b10 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-multi-template-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-multi-template-test.js @@ -27,22 +27,22 @@ acceptance("Plugin Outlet - Multi Template", function (needs) { test("Renders a template into the outlet", async function (assert) { await visit("/u/eviltrout"); - assert.equal( + assert.strictEqual( count(".user-profile-primary-outlet.hello"), 1, "it has class names" ); - assert.equal( + assert.strictEqual( count(".user-profile-primary-outlet.goodbye"), 1, "it has class names" ); - assert.equal( + assert.strictEqual( queryAll(".hello-span").text(), "Hello", "it renders into the outlet" ); - assert.equal( + assert.strictEqual( queryAll(".bye-span").text(), "Goodbye", "it renders into the outlet" diff --git a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-single-template-test.js b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-single-template-test.js index 27fc2e74439..2330dd2a565 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-single-template-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/plugin-outlet-single-template-test.js @@ -23,12 +23,12 @@ acceptance("Plugin Outlet - Single Template", function (needs) { test("Renders a template into the outlet", async function (assert) { await visit("/u/eviltrout"); - assert.equal( + assert.strictEqual( count(".user-profile-primary-outlet.hello"), 1, "it has class names" ); - assert.equal( + assert.strictEqual( queryAll(".hello-username").text(), "eviltrout", "it renders into the outlet" diff --git a/app/assets/javascripts/discourse/tests/acceptance/preferences-test.js b/app/assets/javascripts/discourse/tests/acceptance/preferences-test.js index d0b2d9029e6..9508547b5ad 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/preferences-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/preferences-test.js @@ -82,7 +82,7 @@ acceptance("User Preferences", function (needs) { await visit("/u/eviltrout/preferences"); assert.ok($("body.user-preferences-page").length, "has the body class"); - assert.equal( + assert.strictEqual( currentURL(), "/u/eviltrout/preferences/account", "defaults to account tab" @@ -151,7 +151,7 @@ acceptance("User Preferences", function (needs) { await fillIn("#change-email", "invalidemail"); - assert.equal( + assert.strictEqual( queryAll(".tip.bad").text().trim(), I18n.t("user.email.invalid"), "it should display invalid email tip" @@ -252,7 +252,7 @@ acceptance("User Preferences", function (needs) { await click(".avatar-selector-refresh-gravatar"); - assert.equal( + assert.strictEqual( User.currentProp("gravatar_avatar_upload_id"), 6543, "it should set the gravatar_avatar_upload_id property" @@ -327,7 +327,7 @@ acceptance("User Preferences when badges are disabled", function (needs) { test("visit my preferences", async function (assert) { await visit("/u/eviltrout/preferences"); assert.ok($("body.user-preferences-page").length, "has the body class"); - assert.equal( + assert.strictEqual( currentURL(), "/u/eviltrout/preferences/account", "defaults to account tab" @@ -418,7 +418,7 @@ acceptance("Custom User Fields", function (needs) { ); await field.expand(); await field.selectRowByValue("Cat"); - assert.equal( + assert.strictEqual( field.header().value(), "Cat", "it sets the value of the field" @@ -444,7 +444,7 @@ acceptance( await click(".save-changes"); await visit("/"); assert.ok(exists(".topic-list"), "The list of topics was rendered"); - assert.equal( + assert.strictEqual( currentRouteName(), "discovery.bookmarks", "it navigates to bookmarks" @@ -487,7 +487,7 @@ acceptance("Security", function (needs) { test("recently connected devices", async function (assert) { await visit("/u/eviltrout/preferences/security"); - assert.equal( + assert.strictEqual( queryAll(".auth-tokens > .auth-token:nth-of-type(1) .auth-token-device") .text() .trim(), @@ -495,12 +495,12 @@ acceptance("Security", function (needs) { "it should display active token first" ); - assert.equal( + assert.strictEqual( queryAll(".pref-auth-tokens > a:nth-of-type(1)").text().trim(), I18n.t("user.auth_tokens.show_all", { count: 3 }), "it should display two tokens" ); - assert.equal( + assert.strictEqual( count(".pref-auth-tokens .auth-token"), 2, "it should display two tokens" @@ -508,7 +508,7 @@ acceptance("Security", function (needs) { await click(".pref-auth-tokens > a:nth-of-type(1)"); - assert.equal( + assert.strictEqual( count(".pref-auth-tokens .auth-token"), 3, "it should display three tokens" @@ -518,11 +518,11 @@ acceptance("Security", function (needs) { await authTokenDropdown.expand(); await authTokenDropdown.selectRowByValue("notYou"); - assert.equal(count(".d-modal:visible"), 1, "modal should appear"); + assert.strictEqual(count(".d-modal:visible"), 1, "modal should appear"); await click(".modal-footer .btn-primary"); - assert.equal( + assert.strictEqual( count(".pref-password.highlighted"), 1, "it should highlight password preferences" @@ -543,7 +543,7 @@ acceptance( await visit("/u/staged/preferences"); assert.ok($("body.user-preferences-page").length, "has the body class"); - assert.equal( + assert.strictEqual( currentURL(), "/u/staged/preferences/account", "defaults to account tab" diff --git a/app/assets/javascripts/discourse/tests/acceptance/raw-plugin-outlet-test.js b/app/assets/javascripts/discourse/tests/acceptance/raw-plugin-outlet-test.js index ba6465bf713..db37d71a40e 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/raw-plugin-outlet-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/raw-plugin-outlet-test.js @@ -28,7 +28,7 @@ acceptance("Raw Plugin Outlet", function (needs) { test("Renders the raw plugin outlet", async function (assert) { await visit("/"); assert.ok(exists(".topic-lala"), "it renders the outlet"); - assert.equal( + assert.strictEqual( query(".topic-lala:nth-of-type(1)").innerText, "11557", "it has the topic id" diff --git a/app/assets/javascripts/discourse/tests/acceptance/redirect-to-top-test.js b/app/assets/javascripts/discourse/tests/acceptance/redirect-to-top-test.js index 71e2279743b..8774ebf8e4c 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/redirect-to-top-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/redirect-to-top-test.js @@ -30,7 +30,11 @@ acceptance("Redirect to Top", function (needs) { }); await visit("/categories"); - assert.equal(currentURL(), "/top?period=weekly", "it works for categories"); + assert.strictEqual( + currentURL(), + "/top?period=weekly", + "it works for categories" + ); }); test("redirects latest to monthly top", async function (assert) { @@ -43,7 +47,11 @@ acceptance("Redirect to Top", function (needs) { }); await visit("/latest"); - assert.equal(currentURL(), "/top?period=monthly", "it works for latest"); + assert.strictEqual( + currentURL(), + "/top?period=monthly", + "it works for latest" + ); }); test("redirects root to All top", async function (assert) { @@ -56,6 +64,6 @@ acceptance("Redirect to Top", function (needs) { }); await visit("/"); - assert.equal(currentURL(), "/top?period=all", "it works for root"); + assert.strictEqual(currentURL(), "/top?period=all", "it works for root"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/reports-test.js b/app/assets/javascripts/discourse/tests/acceptance/reports-test.js index 14928dafe2d..38d766f14cb 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/reports-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/reports-test.js @@ -8,13 +8,16 @@ acceptance("Reports", function (needs) { test("Visit reports page", async function (assert) { await visit("/admin/reports"); - assert.equal($(".reports-list .report").length, 1); + assert.strictEqual($(".reports-list .report").length, 1); const $report = $(".reports-list .report:first-child"); - assert.equal($report.find(".report-title").html().trim(), "My report"); + assert.strictEqual( + $report.find(".report-title").html().trim(), + "My report" + ); - assert.equal( + assert.strictEqual( $report.find(".report-description").html().trim(), "List of my activities" ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/review-test.js b/app/assets/javascripts/discourse/tests/acceptance/review-test.js index e4711c964ad..af0fba8465e 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/review-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/review-test.js @@ -94,12 +94,12 @@ acceptance("Review", function (needs) { "it has a link to the user" ); - assert.equal( + assert.strictEqual( queryAll(".reviewable-flagged-post .post-body").html().trim(), "cooked content" ); - assert.equal(count(".reviewable-flagged-post .reviewable-score"), 2); + assert.strictEqual(count(".reviewable-flagged-post .reviewable-score"), 2); }); test("Flag related", async function (assert) { @@ -119,16 +119,16 @@ acceptance("Review", function (needs) { await visit("/review"); assert.ok(exists(`${topic} .reviewable-action.approve`)); assert.ok(!exists(`${topic} .category-name`)); - assert.equal( + assert.strictEqual( queryAll(`${topic} .discourse-tag:nth-of-type(1)`).text(), "hello" ); - assert.equal( + assert.strictEqual( queryAll(`${topic} .discourse-tag:nth-of-type(2)`).text(), "world" ); - assert.equal( + assert.strictEqual( queryAll(`${topic} .post-body`).text().trim(), "existing body" ); @@ -148,7 +148,7 @@ acceptance("Review", function (needs) { await fillIn(".editable-field.payload-raw textarea", "new raw contents"); await click(`${topic} .reviewable-action.cancel-edit`); - assert.equal( + assert.strictEqual( queryAll(`${topic} .post-body`).text().trim(), "existing body", "cancelling does not update the value" @@ -167,24 +167,27 @@ acceptance("Review", function (needs) { await fillIn(".editable-field.payload-raw textarea", "new raw contents"); await click(`${topic} .reviewable-action.save-edit`); - assert.equal( + assert.strictEqual( queryAll(`${topic} .discourse-tag:nth-of-type(1)`).text(), "hello" ); - assert.equal( + assert.strictEqual( queryAll(`${topic} .discourse-tag:nth-of-type(2)`).text(), "world" ); - assert.equal( + assert.strictEqual( queryAll(`${topic} .discourse-tag:nth-of-type(3)`).text(), "monkey" ); - assert.equal( + assert.strictEqual( queryAll(`${topic} .post-body`).text().trim(), "new raw contents" ); - assert.equal(queryAll(`${topic} .category-name`).text().trim(), "support"); + assert.strictEqual( + queryAll(`${topic} .category-name`).text().trim(), + "support" + ); }); test("Reviewables can become stale", async function (assert) { @@ -192,7 +195,10 @@ acceptance("Review", function (needs) { const reviewable = query(`[data-reviewable-id="1234"]`); assert.notOk(reviewable.className.includes("reviewable-stale")); - assert.equal(count(`[data-reviewable-id="1234"] .status .pending`), 1); + assert.strictEqual( + count(`[data-reviewable-id="1234"] .status .pending`), + 1 + ); assert.ok(!exists(".stale-help")); publishToMessageBus("/reviewable_counts", { @@ -205,13 +211,13 @@ acceptance("Review", function (needs) { await visit("/review"); // wait for re-render assert.ok(reviewable.className.includes("reviewable-stale")); - assert.equal(count("[data-reviewable-id=1234] .status .approved"), 1); - assert.equal(count(".stale-help"), 1); + assert.strictEqual(count("[data-reviewable-id=1234] .status .approved"), 1); + assert.strictEqual(count(".stale-help"), 1); assert.ok(query(".stale-help").innerText.includes("foo")); await visit("/"); await visit("/review"); // reload review - assert.equal(count(".stale-help"), 0); + assert.strictEqual(count(".stale-help"), 0); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js index 277fb778401..d7263776c40 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/search-full-test.js @@ -111,7 +111,7 @@ acceptance("Search - Full Page", function (needs) { await fillIn(".search-query", "discourse"); await click(".search-cta"); - assert.equal(count(".fps-topic"), 1, "has one post"); + assert.strictEqual(count(".fps-topic"), 1, "has one post"); }); test("search for personal messages", async function (assert) { @@ -120,15 +120,15 @@ acceptance("Search - Full Page", function (needs) { await fillIn(".search-query", "discourse in:personal"); await click(".search-cta"); - assert.equal(count(".fps-topic"), 1, "has one post"); + assert.strictEqual(count(".fps-topic"), 1, "has one post"); - assert.equal( + assert.strictEqual( count(".topic-status .personal_message"), 1, "shows the right icon" ); - assert.equal(count(".search-highlight"), 1, "search highlights work"); + assert.strictEqual(count(".search-highlight"), 1, "search highlights work"); }); test("escape search term", async function (assert) { @@ -174,7 +174,7 @@ acceptance("Search - Full Page", function (needs) { exists('.search-advanced-options span:contains("admin")'), 'has "admin" pre-populated' ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "none @admin", 'has updated search term to "none user:admin"' @@ -199,7 +199,7 @@ acceptance("Search - Full Page", function (needs) { exists('.search-advanced-options .badge-category:contains("faq")'), 'has "faq" populated' ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "none #faq", 'has updated search term to "none #faq"' @@ -223,7 +223,7 @@ acceptance("Search - Full Page", function (needs) { exists('.search-advanced-options .badge-category:contains("快乐的")'), 'has "快乐的" populated' ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "none category:240", 'has updated search term to "none category:240"' @@ -239,7 +239,7 @@ acceptance("Search - Full Page", function (needs) { exists(".search-advanced-options .in-title:checked"), 'has "in title" populated' ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "none in:title", 'has updated search term to "none in:title"' @@ -262,7 +262,7 @@ acceptance("Search - Full Page", function (needs) { exists(".search-advanced-options .in-likes:checked"), 'has "I liked" populated' ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "none in:likes", 'has updated search term to "none in:likes"' @@ -279,7 +279,7 @@ acceptance("Search - Full Page", function (needs) { 'has "are in my messages" populated' ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "none in:personal", 'has updated search term to "none in:personal"' @@ -303,7 +303,7 @@ acceptance("Search - Full Page", function (needs) { "it should check the right checkbox" ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "none in:seen", "it should update the search term" @@ -326,12 +326,12 @@ acceptance("Search - Full Page", function (needs) { await inSelector.expand(); await inSelector.selectRowByValue("bookmarks"); - assert.equal( + assert.strictEqual( inSelector.header().label(), "I bookmarked", 'has "I bookmarked" populated' ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "none in:bookmarks", 'has updated search term to "none in:bookmarks"' @@ -349,12 +349,12 @@ acceptance("Search - Full Page", function (needs) { await statusSelector.expand(); await statusSelector.selectRowByValue("closed"); - assert.equal( + assert.strictEqual( statusSelector.header().label(), "are closed", 'has "are closed" populated' ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "none status:closed", 'has updated search term to "none status:closed"' @@ -370,7 +370,11 @@ acceptance("Search - Full Page", function (needs) { await fillIn(".search-query", "status:none"); - assert.equal(statusSelector.header().label(), "any", 'has "any" populated'); + assert.strictEqual( + statusSelector.header().label(), + "any", + 'has "any" populated' + ); }); test("doesn't update in filter header if wrong value entered through searchbox", async function (assert) { @@ -380,13 +384,17 @@ acceptance("Search - Full Page", function (needs) { await fillIn(".search-query", "in:none"); - assert.equal(inSelector.header().label(), "any", 'has "any" populated'); + assert.strictEqual( + inSelector.header().label(), + "any", + 'has "any" populated' + ); }); test("update post time through advanced search ui", async function (assert) { await visit("/search?expanded=true&q=after:2018-08-22"); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "after:2018-08-22", "it should update the search term correctly" @@ -403,13 +411,13 @@ acceptance("Search - Full Page", function (needs) { await postTimeSelector.expand(); await postTimeSelector.selectRowByValue("after"); - assert.equal( + assert.strictEqual( postTimeSelector.header().label(), "after", 'has "after" populated' ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "none after:2016-10-05", 'has updated search term to "none after:2016-10-05"' @@ -421,14 +429,14 @@ acceptance("Search - Full Page", function (needs) { await fillIn(".search-query", "none"); await fillIn("#search-min-post-count", "5"); - assert.equal( + assert.strictEqual( queryAll( ".search-advanced-additional-options #search-min-post-count" ).val(), "5", 'has "5" populated' ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "none min_posts:5", 'has updated search term to "none min_posts:5"' @@ -440,14 +448,14 @@ acceptance("Search - Full Page", function (needs) { await fillIn(".search-query", "none"); await fillIn("#search-max-post-count", "5"); - assert.equal( + assert.strictEqual( queryAll( ".search-advanced-additional-options #search-max-post-count" ).val(), "5", 'has "5" populated' ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "none max_posts:5", 'has updated search term to "none max_posts:5"' @@ -463,7 +471,7 @@ acceptance("Search - Full Page", function (needs) { 'has "I liked" populated' ); - assert.equal( + assert.strictEqual( queryAll(".search-query").val(), "in:likes", 'has updated search term to "in:likes"' @@ -506,7 +514,7 @@ acceptance("Search - Full Page", function (needs) { await click(".search-cta"); - assert.equal(count(".fps-user-item"), 1, "has one user result"); + assert.strictEqual(count(".fps-user-item"), 1, "has one user result"); await typeSelector.expand(); await typeSelector.selectRowByValue(SEARCH_TYPE_DEFAULT); @@ -531,7 +539,7 @@ acceptance("Search - Full Page", function (needs) { await click(".search-cta"); assert.ok(!exists(".search-filters"), "has no filters"); - assert.equal(count(".fps-tag-item"), 2, "has two tag results"); + assert.strictEqual(count(".fps-tag-item"), 2, "has two tag results"); await typeSelector.expand(); await typeSelector.selectRowByValue(SEARCH_TYPE_DEFAULT); diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js index 14063d57505..81587214c9a 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/search-mobile-test.js @@ -33,7 +33,7 @@ acceptance("Search - Mobile", function (needs) { await fillIn(".search-query", "discourse"); await click(".search-cta"); - assert.equal(count(".fps-topic"), 1, "has one post"); + assert.strictEqual(count(".fps-topic"), 1, "has one post"); assert.ok( !visible(".search-advanced-filters"), @@ -42,7 +42,7 @@ acceptance("Search - Mobile", function (needs) { await click("#search-button"); - assert.equal( + assert.strictEqual( queryAll("input.full-page-search").val(), "discourse", "it does not reset input when hitting search icon again" diff --git a/app/assets/javascripts/discourse/tests/acceptance/search-test.js b/app/assets/javascripts/discourse/tests/acceptance/search-test.js index 673430067a3..2f205413bf3 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/search-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/search-test.js @@ -63,7 +63,7 @@ acceptance("Search - Anonymous", function (needs) { "quick tip no longer shown" ); - assert.equal( + assert.strictEqual( query( ".search-menu .results ul.search-menu-initial-options li:first-child .search-item-slug" ).innerText.trim(), @@ -95,7 +95,7 @@ acceptance("Search - Anonymous", function (needs) { await click(".show-advanced-search"); - assert.equal( + assert.strictEqual( query(".full-page-search").value, "dev", "it goes to full search page and preserves the search term" @@ -130,7 +130,7 @@ acceptance("Search - Anonymous", function (needs) { await visit("/tag/important"); await click("#search-button"); - assert.equal( + assert.strictEqual( query(firstResult).textContent.trim(), `${I18n.t("search.in")} test`, "contenxtual tag search is first available option with no term" @@ -138,7 +138,7 @@ acceptance("Search - Anonymous", function (needs) { await fillIn("#search-term", "smth"); - assert.equal( + assert.strictEqual( query(firstResult).textContent.trim(), `smth ${I18n.t("search.in")} test`, "tag-scoped search is first available option" @@ -147,7 +147,7 @@ acceptance("Search - Anonymous", function (needs) { await visit("/c/bug"); await click("#search-button"); - assert.equal( + assert.strictEqual( query(firstResult).textContent.trim(), `smth ${I18n.t("search.in")} bug`, "category-scoped search is first available option" @@ -161,7 +161,7 @@ acceptance("Search - Anonymous", function (needs) { await visit("/t/internationalization-localization/280"); await click("#search-button"); - assert.equal( + assert.strictEqual( query(firstResult).textContent.trim(), `smth ${I18n.t("search.in_this_topic")}`, "topic-scoped search is first available option" @@ -170,7 +170,7 @@ acceptance("Search - Anonymous", function (needs) { await visit("/u/eviltrout"); await click("#search-button"); - assert.equal( + assert.strictEqual( query(firstResult).textContent.trim(), `smth ${I18n.t("search.in_posts_by", { username: "eviltrout", @@ -187,7 +187,7 @@ acceptance("Search - Anonymous", function (needs) { const firstResult = ".search-menu .results .search-menu-assistant-item:first-child"; - assert.equal( + assert.strictEqual( query(firstResult).textContent.trim(), I18n.t("search.in_this_topic"), "contenxtual topic search is first available option" @@ -203,7 +203,7 @@ acceptance("Search - Anonymous", function (needs) { "clicking first option formats results as posts" ); - assert.equal( + assert.strictEqual( query("#post_7 span.highlighted").textContent.trim(), "a proper", "highlights the post correctly" @@ -214,7 +214,7 @@ acceptance("Search - Anonymous", function (needs) { "search context indicator is visible" ); await click(".clear-search"); - assert.equal(query("#search-term").value, "", "clear button works"); + assert.strictEqual(query("#search-term").value, "", "clear button works"); await click(".search-context"); @@ -249,9 +249,9 @@ acceptance("Search - Anonymous", function (needs) { await click("#search-button"); await fillIn("#search-term", "@admin"); - assert.equal(count(".search-menu-assistant-item"), 2); + assert.strictEqual(count(".search-menu-assistant-item"), 2); - assert.equal( + assert.strictEqual( query( ".search-menu-assistant-item:first-child .search-item-user .label-suffix" ).textContent.trim(), @@ -259,7 +259,7 @@ acceptance("Search - Anonymous", function (needs) { "first result hints in this topic search" ); - assert.equal( + assert.strictEqual( query( ".search-menu-assistant-item:nth-child(2) .search-item-user .label-suffix" ).textContent.trim(), @@ -358,13 +358,13 @@ acceptance("Search - Authenticated", function (needs) { await triggerKeyEvent(".search-menu", "keydown", 40); await click(document.activeElement); - assert.notEqual(count(".search-menu .results .item"), 0); + assert.notStrictEqual(count(".search-menu .results .item"), 0); await fillIn("#search-term", "plans empty"); await triggerKeyEvent("#search-term", "keydown", 13); - assert.equal(count(".search-menu .results .item"), 0); - assert.equal(count(".search-menu .results .no-results"), 1); + assert.strictEqual(count(".search-menu .results .item"), 0); + assert.strictEqual(count(".search-menu .results .no-results"), 1); }); test("search dropdown keyboard navigation", async function (assert) { @@ -389,7 +389,7 @@ acceptance("Search - Authenticated", function (needs) { await triggerKeyEvent("#search-term", "keydown", keyArrowDown); - assert.equal( + assert.strictEqual( document.activeElement.getAttribute("href"), query(`${container} li:first-child a`).getAttribute("href"), "arrow down selects first element" @@ -397,7 +397,7 @@ acceptance("Search - Authenticated", function (needs) { await triggerKeyEvent("#search-term", "keydown", keyArrowDown); - assert.equal( + assert.strictEqual( document.activeElement.getAttribute("href"), query(`${container} li:nth-child(2) a`).getAttribute("href"), "arrow down selects next element" @@ -408,7 +408,7 @@ acceptance("Search - Authenticated", function (needs) { await triggerKeyEvent("#search-term", "keydown", keyArrowDown); await triggerKeyEvent("#search-term", "keydown", keyArrowDown); - assert.equal( + assert.strictEqual( document.activeElement.getAttribute("href"), "/search?q=dev", "arrow down sets focus to more results link" @@ -421,7 +421,7 @@ acceptance("Search - Authenticated", function (needs) { await triggerKeyEvent(".search-menu", "keydown", keyArrowDown); await triggerKeyEvent(".search-menu", "keydown", keyArrowUp); - assert.equal( + assert.strictEqual( document.activeElement.tagName.toLowerCase(), "input", "arrow up sets focus to search term input" @@ -437,7 +437,7 @@ acceptance("Search - Authenticated", function (needs) { ); await triggerKeyEvent(".search-menu", "keydown", keyA); - assert.equal( + assert.strictEqual( query("#reply-control textarea").value, `${window.location.origin}${firstLink}`, "hitting A when focused on a search result copies link to composer" @@ -455,7 +455,7 @@ acceptance("Search - with tagging enabled", function (needs) { await fillIn("#search-term", "dev"); await triggerKeyEvent("#search-term", "keydown", 13); - assert.equal( + assert.strictEqual( query( ".search-menu .results ul li:nth-of-type(1) .discourse-tags" ).textContent.trim(), @@ -477,7 +477,7 @@ acceptance("Search - with tagging enabled", function (needs) { assert.ok(exists(query(firstItem))); const firstTag = query(`${firstItem} .search-item-tag`).textContent.trim(); - assert.equal(firstTag, "monkey"); + assert.strictEqual(firstTag, "monkey"); }); }); @@ -528,13 +528,13 @@ acceptance("Search - assistant", function (needs) { ).textContent.trim(); await click(firstCategory); - assert.equal(query("#search-term").value, `#${firstResultSlug}`); + assert.strictEqual(query("#search-term").value, `#${firstResultSlug}`); await fillIn("#search-term", "sam #"); await triggerKeyEvent("#search-term", "keyup", 51); assert.ok(exists(query(firstCategory))); - assert.equal( + assert.strictEqual( query( ".search-menu .results ul.search-menu-assistant .search-item-prefix" ).innerText, @@ -542,7 +542,7 @@ acceptance("Search - assistant", function (needs) { ); await click(firstCategory); - assert.equal(query("#search-term").value, `sam #${firstResultSlug}`); + assert.strictEqual(query("#search-term").value, `sam #${firstResultSlug}`); }); test("shows in: shortcuts", async function (assert) { @@ -554,15 +554,15 @@ acceptance("Search - assistant", function (needs) { await fillIn("#search-term", "in:"); await triggerKeyEvent("#search-term", "keyup", 51); - assert.equal(query(firstTarget).innerText, "in:title"); + assert.strictEqual(query(firstTarget).innerText, "in:title"); await fillIn("#search-term", "sam in:"); await triggerKeyEvent("#search-term", "keyup", 51); - assert.equal(query(firstTarget).innerText, "sam in:title"); + assert.strictEqual(query(firstTarget).innerText, "sam in:title"); await fillIn("#search-term", "in:pers"); await triggerKeyEvent("#search-term", "keyup", 51); - assert.equal(query(firstTarget).innerText, "in:personal"); + assert.strictEqual(query(firstTarget).innerText, "in:personal"); }); test("shows users when typing @", async function (assert) { @@ -576,9 +576,9 @@ acceptance("Search - assistant", function (needs) { const firstUser = ".search-menu .results ul.search-menu-assistant .search-item-user"; const firstUsername = query(firstUser).innerText.trim(); - assert.equal(firstUsername, "TeaMoe"); + assert.strictEqual(firstUsername, "TeaMoe"); await click(query(firstUser)); - assert.equal(query("#search-term").value, `@${firstUsername}`); + assert.strictEqual(query("#search-term").value, `@${firstUsername}`); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js b/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js index 3b498dd35d3..f21315b6e85 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/shared-drafts-test.js @@ -10,9 +10,9 @@ import { test } from "qunit"; acceptance("Shared Drafts", function () { test("Viewing and publishing", async function (assert) { await visit("/t/some-topic/9"); - assert.equal(count(".shared-draft-controls"), 1); + assert.strictEqual(count(".shared-draft-controls"), 1); let categoryChooser = selectKit(".shared-draft-controls .category-chooser"); - assert.equal(categoryChooser.header().value(), "3"); + assert.strictEqual(categoryChooser.header().value(), "3"); await click(".publish-shared-draft"); await click(".bootbox .btn-primary"); @@ -22,7 +22,7 @@ acceptance("Shared Drafts", function () { test("Updating category", async function (assert) { await visit("/t/some-topic/9"); - assert.equal(count(".shared-draft-controls"), 1); + assert.strictEqual(count(".shared-draft-controls"), 1); await click(".edit-topic"); @@ -33,6 +33,6 @@ acceptance("Shared Drafts", function () { await click(".edit-controls .btn-primary"); categoryChooser = selectKit(".shared-draft-controls .category-chooser"); - assert.equal(categoryChooser.header().value(), "7"); + assert.strictEqual(categoryChooser.header().value(), "7"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js b/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js index 55c46a3e0b7..182abe9802b 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/sign-in-test.js @@ -40,14 +40,14 @@ acceptance("Signing In", function () { await fillIn("#login-account-name", "eviltrout"); await fillIn("#login-account-password", "not-activated"); await click(".modal-footer .btn-primary"); - assert.equal( + assert.strictEqual( queryAll(".modal-body b").text(), "eviltrout@example.com" ); assert.ok(!exists(".modal-body small"), "it escapes the email address"); await click(".modal-footer button.resend"); - assert.equal( + assert.strictEqual( queryAll(".modal-body b").text(), "current@example.com" ); @@ -63,8 +63,11 @@ acceptance("Signing In", function () { await fillIn("#login-account-password", "not-activated-edit"); await click(".modal-footer .btn-primary"); await click(".modal-footer button.edit-email"); - assert.equal(queryAll(".activate-new-email").val(), "current@example.com"); - assert.equal( + assert.strictEqual( + queryAll(".activate-new-email").val(), + "current@example.com" + ); + assert.strictEqual( count(".modal-footer .btn-primary:disabled"), 1, "must change email" @@ -72,7 +75,10 @@ acceptance("Signing In", function () { await fillIn(".activate-new-email", "different@example.com"); assert.ok(!exists(".modal-footer .btn-primary:disabled")); await click(".modal-footer .btn-primary"); - assert.equal(queryAll(".modal-body b").text(), "different@example.com"); + assert.strictEqual( + queryAll(".modal-body b").text(), + "different@example.com" + ); }); skip("second factor", async function (assert) { diff --git a/app/assets/javascripts/discourse/tests/acceptance/static-test.js b/app/assets/javascripts/discourse/tests/acceptance/static-test.js index 55fa797140f..4071f1b6204 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/static-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/static-test.js @@ -21,7 +21,7 @@ acceptance("Static", function () { assert.ok(exists(".body-page"), "The content is present"); await visit("/login"); - assert.equal( + assert.strictEqual( currentRouteName(), "discovery.latest", "it redirects them to latest unless `login_required`" diff --git a/app/assets/javascripts/discourse/tests/acceptance/tags-intersection-test.js b/app/assets/javascripts/discourse/tests/acceptance/tags-intersection-test.js index fe9be3e3724..2b62cbc4141 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/tags-intersection-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/tags-intersection-test.js @@ -35,7 +35,7 @@ acceptance("Tags intersection", function (needs) { await click("#create-topic"); assert.ok(exists(".mini-tag-chooser"), "The tag selector appears"); - assert.equal( + assert.strictEqual( $(".composer-fields .mini-tag-chooser").text().trim(), "first, second", "populates the tags when clicking 'New topic'" diff --git a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js b/app/assets/javascripts/discourse/tests/acceptance/tags-test.js index adc5277edb8..b37b8c26518 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/tags-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/tags-test.js @@ -191,7 +191,7 @@ acceptance("Tags listed by group", function (needs) { test("list the tags in groups", async function (assert) { await visit("/tags"); - assert.equal( + assert.strictEqual( $(".tag-list").length, 4, "shows separate lists for the 3 groups and the ungrouped tags" @@ -223,7 +223,7 @@ acceptance("Tags listed by group", function (needs) { ["/tag/focus", "/tag/escort"], "always uses lowercase URLs for mixed case tags" ); - assert.equal( + assert.strictEqual( $("a[data-tag-name='private']").attr("href"), "/u/eviltrout/messages/tags/private", "links to private messages" @@ -237,7 +237,7 @@ acceptance("Tags listed by group", function (needs) { assert.ok(!exists("#create-topic:disabled")); await visit("/tag/staff-only-tag"); - assert.equal(count("#create-topic:disabled"), 1); + assert.strictEqual(count("#create-topic:disabled"), 1); updateCurrentUser({ moderator: true }); @@ -384,7 +384,7 @@ acceptance("Tag info", function (needs) { updateCurrentUser({ moderator: false, admin: false }); await visit("/tag/planters"); - assert.equal(count("#show-tag-info"), 1); + assert.strictEqual(count("#show-tag-info"), 1); await click("#show-tag-info"); assert.ok(exists(".tag-info .tag-name"), "show tag"); @@ -392,12 +392,16 @@ acceptance("Tag info", function (needs) { queryAll(".tag-info .tag-associations").text().indexOf("Gardening") >= 0, "show tag group names" ); - assert.equal( + assert.strictEqual( count(".tag-info .synonyms-list .tag-box"), 2, "shows the synonyms" ); - assert.equal(count(".tag-info .badge-category"), 1, "show the category"); + assert.strictEqual( + count(".tag-info .badge-category"), + 1, + "show the category" + ); assert.ok(!exists("#rename-tag"), "can't rename tag"); assert.ok(!exists("#edit-synonyms"), "can't edit synonyms"); assert.ok(!exists("#delete-tag"), "can't delete tag"); @@ -407,7 +411,7 @@ acceptance("Tag info", function (needs) { updateCurrentUser({ moderator: false, admin: true }); await visit("/tag/happy-monkey"); - assert.equal(count("#show-tag-info"), 1); + assert.strictEqual(count("#show-tag-info"), 1); await click("#show-tag-info"); assert.ok(exists(".tag-info .tag-name"), "show tag"); @@ -431,14 +435,14 @@ acceptance("Tag info", function (needs) { await click(".category-breadcrumb .category-drop-header"); await click('.category-breadcrumb .category-row[data-name="faq"]'); - assert.equal(currentURL(), "/tags/c/faq/4/planters"); + assert.strictEqual(currentURL(), "/tags/c/faq/4/planters"); }); test("admin can manage tags", async function (assert) { updateCurrentUser({ moderator: false, admin: true }); await visit("/tag/planters"); - assert.equal(count("#show-tag-info"), 1); + assert.strictEqual(count("#show-tag-info"), 1); await click("#show-tag-info"); assert.ok(exists("#rename-tag"), "can rename tag"); @@ -447,10 +451,14 @@ acceptance("Tag info", function (needs) { await click("#edit-synonyms"); assert.ok(count(".unlink-synonym:visible"), 2, "unlink UI is visible"); - assert.equal(count(".delete-synonym:visible"), 2, "delete UI is visible"); + assert.strictEqual( + count(".delete-synonym:visible"), + 2, + "delete UI is visible" + ); await click(".unlink-synonym:nth-of-type(1)"); - assert.equal( + assert.strictEqual( count(".tag-info .synonyms-list .tag-box"), 1, "removed a synonym" @@ -461,6 +469,6 @@ acceptance("Tag info", function (needs) { await visit("/tag/planters"); await click("#create-topic"); let composer = this.owner.lookup("controller:composer"); - assert.equal(composer.get("model").tags, null); + assert.strictEqual(composer.get("model").tags, undefined); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-admin-menu-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-admin-menu-test.js index cba99e8f8f7..bcfcac2ae6d 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-admin-menu-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-admin-menu-test.js @@ -51,7 +51,7 @@ acceptance("Topic - Admin Menu", function (needs) { assert.ok(exists("#topic"), "The topic was rendered"); await click(".toggle-admin-menu"); - assert.equal( + assert.strictEqual( document.activeElement, document.querySelector(".topic-admin-multi-select > button") ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js index 3002c1024e6..0f7ad82e52e 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-discovery-test.js @@ -21,13 +21,13 @@ acceptance("Topic Discovery", function (needs) { assert.ok(exists(".topic-list"), "The list of topics was rendered"); assert.ok(exists(".topic-list .topic-list-item"), "has topics"); - assert.equal( + assert.strictEqual( queryAll("a[data-user-card=eviltrout] img.avatar").attr("title"), "Evil Trout - Most Posts", "it shows user's full name in avatar title" ); - assert.equal( + assert.strictEqual( queryAll("a[data-user-card=eviltrout] img.avatar").attr("loading"), "lazy", "it adds loading=`lazy` to topic list avatars" diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js index 6614ed59420..2ef5bc385cb 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-edit-timer-test.js @@ -133,8 +133,8 @@ acceptance("Topic - Edit timer", function (needs) { await timerType.expand(); await timerType.selectRowByValue("publish_to_category"); - assert.equal(categoryChooser.header().label(), "uncategorized"); - assert.equal(categoryChooser.header().value(), null); + assert.strictEqual(categoryChooser.header().label(), "uncategorized"); + assert.strictEqual(categoryChooser.header().value(), null); await categoryChooser.expand(); await categoryChooser.selectRowByValue("7"); @@ -157,7 +157,7 @@ acceptance("Topic - Edit timer", function (needs) { } ); - assert.equal(text, el.innerText); + assert.strictEqual(text, el.innerText); }); test("schedule publish to category - visible for a private category", async function (assert) { @@ -173,8 +173,8 @@ acceptance("Topic - Edit timer", function (needs) { await timerType.expand(); await timerType.selectRowByValue("publish_to_category"); - assert.equal(categoryChooser.header().label(), "uncategorized"); - assert.equal(categoryChooser.header().value(), null); + assert.strictEqual(categoryChooser.header().label(), "uncategorized"); + assert.strictEqual(categoryChooser.header().value(), null); await categoryChooser.expand(); await categoryChooser.selectRowByValue("7"); @@ -197,7 +197,7 @@ acceptance("Topic - Edit timer", function (needs) { } ); - assert.equal(text, el.innerText); + assert.strictEqual(text, el.innerText); }); test("schedule publish to category - visible for an unlisted public topic", async function (assert) { @@ -217,8 +217,8 @@ acceptance("Topic - Edit timer", function (needs) { await timerType.expand(); await timerType.selectRowByValue("publish_to_category"); - assert.equal(categoryChooser.header().label(), "uncategorized"); - assert.equal(categoryChooser.header().value(), null); + assert.strictEqual(categoryChooser.header().label(), "uncategorized"); + assert.strictEqual(categoryChooser.header().value(), null); await categoryChooser.expand(); await categoryChooser.selectRowByValue("7"); @@ -241,7 +241,7 @@ acceptance("Topic - Edit timer", function (needs) { } ); - assert.equal(text, el.innerText); + assert.strictEqual(text, el.innerText); }); test("schedule publish to category - last custom date and time", async function (assert) { @@ -338,11 +338,11 @@ acceptance("Topic - Edit timer", function (needs) { await click(".edit-topic-timer-buttons button.btn-primary"); const removeTimerButton = queryAll(".topic-timer-info .topic-timer-remove"); - assert.equal(removeTimerButton.attr("title"), "remove timer"); + assert.strictEqual(removeTimerButton.attr("title"), "remove timer"); await click(".topic-timer-info .topic-timer-remove"); const topicTimerInfo = queryAll(".topic-timer-info .topic-timer-remove"); - assert.equal(topicTimerInfo.length, 0); + assert.strictEqual(topicTimerInfo.length, 0); }); test("Shows correct time frame options", async function (assert) { diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-footer-buttons-mobile-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-footer-buttons-mobile-test.js index bbf42fdf7df..2a91f175811 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-footer-buttons-mobile-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-footer-buttons-mobile-test.js @@ -40,12 +40,12 @@ acceptance("Topic footer buttons mobile", function (needs) { test("default", async function (assert) { await visit("/t/internationalization-localization/280"); - assert.equal(_test, null); + assert.strictEqual(_test, undefined); const subject = selectKit(".topic-footer-mobile-dropdown"); await subject.expand(); await subject.selectRowByValue("my-button"); - assert.equal(_test, 2); + assert.strictEqual(_test, 2); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-list-tracker-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-list-tracker-test.js index 72d747d0445..920b97de3d1 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-list-tracker-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-list-tracker-test.js @@ -11,14 +11,14 @@ acceptance("Topic list tracking", function () { test("Navigation", async function (assert) { await visit("/"); let url = await nextTopicUrl(); - assert.equal(url, "/t/error-after-upgrade-to-0-9-7-9/11557"); + assert.strictEqual(url, "/t/error-after-upgrade-to-0-9-7-9/11557"); setTopicId(11557); url = await nextTopicUrl(); - assert.equal(url, "/t/welcome-to-meta-discourse-org/1"); + assert.strictEqual(url, "/t/welcome-to-meta-discourse-org/1"); url = await previousTopicUrl(); - assert.equal(url, "/t/error-after-upgrade-to-0-9-7-9/11557"); + assert.strictEqual(url, "/t/error-after-upgrade-to-0-9-7-9/11557"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js index 442b109dcd2..04a1e68ad53 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-move-posts-test.js @@ -12,7 +12,7 @@ acceptance("Topic move posts", function (needs) { await click(".topic-admin-multi-select .btn"); await click("#post_11 .select-below"); - assert.equal( + assert.strictEqual( queryAll(".selected-posts .move-to-topic").text().trim(), I18n.t("topic.move_to.action"), "it should show the move to button" @@ -91,7 +91,7 @@ acceptance("Topic move posts", function (needs) { await click(".topic-admin-multi-select .btn"); await click("#post_1 .select-post"); - assert.equal( + assert.strictEqual( queryAll(".selected-posts .move-to-topic").text().trim(), I18n.t("topic.move_to.action"), "it should show the move to button" @@ -127,7 +127,7 @@ acceptance("Topic move posts", function (needs) { await click(".topic-admin-multi-select .btn"); await click("#post_2 .select-below"); - assert.equal( + assert.strictEqual( queryAll(".selected-posts .move-to-topic").text().trim(), I18n.t("topic.move_to.action"), "it should show the move to button" diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-notifications-button-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-notifications-button-test.js index b345fb36a1c..9e9410c7e5e 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-notifications-button-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-notifications-button-test.js @@ -27,7 +27,7 @@ acceptance("Topic Notifications button", function (needs) { await notificationOptions.expand(); await notificationOptions.selectRowByValue("3"); - assert.equal( + assert.strictEqual( notificationOptions.header().label(), "Watching", "it should display the right notification level" @@ -37,7 +37,7 @@ acceptance("Topic Notifications button", function (needs) { ".topic-timeline .widget-component-connector .topic-notifications-options" ); - assert.equal( + assert.strictEqual( timelineNotificationOptions.header().value(), "3", "it should display the right notification level" @@ -46,13 +46,13 @@ acceptance("Topic Notifications button", function (needs) { await timelineNotificationOptions.expand(); await timelineNotificationOptions.selectRowByValue("0"); - assert.equal( + assert.strictEqual( timelineNotificationOptions.header().value(), "0", "it should display the right notification level" ); - assert.equal( + assert.strictEqual( notificationOptions.header().label(), "Muted", "it should display the right notification level" diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-quote-button-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-quote-button-test.js index 121dc0917b5..93b7881feb8 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-quote-button-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-quote-button-test.js @@ -54,7 +54,7 @@ acceptance("Topic - Quote button - logged in", function (needs) { await selectText("#post_3 aside.onebox p"); await click(".insert-quote"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().trim(), '[quote="group_moderator, post:3, topic:2480"]\nhttps://example.com/57350945\n[/quote]', "quote only contains a link" diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-slow-mode-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-slow-mode-test.js index 8b1449cfbac..b93dd7880fc 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-slow-mode-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-slow-mode-test.js @@ -40,7 +40,7 @@ acceptance("Topic - Slow Mode - enabled", function (needs) { await click(".topic-admin-slow-mode button"); const slowModeType = selectKit(".slow-mode-type"); - assert.equal( + assert.strictEqual( slowModeType.header().name(), I18n.t("topic.slow_mode_update.durations.10_minutes"), "slow mode interval is rendered" @@ -50,7 +50,7 @@ acceptance("Topic - Slow Mode - enabled", function (needs) { // but at least we can make sure that components for choosing date and time are rendered // (in case of inactive slow mode it would be only a combo box with text "Select a timeframe", // and date picker and time picker wouldn't be rendered) - assert.equal( + assert.strictEqual( query("div.enabled-until span.name").innerText, I18n.t("topic.auto_update_input.pick_date_and_time"), "enabled until combobox is switched to the option Pick Date and Time" @@ -66,7 +66,7 @@ acceptance("Topic - Slow Mode - enabled", function (needs) { await click(".topic-admin-slow-mode button"); await click(".future-date-input-selector-header"); - assert.equal( + assert.strictEqual( query("div.modal-footer button.btn-primary span").innerText, I18n.t("topic.slow_mode_update.enable"), "shows 'Enable' button when slow mode is disabled" @@ -77,7 +77,7 @@ acceptance("Topic - Slow Mode - enabled", function (needs) { await click(".topic-admin-slow-mode button"); await click(".future-date-input-selector-header"); - assert.equal( + assert.strictEqual( query("div.modal-footer button.btn-primary span").innerText, I18n.t("topic.slow_mode_update.update"), "shows 'Update' button when slow mode is enabled" diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-test.js index a4f53804ba9..525695f1745 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-test.js @@ -29,12 +29,12 @@ acceptance("Topic", function (needs) { assert.ok(exists(".d-editor-input"), "the composer input is visible"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().trim(), `Continuing the discussion from [Internationalization / localization](${window.location.origin}/t/internationalization-localization/280):`, "it fills composer with the ring string" ); - assert.equal( + assert.strictEqual( selectKit(".category-chooser").header().value(), "2", "it fills category selector with the right category" @@ -48,14 +48,14 @@ acceptance("Topic", function (needs) { assert.ok(exists(".d-editor-input"), "the composer input is visible"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().trim(), `Continuing the discussion from [PM for testing](${window.location.origin}/t/pm-for-testing/12):`, "it fills composer with the ring string" ); const privateMessageUsers = selectKit("#private-message-users"); - assert.equal( + assert.strictEqual( privateMessageUsers.header().value(), "someguy,test,Group", "it fills up the composer correctly" @@ -96,12 +96,12 @@ acceptance("Topic", function (needs) { await categoryChooser.selectRowByValue(4); await click("#topic-title .submit-edit"); - assert.equal( + assert.strictEqual( queryAll("#topic-title .badge-category").text(), "faq", "it displays the new category" ); - assert.equal( + assert.strictEqual( queryAll(".fancy-title").text().trim(), "this is the new title", "it displays the new title" @@ -117,13 +117,13 @@ acceptance("Topic", function (needs) { await click(".topic-post:nth-of-type(1) button.show-post-admin-menu"); await click(".btn.wiki"); - assert.equal(count("button.wiki"), 1, "it shows the wiki icon"); + assert.strictEqual(count("button.wiki"), 1, "it shows the wiki icon"); }); test("Visit topic routes", async function (assert) { await visit("/t/12"); - assert.equal( + assert.strictEqual( queryAll(".fancy-title").text().trim(), "PM for testing", "it routes to the right topic" @@ -131,7 +131,7 @@ acceptance("Topic", function (needs) { await visit("/t/280/20"); - assert.equal( + assert.strictEqual( queryAll(".fancy-title").text().trim(), "Internationalization / localization", "it routes to the right topic" @@ -187,7 +187,7 @@ acceptance("Topic", function (needs) { test("Suggested topics", async function (assert) { await visit("/t/internationalization-localization/280"); - assert.equal( + assert.strictEqual( queryAll("#suggested-topics .suggested-topics-title").text().trim(), I18n.t("suggested_topics.title") ); @@ -242,8 +242,8 @@ acceptance("Topic featured links", function (needs) { await visit("/t/-/299/1"); const link = queryAll(".title-wrapper .topic-featured-link"); - assert.equal(link.text(), " example.com"); - assert.equal(link.attr("rel"), "ugc"); + assert.strictEqual(link.text(), " example.com"); + assert.strictEqual(link.attr("rel"), "ugc"); }); test("remove featured link", async function (assert) { diff --git a/app/assets/javascripts/discourse/tests/acceptance/topic-timeline-test.js b/app/assets/javascripts/discourse/tests/acceptance/topic-timeline-test.js index 51b377d19dd..ec47b6de834 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/topic-timeline-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/topic-timeline-test.js @@ -334,6 +334,6 @@ acceptance("Topic Timeline", function (needs) { test("Shows dates of first and last posts", async function (assert) { await visit("/t/deleted-topic-with-whisper-post/129"); - assert.equal(query(".now-date").innerText, "Jul 2020"); + assert.strictEqual(query(".now-date").innerText, "Jul 2020"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/unknown-test.js b/app/assets/javascripts/discourse/tests/acceptance/unknown-test.js index 3f8dba03be6..b14e9f08df5 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/unknown-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/unknown-test.js @@ -16,11 +16,11 @@ acceptance("Category 404", function (needs) { await visit("/t/internationalization-localization/280"); await click('[data-for-test="category-404"]'); - assert.equal(currentURL(), "/404"); + assert.strictEqual(currentURL(), "/404"); // See that we can navigate away await click("#site-logo"); - assert.equal(currentURL(), "/"); + assert.strictEqual(currentURL(), "/"); }); }); @@ -55,11 +55,14 @@ acceptance("Unknown", function (needs) { test("Permalink URL to a Topic", async function (assert) { await visit("/viewtopic.php?f=8&t=280"); - assert.equal(currentURL(), "/t/internationalization-localization/280"); + assert.strictEqual( + currentURL(), + "/t/internationalization-localization/280" + ); }); test("Permalink URL to a static page", async function (assert) { await visit("/another-url-for-faq"); - assert.equal(currentURL(), "/faq"); + assert.strictEqual(currentURL(), "/faq"); }); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-activity-all-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-activity-all-test.js index 5d648d76d8e..701b9852e46 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-activity-all-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-activity-all-test.js @@ -22,7 +22,7 @@ acceptance("User Activity / All - empty state", function (needs) { test("When looking at another user activity it renders the 'No activity' message", async function (assert) { await visit("/u/charlie/activity"); assert.ok(exists("div.alert-info")); - assert.equal( + assert.strictEqual( query("div.alert-info").innerText.trim(), I18n.t("user_activity.no_activity_others") ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-activity-likes-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-activity-likes-test.js index 9b18353fd4c..fea8c445bed 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-activity-likes-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-activity-likes-test.js @@ -22,7 +22,7 @@ acceptance("User Activity / Likes - empty state", function (needs) { test("When looking at another user activity it renders the 'No activity' message", async function (assert) { await visit("/u/charlie/activity/likes-given"); assert.ok(exists("div.alert-info")); - assert.equal( + assert.strictEqual( query("div.alert-info").innerText.trim(), I18n.t("user_activity.no_likes_others") ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-activity-replies-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-activity-replies-test.js index 2c44313862d..b0b7690a988 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-activity-replies-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-activity-replies-test.js @@ -22,7 +22,7 @@ acceptance("User Activity / Replies - empty state", function (needs) { test("When looking at another user activity it renders the 'No activity' message", async function (assert) { await visit("/u/charlie/activity/replies"); assert.ok(exists("div.alert-info")); - assert.equal( + assert.strictEqual( query("div.alert-info").innerText.trim(), I18n.t("user_activity.no_replies_others") ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-anonymous-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-anonymous-test.js index e3d014df891..e6696e68a05 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-anonymous-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-anonymous-test.js @@ -6,7 +6,11 @@ acceptance("User Anonymous", function () { test("Root URL", async function (assert) { await visit("/u/eviltrout"); assert.ok($("body.user-summary-page").length, "has the body class"); - assert.equal(currentRouteName(), "user.summary", "it defaults to summary"); + assert.strictEqual( + currentRouteName(), + "user.summary", + "it defaults to summary" + ); }); test("Filters", async function (assert) { @@ -35,7 +39,7 @@ acceptance("User Anonymous", function () { test("Restricted Routes", async function (assert) { await visit("/u/eviltrout/preferences"); - assert.equal( + assert.strictEqual( currentURL(), "/u/eviltrout/activity", "it redirects from preferences" diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-drafts-stream-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-drafts-stream-test.js index c762e7ddce5..5445eceec96 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-drafts-stream-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-drafts-stream-test.js @@ -14,13 +14,13 @@ acceptance("User Drafts", function (needs) { test("Stream", async function (assert) { await visit("/u/eviltrout/activity/drafts"); - assert.equal(count(".user-stream-item"), 3, "has drafts"); + assert.strictEqual(count(".user-stream-item"), 3, "has drafts"); await click(".user-stream-item:last-child .remove-draft"); assert.ok(visible(".bootbox")); await click(".bootbox .btn-primary"); - assert.equal( + assert.strictEqual( count(".user-stream-item"), 2, "draft removed, list length diminished by one" @@ -32,7 +32,7 @@ acceptance("User Drafts", function (needs) { assert.ok(exists(".user-stream-item"), "has drafts"); await click(".user-stream-item .resume-draft"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-input").val().trim(), "A fun new topic for testing drafts." ); @@ -41,11 +41,11 @@ acceptance("User Drafts", function (needs) { test("Stream - has excerpt", async function (assert) { await visit("/u/eviltrout/activity/drafts"); assert.ok(exists(".user-stream-item"), "has drafts"); - assert.equal( + assert.strictEqual( query(".user-stream-item:nth-child(3) .category").textContent, "meta" ); - assert.equal( + assert.strictEqual( query(".user-stream-item:nth-child(3) .excerpt").innerHTML.trim(), 'here goes a reply to a PM :slight_smile:' ); diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-interface-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-interface-test.js index 46252a0a9a8..3737937f10c 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-interface-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-interface-test.js @@ -37,12 +37,12 @@ acceptance("User Preferences - Interface", function (needs) { await textSize.selectRowByValue("largest"); assert.ok(document.documentElement.classList.contains("text-size-largest")); - assert.equal(cookie("text_size"), null, "cookie is not set"); + assert.strictEqual(cookie("text_size"), undefined, "cookie is not set"); // Click save (by default this sets for all browsers, no cookie) await savePreferences(); - assert.equal(cookie("text_size"), null, "cookie is not set"); + assert.strictEqual(cookie("text_size"), undefined, "cookie is not set"); await textSize.expand(); await textSize.selectRowByValue("larger"); @@ -50,13 +50,13 @@ acceptance("User Preferences - Interface", function (needs) { await savePreferences(); - assert.equal(cookie("text_size"), "larger|1", "cookie is set"); + assert.strictEqual(cookie("text_size"), "larger|1", "cookie is set"); await click(".text-size input[type=checkbox]"); await textSize.expand(); await textSize.selectRowByValue("largest"); await savePreferences(); - assert.equal(cookie("text_size"), null, "cookie is removed"); + assert.strictEqual(cookie("text_size"), undefined, "cookie is removed"); removeCookie("text_size"); }); @@ -89,11 +89,11 @@ acceptance("User Preferences - Interface", function (needs) { await visit("/u/eviltrout/preferences/interface"); assert.ok(exists(".light-color-scheme"), "has regular dropdown"); - assert.equal( + assert.strictEqual( selectKit(".light-color-scheme .select-kit").header().value(), null ); - assert.equal( + assert.strictEqual( selectKit(".light-color-scheme .select-kit").header().label(), I18n.t("user.color_schemes.default_description") ); @@ -124,10 +124,13 @@ acceptance("User Preferences - Interface", function (needs) { await visit("/u/eviltrout/preferences/interface"); assert.ok(exists(".light-color-scheme"), "has regular dropdown"); - assert.equal(selectKit(".theme .select-kit").header().value(), 2); + assert.strictEqual(selectKit(".theme .select-kit").header().value(), "2"); await selectKit(".light-color-scheme .select-kit").expand(); - assert.equal(count(".light-color-scheme .select-kit .select-kit-row"), 2); + assert.strictEqual( + count(".light-color-scheme .select-kit .select-kit-row"), + 2 + ); document.querySelector("meta[name='discourse_theme_id']").remove(); }); @@ -183,7 +186,7 @@ acceptance( await visit("/u/eviltrout/preferences/interface"); assert.ok(exists(".light-color-scheme"), "has light scheme dropdown"); - assert.equal( + assert.strictEqual( queryAll(".light-color-scheme .selected-name").data("value"), session.userColorSchemeId, "user's selected color scheme is selected value in light scheme dropdown" @@ -207,14 +210,14 @@ acceptance( assert.ok(exists(".light-color-scheme"), "has regular dropdown"); const dropdownObject = selectKit(".light-color-scheme .select-kit"); - assert.equal(dropdownObject.header().value(), null); - assert.equal( + assert.strictEqual(dropdownObject.header().value(), null); + assert.strictEqual( dropdownObject.header().label(), I18n.t("user.color_schemes.default_description") ); await dropdownObject.expand(); - assert.equal(dropdownObject.rows().length, 1); + assert.strictEqual(dropdownObject.rows().length, 1); document.querySelector("meta[name='discourse_theme_id']").remove(); }); @@ -240,14 +243,13 @@ acceptance( await visit("/u/eviltrout/preferences/interface"); assert.ok(exists(".light-color-scheme"), "has regular dropdown"); assert.ok(exists(".dark-color-scheme"), "has dark color scheme dropdown"); - assert.equal( + assert.strictEqual( queryAll(".dark-color-scheme .selected-name").data("value"), session.userDarkSchemeId, "sets site default as selected dark scheme" ); assert.ok( !exists(".control-group.dark-mode"), - 0, "it does not show disable dark mode checkbox" ); @@ -256,19 +258,27 @@ acceptance( await selectKit(".light-color-scheme .combobox").expand(); await selectKit(".light-color-scheme .combobox").selectRowByValue(2); - assert.equal(cookie("color_scheme_id"), null, "cookie is not set"); + assert.strictEqual( + cookie("color_scheme_id"), + undefined, + "cookie is not set" + ); assert.ok( exists(".color-scheme-checkbox input:checked"), "defaults to storing values in user options" ); await savePreferences(); - assert.equal(cookie("color_scheme_id"), null, "cookie is unchanged"); + assert.strictEqual( + cookie("color_scheme_id"), + undefined, + "cookie is unchanged" + ); // Switch to saving changes in cookies await click(".color-scheme-checkbox input[type=checkbox]"); await savePreferences(); - assert.equal(cookie("color_scheme_id"), 2, "cookie is set"); + assert.strictEqual(cookie("color_scheme_id"), "2", "cookie is set"); // dark scheme await selectKit(".dark-color-scheme .combobox").expand(); @@ -278,25 +288,25 @@ acceptance( ); await selectKit(".dark-color-scheme .combobox").selectRowByValue(-1); - assert.equal( + assert.strictEqual( cookie("dark_scheme_id"), - null, + undefined, "cookie is not set before saving" ); await savePreferences(); - assert.equal(cookie("dark_scheme_id"), -1, "cookie is set"); + assert.strictEqual(cookie("dark_scheme_id"), "-1", "cookie is set"); await click("button.undo-preview"); - assert.equal( + assert.strictEqual( selectKit(".light-color-scheme .combobox").header().value(), null, "resets light scheme dropdown" ); - assert.equal( + assert.strictEqual( selectKit(".dark-color-scheme .combobox").header().value(), - session.userDarkSchemeId, + session.userDarkSchemeId.toString(), "resets dark scheme dropdown" ); }); diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-notifications-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-notifications-test.js index d827790294b..a7bda10c139 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-preferences-notifications-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-preferences-notifications-test.js @@ -40,22 +40,22 @@ acceptance("User notification schedule", function (needs) { "Saturday", "Sunday", ].forEach((day) => { - assert.equal( + assert.strictEqual( selectKit(`.day.${day} .starts-at .combobox`).header().label(), "8:00 AM", "8am is selected" ); - assert.equal( + assert.strictEqual( selectKit(`.day.${day} .starts-at .combobox`).header().value(), "480", "8am is 480" ); - assert.equal( + assert.strictEqual( selectKit(`.day.${day} .ends-at .combobox`).header().label(), "5:00 PM", "5am is selected" ); - assert.equal( + assert.strictEqual( selectKit(`.day.${day} .ends-at .combobox`).header().value(), "1020", "5pm is 1020" @@ -70,17 +70,17 @@ acceptance("User notification schedule", function (needs) { await selectKit(".day.Monday .combobox").expand(); await selectKit(".day.Monday .combobox").selectRowByValue(-1); - assert.equal( + assert.strictEqual( selectKit(".day.Monday .starts-at .combobox").header().value(), "-1", "set monday input to none" ); - assert.equal( + assert.strictEqual( selectKit(".day.Monday .starts-at .combobox").header().label(), "None", "set monday label to none" ); - assert.equal( + assert.strictEqual( count(".day.Monday .select-kit.single-select"), 1, "The end time input is hidden" @@ -96,7 +96,7 @@ acceptance("User notification schedule", function (needs) { "1350" ); - assert.equal( + assert.strictEqual( selectKit(".day.Tuesday .ends-at .combobox").header().value(), "1380", "End time is 30 past start time" diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js index 5b9a9b8ef06..0c22509aeb6 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-private-messages-test.js @@ -24,7 +24,11 @@ acceptance( test("viewing messages", async function (assert) { await visit("/u/eviltrout/messages"); - assert.equal(count(".topic-list-item"), 1, "displays the topic list"); + assert.strictEqual( + count(".topic-list-item"), + 1, + "displays the topic list" + ); assert.ok( !exists(".group-notifications-button"), @@ -276,7 +280,7 @@ acceptance( test("viewing messages filtered by tags", async function (assert) { await visit("/u/charlie/messages/tags"); - assert.equal( + assert.strictEqual( count(".action-list li"), 3, "it does not expand personal or group inbox" @@ -342,13 +346,13 @@ acceptance( await visit("/u/charlie/messages"); // wait for re-render - assert.equal( + assert.strictEqual( query(".messages-nav li a.new").innerText.trim(), I18n.t("user.messages.new_with_count", { count: 1 }), "displays the right count" ); - assert.equal( + assert.strictEqual( query(".messages-nav li a.unread").innerText.trim(), I18n.t("user.messages.unread_with_count", { count: 1 }), "displays the right count" @@ -362,7 +366,7 @@ acceptance( await visit("/u/charlie/messages/new"); // wait for re-render - assert.equal( + assert.strictEqual( query(".messages-nav li a.new").innerText.trim(), I18n.t("user.messages.new_with_count", { count: 1 }), "displays the right count" @@ -378,7 +382,7 @@ acceptance( await visit("/u/charlie/messages/unread"); // wait for re-render - assert.equal( + assert.strictEqual( query(".messages-nav li a.unread").innerText.trim(), I18n.t("user.messages.unread_with_count", { count: 1 }), "displays the right count" @@ -395,13 +399,13 @@ acceptance( await visit("/u/charlie/messages/group/awesome_group/unread"); // wait for re-render - assert.equal( + assert.strictEqual( query(".messages-nav li a.unread").innerText.trim(), I18n.t("user.messages.unread_with_count", { count: 1 }), "displays the right count" ); - assert.equal( + assert.strictEqual( query(".messages-nav li a.new").innerText.trim(), I18n.t("user.messages.new_with_count", { count: 1 }), "displays the right count" @@ -411,13 +415,13 @@ acceptance( await visit("/u/charlie/messages/unread"); - assert.equal( + assert.strictEqual( query(".messages-nav li a.unread").innerText.trim(), I18n.t("user.messages.unread"), "displays the right count" ); - assert.equal( + assert.strictEqual( query(".messages-nav li a.new").innerText.trim(), I18n.t("user.messages.new"), "displays the right count" @@ -446,7 +450,7 @@ acceptance( publishUnreadToMessageBus({ topicId: 2, userId: 5 }); publishUnreadToMessageBus({ topicId: 3, userId: 5 }); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 3, "displays the right topic list" @@ -455,13 +459,13 @@ acceptance( await click(".btn.dismiss-read"); await click("#dismiss-read-confirm"); - assert.equal( + assert.strictEqual( query(".messages-nav li a.unread").innerText.trim(), I18n.t("user.messages.unread"), "displays the right count" ); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 0, "displays the right topic list" @@ -471,7 +475,7 @@ acceptance( test("dismissing personal unread messages", async function (assert) { await visit("/u/charlie/messages/unread"); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 3, "displays the right topic list" @@ -480,7 +484,7 @@ acceptance( await click(".btn.dismiss-read"); await click("#dismiss-read-confirm"); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 0, "displays the right topic list" @@ -490,7 +494,7 @@ acceptance( test("dismissing group unread messages", async function (assert) { await visit("/u/charlie/messages/group/awesome_group/unread"); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 3, "displays the right topic list" @@ -499,7 +503,7 @@ acceptance( await click(".btn.dismiss-read"); await click("#dismiss-read-confirm"); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 0, "displays the right topic list" @@ -513,7 +517,7 @@ acceptance( publishNewToMessageBus({ topicId: 2, userId: 5 }); publishNewToMessageBus({ topicId: 3, userId: 5 }); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 3, "displays the right topic list" @@ -521,13 +525,13 @@ acceptance( await click(".btn.dismiss-read"); - assert.equal( + assert.strictEqual( query(".messages-nav li a.new").innerText.trim(), I18n.t("user.messages.new"), "displays the right count" ); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 0, "displays the right topic list" @@ -537,7 +541,7 @@ acceptance( test("dismissing personal new messages", async function (assert) { await visit("/u/charlie/messages/new"); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 3, "displays the right topic list" @@ -545,7 +549,7 @@ acceptance( await click(".btn.dismiss-read"); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 0, "displays the right topic list" @@ -555,7 +559,7 @@ acceptance( test("dismissing new group messages", async function (assert) { await visit("/u/charlie/messages/group/awesome_group/new"); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 3, "displays the right topic list" @@ -563,7 +567,7 @@ acceptance( await click(".btn.dismiss-read"); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 0, "displays the right topic list" @@ -573,7 +577,7 @@ acceptance( test("viewing messages", async function (assert) { await visit("/u/charlie/messages"); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 3, "displays the right topic list" @@ -581,7 +585,7 @@ acceptance( await visit("/u/charlie/messages/group/awesome_group"); - assert.equal( + assert.strictEqual( count(".topic-list-item"), 2, "displays the right topic list" @@ -596,7 +600,7 @@ acceptance( test("suggested messages without new or unread", async function (assert) { await visit("/t/12"); - assert.equal( + assert.strictEqual( query(".suggested-topics-message").innerText.trim(), "Want to read more? Browse other messages in personal messages.", "displays the right browse more message" @@ -610,7 +614,7 @@ acceptance( await visit("/t/12"); // await re-render - assert.equal( + assert.strictEqual( query(".suggested-topics-message").innerText.trim(), "There is 1 new message remaining, or browse other personal messages", "displays the right browse more message" @@ -620,7 +624,7 @@ acceptance( await visit("/t/12"); // await re-render - assert.equal( + assert.strictEqual( query(".suggested-topics-message").innerText.trim(), "There is 1 unread and 1 new message remaining, or browse other personal messages", "displays the right browse more message" @@ -630,7 +634,7 @@ acceptance( await visit("/t/12"); // await re-render - assert.equal( + assert.strictEqual( query(".suggested-topics-message").innerText.trim(), "There is 1 new message remaining, or browse other personal messages", "displays the right browse more message" @@ -817,7 +821,7 @@ acceptance( await click("#reply-control .save-or-cancel button"); - assert.equal( + assert.strictEqual( currentURL(), "/t/testing-private-messages-with-tags/161", "it creates the private message" diff --git a/app/assets/javascripts/discourse/tests/acceptance/user-test.js b/app/assets/javascripts/discourse/tests/acceptance/user-test.js index 3bec0ce6d4c..32375c88b35 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/user-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/user-test.js @@ -24,13 +24,13 @@ acceptance("User Routes", function (needs) { } } - assert.equal(currentRouteName(), "exception-unknown"); + assert.strictEqual(currentRouteName(), "exception-unknown"); }); test("Unicode usernames", async function (assert) { await visit("/u/%E3%83%A9%E3%82%A4%E3%82%AA%E3%83%B3/summary"); - assert.equal(currentRouteName(), "user.summary"); + assert.strictEqual(currentRouteName(), "user.summary"); }); test("Invites", async function (assert) { @@ -54,7 +54,7 @@ acceptance("User Routes", function (needs) { test("Root URL - Viewing Self", async function (assert) { await visit("/u/eviltrout"); assert.ok($("body.user-activity-page").length, "has the body class"); - assert.equal( + assert.strictEqual( currentRouteName(), "userActivity.index", "it defaults to activity" @@ -101,14 +101,14 @@ acceptance( test("Periods in current user's username don't act like wildcards", async function (assert) { await visit("/u/eviltrout"); - assert.equal( + assert.strictEqual( query(".user-profile-names .username").textContent.trim(), "eviltrout", "eviltrout profile is shown" ); await visit("/u/e.il.rout"); - assert.equal( + assert.strictEqual( query(".user-profile-names .username").textContent.trim(), "e.il.rout", "e.il.rout profile is shown" diff --git a/app/assets/javascripts/discourse/tests/acceptance/users-test.js b/app/assets/javascripts/discourse/tests/acceptance/users-test.js index 17b1e05caed..0e5850eee4f 100644 --- a/app/assets/javascripts/discourse/tests/acceptance/users-test.js +++ b/app/assets/javascripts/discourse/tests/acceptance/users-test.js @@ -38,7 +38,10 @@ acceptance("User Directory", function () { const columnData = firstRow.querySelectorAll("td"); const favoriteColorTd = columnData[columnData.length - 1]; - assert.equal(favoriteColorTd.querySelector("span").textContent, "Blue"); + assert.strictEqual( + favoriteColorTd.querySelector("span").textContent, + "Blue" + ); }); }); @@ -52,17 +55,17 @@ acceptance("User directory - Editing columns", function (needs) { const columns = queryAll( ".edit-directory-columns-container .edit-directory-column" ); - assert.equal(columns.length, 8); + assert.strictEqual(columns.length, 8); const checked = queryAll( ".edit-directory-columns-container .edit-directory-column input[type='checkbox']:checked" ); - assert.equal(checked.length, 7); + assert.strictEqual(checked.length, 7); const unchecked = queryAll( ".edit-directory-columns-container .edit-directory-column input[type='checkbox']:not(:checked)" ); - assert.equal(unchecked.length, 1); + assert.strictEqual(unchecked.length, 1); }); const fetchColumns = function () { @@ -75,11 +78,11 @@ acceptance("User directory - Editing columns", function (needs) { let columns; columns = fetchColumns(); - assert.equal( + assert.strictEqual( columns[3].querySelector(".column-name").textContent.trim(), "Replies Posted" ); - assert.equal( + assert.strictEqual( columns[4].querySelector(".column-name").textContent.trim(), "Topics Viewed" ); @@ -88,11 +91,11 @@ acceptance("User directory - Editing columns", function (needs) { await click(columns[4].querySelector(".move-column-up")); columns = fetchColumns(); - assert.equal( + assert.strictEqual( columns[3].querySelector(".column-name").textContent.trim(), "Topics Viewed" ); - assert.equal( + assert.strictEqual( columns[4].querySelector(".column-name").textContent.trim(), "Replies Posted" ); @@ -105,11 +108,11 @@ acceptance("User directory - Editing columns", function (needs) { await click(moveUserFieldColumnUpBtn); columns = fetchColumns(); - assert.equal( + assert.strictEqual( columns[4].querySelector(".column-name").textContent.trim(), "Favorite Color" ); - assert.equal( + assert.strictEqual( columns[5].querySelector(".column-name").textContent.trim(), "Replies Posted" ); diff --git a/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.js b/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.js index 034c228cfaf..1bdea3ddca3 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/ace-editor-test.js @@ -47,12 +47,12 @@ discourseModule("Integration | Component | ace-editor", function (hooks) { const $ace = queryAll(".ace_editor"); assert.expect(3); assert.ok($ace.length, "it renders the ace editor"); - assert.equal( + assert.strictEqual( $ace.parent().data().editor.getReadOnly(), true, "it sets ACE to read-only mode" ); - assert.equal( + assert.strictEqual( $ace.parent().attr("data-disabled"), "true", "ACE wrapper has `data-disabled` attribute set to true" diff --git a/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js b/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js index b88b216dd1d..944330bc68e 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/admin-report-test.js @@ -22,19 +22,19 @@ discourseModule("Integration | Component | admin-report", function (hooks) { assert.ok(exists(".admin-report.signups", "it defaults to table mode")); - assert.equal( + assert.strictEqual( queryAll(".header .item.report").text().trim(), "Signups", "it has a title" ); - assert.equal( + assert.strictEqual( queryAll(".header .info").attr("data-tooltip"), "New account registrations for this period", "it has a description" ); - assert.equal( + assert.strictEqual( queryAll(".admin-report-table thead tr th:first-child .title") .text() .trim(), @@ -42,7 +42,7 @@ discourseModule("Integration | Component | admin-report", function (hooks) { "it has col headers" ); - assert.equal( + assert.strictEqual( queryAll(".admin-report-table thead tr th:nth-child(2) .title") .text() .trim(), @@ -50,7 +50,7 @@ discourseModule("Integration | Component | admin-report", function (hooks) { "it has col headers" ); - assert.equal( + assert.strictEqual( queryAll(".admin-report-table tbody tr:nth-child(1) td:nth-child(1)") .text() .trim(), @@ -58,7 +58,7 @@ discourseModule("Integration | Component | admin-report", function (hooks) { "it has rows" ); - assert.equal( + assert.strictEqual( queryAll(".admin-report-table tbody tr:nth-child(1) td:nth-child(2)") .text() .trim(), @@ -70,7 +70,7 @@ discourseModule("Integration | Component | admin-report", function (hooks) { await click(".admin-report-table-header.y .sort-btn"); - assert.equal( + assert.strictEqual( queryAll(".admin-report-table tbody tr:nth-child(1) td:nth-child(2)") .text() .trim(), @@ -94,7 +94,7 @@ discourseModule("Integration | Component | admin-report", function (hooks) { test(assert) { assert.ok(exists(".pagination"), "it paginates the results"); - assert.equal( + assert.strictEqual( count(".pagination button"), 3, "it creates the correct number of pages" diff --git a/app/assets/javascripts/discourse/tests/integration/components/badge-title-test.js b/app/assets/javascripts/discourse/tests/integration/components/badge-title-test.js index 4a646c60b71..eeb07720480 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/badge-title-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/badge-title-test.js @@ -40,7 +40,7 @@ discourseModule("Integration | Component | badge-title", function (hooks) { await this.subject.expand(); await this.subject.selectRowByValue(42); await click(".btn"); - assert.equal(this.currentUser.title, "Test"); + assert.strictEqual(this.currentUser.title, "Test"); }, }); }); diff --git a/app/assets/javascripts/discourse/tests/integration/components/bookmark-test.js b/app/assets/javascripts/discourse/tests/integration/components/bookmark-test.js index 986eea3e372..4006849227e 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/bookmark-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/bookmark-test.js @@ -180,9 +180,12 @@ discourseModule("Integration | Component | bookmark", function (hooks) { }, test(assert) { - assert.equal(query("#bookmark-name").value, "test"); - assert.equal(query("#custom-date > .date-picker").value, "2020-05-15"); - assert.equal(query("#custom-time").value, "09:45"); + assert.strictEqual(query("#bookmark-name").value, "test"); + assert.strictEqual( + query("#custom-date > .date-picker").value, + "2020-05-15" + ); + assert.strictEqual(query("#custom-time").value, "09:45"); }, }); @@ -191,7 +194,7 @@ discourseModule("Integration | Component | bookmark", function (hooks) { async test(assert) { await click("#tap_tile_custom"); - assert.equal(query("#custom-time").value, "08:00"); + assert.strictEqual(query("#custom-time").value, "08:00"); }, }); @@ -207,7 +210,7 @@ discourseModule("Integration | Component | bookmark", function (hooks) { }, async test(assert) { - assert.equal( + assert.strictEqual( query("div#tap_tile_next_month div.tap-tile-date").innerText, "Feb 1, 8:00 am" ); diff --git a/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js b/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js index 101b02ce3af..3bc2973103b 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/cook-text-test.js @@ -14,7 +14,7 @@ discourseModule("Integration | Component | cook-text", function (hooks) { test(assert) { const html = query(".post-body").innerHTML.trim(); - assert.equal(html, "

foo

"); + assert.strictEqual(html, "

foo

"); }, }); @@ -43,7 +43,7 @@ discourseModule("Integration | Component | cook-text", function (hooks) { test(assert) { const html = query(".post-body").innerHTML.trim(); - assert.equal( + assert.strictEqual( html, '

an image

' ); diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js index b0340a40187..2e02bafa2e3 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/d-button-test.js @@ -22,7 +22,7 @@ discourseModule("Integration | Component | d-button", function (hooks) { "it has all the classes" ); assert.ok(exists("button .d-icon.d-icon-plus"), "it has the icon"); - assert.equal( + assert.strictEqual( queryAll("button").attr("tabindex"), "3", "it has the tabindex" @@ -124,7 +124,7 @@ discourseModule("Integration | Component | d-button", function (hooks) { test(assert) { this.set("ariaLabel", "test.fooAriaLabel"); - assert.equal( + assert.strictEqual( query("button").getAttribute("aria-label"), I18n.t("test.fooAriaLabel") ); @@ -134,7 +134,7 @@ discourseModule("Integration | Component | d-button", function (hooks) { translatedAriaLabel: "bar", }); - assert.equal(query("button").getAttribute("aria-label"), "bar"); + assert.strictEqual(query("button").getAttribute("aria-label"), "bar"); }, }); @@ -147,7 +147,7 @@ discourseModule("Integration | Component | d-button", function (hooks) { test(assert) { this.set("title", "test.fooTitle"); - assert.equal( + assert.strictEqual( query("button").getAttribute("title"), I18n.t("test.fooTitle") ); @@ -157,7 +157,7 @@ discourseModule("Integration | Component | d-button", function (hooks) { translatedTitle: "bar", }); - assert.equal(query("button").getAttribute("title"), "bar"); + assert.strictEqual(query("button").getAttribute("title"), "bar"); }, }); @@ -171,7 +171,7 @@ discourseModule("Integration | Component | d-button", function (hooks) { test(assert) { this.set("label", "test.fooLabel"); - assert.equal( + assert.strictEqual( queryAll("button .d-button-label").text(), I18n.t("test.fooLabel") ); @@ -181,7 +181,7 @@ discourseModule("Integration | Component | d-button", function (hooks) { translatedLabel: "bar", }); - assert.equal(queryAll("button .d-button-label").text(), "bar"); + assert.strictEqual(queryAll("button .d-button-label").text(), "bar"); }, }); @@ -189,19 +189,22 @@ discourseModule("Integration | Component | d-button", function (hooks) { template: hbs`{{d-button ariaExpanded=ariaExpanded}}`, test(assert) { - assert.equal(query("button").ariaExpanded, null); + assert.strictEqual(query("button").getAttribute("aria-expanded"), null); this.set("ariaExpanded", true); - assert.equal(query("button").getAttribute("aria-expanded"), "true"); + assert.strictEqual(query("button").getAttribute("aria-expanded"), "true"); this.set("ariaExpanded", false); - assert.equal(query("button").getAttribute("aria-expanded"), "false"); + assert.strictEqual( + query("button").getAttribute("aria-expanded"), + "false" + ); this.set("ariaExpanded", "false"); - assert.equal(query("button").getAttribute("aria-expanded"), null); + assert.strictEqual(query("button").getAttribute("aria-expanded"), null); this.set("ariaExpanded", "true"); - assert.equal(query("button").getAttribute("aria-expanded"), null); + assert.strictEqual(query("button").getAttribute("aria-expanded"), null); }, }); @@ -210,7 +213,10 @@ discourseModule("Integration | Component | d-button", function (hooks) { test(assert) { this.set("ariaControls", "foo-bar"); - assert.equal(query("button").getAttribute("aria-controls"), "foo-bar"); + assert.strictEqual( + query("button").getAttribute("aria-controls"), + "foo-bar" + ); }, }); }); diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js index 847130a53bb..aa37f57817e 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/d-editor-test.js @@ -29,8 +29,8 @@ discourseModule("Integration | Component | d-editor", function (hooks) { assert.ok(exists(".d-editor-button-bar")); await fillIn(".d-editor-input", "hello **world**"); - assert.equal(this.value, "hello **world**"); - assert.equal( + assert.strictEqual(this.value, "hello **world**"); + assert.strictEqual( queryAll(".d-editor-preview").html().trim(), "

hello world

" ); @@ -43,7 +43,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) { async test(assert) { await fillIn(".d-editor-input", "[discourse](https://www.discourse.org)"); - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview").html().trim(), '

discourse

' ); @@ -55,7 +55,10 @@ discourseModule("Integration | Component | d-editor", function (hooks) { async test(assert) { await fillIn(".d-editor-input", `">`); - assert.equal(queryAll(".d-editor-preview").html().trim(), '

">

'); + assert.strictEqual( + queryAll(".d-editor-preview").html().trim(), + '

">

' + ); }, }); @@ -67,7 +70,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) { }, async test(assert) { - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview").html().trim(), "

evil trout

" ); @@ -75,7 +78,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) { this.set("value", "zogstrip"); await settled(); - assert.equal( + assert.strictEqual( queryAll(".d-editor-preview").html().trim(), "

zogstrip

" ); @@ -124,9 +127,9 @@ discourseModule("Integration | Component | d-editor", function (hooks) { await click(`button.bold`); - assert.equal(this.value, `hello **w**orld.`); - assert.equal(textarea.selectionStart, 8); - assert.equal(textarea.selectionEnd, 9); + assert.strictEqual(this.value, `hello **w**orld.`); + assert.strictEqual(textarea.selectionStart, 8); + assert.strictEqual(textarea.selectionEnd, 9); } ); @@ -138,9 +141,9 @@ discourseModule("Integration | Component | d-editor", function (hooks) { await click(`button.bold`); - assert.equal(this.value, `**hello** world.`); - assert.equal(textarea.selectionStart, 2); - assert.equal(textarea.selectionEnd, 7); + assert.strictEqual(this.value, `**hello** world.`); + assert.strictEqual(textarea.selectionStart, 2); + assert.strictEqual(textarea.selectionEnd, 7); } ); @@ -148,9 +151,9 @@ discourseModule("Integration | Component | d-editor", function (hooks) { await click(`button.bold`); const example = I18n.t(`composer.bold_text`); - assert.equal(this.value, `hello world.**${example}**`); - assert.equal(textarea.selectionStart, 14); - assert.equal(textarea.selectionEnd, 14 + example.length); + assert.strictEqual(this.value, `hello world.**${example}**`); + assert.strictEqual(textarea.selectionStart, 14); + assert.strictEqual(textarea.selectionEnd, 14 + example.length); }); testCase(`bold button with a selection`, async function (assert, textarea) { @@ -158,14 +161,14 @@ discourseModule("Integration | Component | d-editor", function (hooks) { textarea.selectionEnd = 11; await click(`button.bold`); - assert.equal(this.value, `hello **world**.`); - assert.equal(textarea.selectionStart, 8); - assert.equal(textarea.selectionEnd, 13); + assert.strictEqual(this.value, `hello **world**.`); + assert.strictEqual(textarea.selectionStart, 8); + assert.strictEqual(textarea.selectionEnd, 13); await click(`button.bold`); - assert.equal(this.value, "hello world."); - assert.equal(textarea.selectionStart, 6); - assert.equal(textarea.selectionEnd, 11); + assert.strictEqual(this.value, "hello world."); + assert.strictEqual(textarea.selectionStart, 6); + assert.strictEqual(textarea.selectionEnd, 11); }); testCase( @@ -177,14 +180,14 @@ discourseModule("Integration | Component | d-editor", function (hooks) { textarea.selectionEnd = 12; await click(`button.bold`); - assert.equal(this.value, `**hello**\n\n**world**\n\ntest.`); - assert.equal(textarea.selectionStart, 0); - assert.equal(textarea.selectionEnd, 20); + assert.strictEqual(this.value, `**hello**\n\n**world**\n\ntest.`); + assert.strictEqual(textarea.selectionStart, 0); + assert.strictEqual(textarea.selectionEnd, 20); await click(`button.bold`); - assert.equal(this.value, `hello\n\nworld\n\ntest.`); - assert.equal(textarea.selectionStart, 0); - assert.equal(textarea.selectionEnd, 12); + assert.strictEqual(this.value, `hello\n\nworld\n\ntest.`); + assert.strictEqual(textarea.selectionStart, 0); + assert.strictEqual(textarea.selectionEnd, 12); } ); @@ -193,10 +196,10 @@ discourseModule("Integration | Component | d-editor", function (hooks) { async function (assert, textarea) { await click(`button.italic`); const example = I18n.t(`composer.italic_text`); - assert.equal(this.value, `hello world.*${example}*`); + assert.strictEqual(this.value, `hello world.*${example}*`); - assert.equal(textarea.selectionStart, 13); - assert.equal(textarea.selectionEnd, 13 + example.length); + assert.strictEqual(textarea.selectionStart, 13); + assert.strictEqual(textarea.selectionEnd, 13 + example.length); } ); @@ -205,14 +208,14 @@ discourseModule("Integration | Component | d-editor", function (hooks) { textarea.selectionEnd = 11; await click(`button.italic`); - assert.equal(this.value, `hello *world*.`); - assert.equal(textarea.selectionStart, 7); - assert.equal(textarea.selectionEnd, 12); + assert.strictEqual(this.value, `hello *world*.`); + assert.strictEqual(textarea.selectionStart, 7); + assert.strictEqual(textarea.selectionEnd, 12); await click(`button.italic`); - assert.equal(this.value, "hello world."); - assert.equal(textarea.selectionStart, 6); - assert.equal(textarea.selectionEnd, 11); + assert.strictEqual(this.value, "hello world."); + assert.strictEqual(textarea.selectionStart, 6); + assert.strictEqual(textarea.selectionEnd, 11); }); testCase( @@ -224,14 +227,14 @@ discourseModule("Integration | Component | d-editor", function (hooks) { textarea.selectionEnd = 12; await click(`button.italic`); - assert.equal(this.value, `*hello*\n\n*world*\n\ntest.`); - assert.equal(textarea.selectionStart, 0); - assert.equal(textarea.selectionEnd, 16); + assert.strictEqual(this.value, `*hello*\n\n*world*\n\ntest.`); + assert.strictEqual(textarea.selectionStart, 0); + assert.strictEqual(textarea.selectionEnd, 16); await click(`button.italic`); - assert.equal(this.value, `hello\n\nworld\n\ntest.`); - assert.equal(textarea.selectionStart, 0); - assert.equal(textarea.selectionEnd, 12); + assert.strictEqual(this.value, `hello\n\nworld\n\ntest.`); + assert.strictEqual(textarea.selectionStart, 0); + assert.strictEqual(textarea.selectionEnd, 12); } ); @@ -257,7 +260,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) { textarea.selectionEnd = textarea.value.length; await click("button.code"); - assert.equal( + assert.strictEqual( this.value, ` function xyz(x, y, z) { @@ -280,7 +283,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) { const textarea = jumpEnd(query("textarea.d-editor-input")); await click("button.code"); - assert.equal(this.value, ` ${I18n.t("composer.code_text")}`); + assert.strictEqual(this.value, ` ${I18n.t("composer.code_text")}`); this.set("value", "first line\n\nsecond line\n\nthird line"); @@ -288,7 +291,7 @@ discourseModule("Integration | Component | d-editor", function (hooks) { textarea.selectionEnd = 11; await click("button.code"); - assert.equal( + assert.strictEqual( this.value, `first line ${I18n.t("composer.code_text")} @@ -300,7 +303,7 @@ third line` this.set("value", "first line\n\nsecond line\n\nthird line"); await click("button.code"); - assert.equal( + assert.strictEqual( this.value, `first line @@ -314,7 +317,7 @@ third line\`${I18n.t("composer.code_title")}\`` textarea.selectionEnd = 5; await click("button.code"); - assert.equal( + assert.strictEqual( this.value, `first\`${I18n.t("composer.code_title")}\` line @@ -328,30 +331,33 @@ third line` textarea.selectionEnd = 10; await click("button.code"); - assert.equal(this.value, "first `line`\n\nsecond line\n\nthird line"); - assert.equal(textarea.selectionStart, 7); - assert.equal(textarea.selectionEnd, 11); + assert.strictEqual( + this.value, + "first `line`\n\nsecond line\n\nthird line" + ); + assert.strictEqual(textarea.selectionStart, 7); + assert.strictEqual(textarea.selectionEnd, 11); await click("button.code"); - assert.equal(this.value, "first line\n\nsecond line\n\nthird line"); - assert.equal(textarea.selectionStart, 6); - assert.equal(textarea.selectionEnd, 10); + assert.strictEqual(this.value, "first line\n\nsecond line\n\nthird line"); + assert.strictEqual(textarea.selectionStart, 6); + assert.strictEqual(textarea.selectionEnd, 10); textarea.selectionStart = 0; textarea.selectionEnd = 23; await click("button.code"); - assert.equal( + assert.strictEqual( this.value, " first line\n\n second line\n\nthird line" ); - assert.equal(textarea.selectionStart, 0); - assert.equal(textarea.selectionEnd, 31); + assert.strictEqual(textarea.selectionStart, 0); + assert.strictEqual(textarea.selectionEnd, 31); await click("button.code"); - assert.equal(this.value, "first line\n\nsecond line\n\nthird line"); - assert.equal(textarea.selectionStart, 0); - assert.equal(textarea.selectionEnd, 23); + assert.strictEqual(this.value, "first line\n\nsecond line\n\nthird line"); + assert.strictEqual(textarea.selectionStart, 0); + assert.strictEqual(textarea.selectionEnd, 23); }, }); @@ -365,15 +371,15 @@ third line` const textarea = jumpEnd(query("textarea.d-editor-input")); await click("button.code"); - assert.equal( + assert.strictEqual( this.value, `\`\`\` ${I18n.t("composer.paste_code_text")} \`\`\`` ); - assert.equal(textarea.selectionStart, 4); - assert.equal(textarea.selectionEnd, 27); + assert.strictEqual(textarea.selectionStart, 4); + assert.strictEqual(textarea.selectionEnd, 27); this.set("value", "first line\nsecond line\nthird line"); @@ -382,7 +388,7 @@ ${I18n.t("composer.paste_code_text")} await click("button.code"); - assert.equal( + assert.strictEqual( this.value, `\`\`\` first line @@ -392,8 +398,8 @@ third line ` ); - assert.equal(textarea.selectionStart, textarea.value.length); - assert.equal(textarea.selectionEnd, textarea.value.length); + assert.strictEqual(textarea.selectionStart, textarea.value.length); + assert.strictEqual(textarea.selectionEnd, textarea.value.length); this.set("value", "first line\nsecond line\nthird line"); @@ -402,15 +408,15 @@ third line await click("button.code"); - assert.equal( + assert.strictEqual( this.value, `\`${I18n.t("composer.code_title")}\`first line second line third line` ); - assert.equal(textarea.selectionStart, 1); - assert.equal( + assert.strictEqual(textarea.selectionStart, 1); + assert.strictEqual( textarea.selectionEnd, I18n.t("composer.code_title").length + 1 ); @@ -422,15 +428,15 @@ third line` await click("button.code"); - assert.equal( + assert.strictEqual( this.value, `\`first line\` second line third line` ); - assert.equal(textarea.selectionStart, 1); - assert.equal(textarea.selectionEnd, 11); + assert.strictEqual(textarea.selectionStart, 1); + assert.strictEqual(textarea.selectionEnd, 11); this.set("value", "first line\nsecond line\nthird line"); @@ -439,7 +445,7 @@ third line` await click("button.code"); - assert.equal( + assert.strictEqual( this.value, `\`\`\` first line @@ -448,8 +454,8 @@ second line third line` ); - assert.equal(textarea.selectionStart, 30); - assert.equal(textarea.selectionEnd, 30); + assert.strictEqual(textarea.selectionStart, 30); + assert.strictEqual(textarea.selectionEnd, 30); this.set("value", "first line\nsecond line\nthird line"); @@ -458,13 +464,13 @@ third line` await click("button.code"); - assert.equal( + assert.strictEqual( this.value, `first \n\`\`\`\nline\nsecond\n\`\`\`\n line\nthird line` ); - assert.equal(textarea.selectionStart, 27); - assert.equal(textarea.selectionEnd, 27); + assert.strictEqual(textarea.selectionStart, 27); + assert.strictEqual(textarea.selectionEnd, 27); }, }); @@ -480,12 +486,12 @@ third line` await click("button.blockquote"); - assert.equal(this.value, "> one\n> \n> two\n> \n> three"); - assert.equal(textarea.selectionStart, 0); - assert.equal(textarea.selectionEnd, 25); + assert.strictEqual(this.value, "> one\n> \n> two\n> \n> three"); + assert.strictEqual(textarea.selectionStart, 0); + assert.strictEqual(textarea.selectionEnd, 25); await click("button.blockquote"); - assert.equal(this.value, "one\n\ntwo\n\nthree"); + assert.strictEqual(this.value, "one\n\ntwo\n\nthree"); }, }); @@ -501,7 +507,7 @@ third line` textarea.selectionEnd = 10; await click("button.blockquote"); - assert.equal(this.value, "one\n\n\n> \n> two"); + assert.strictEqual(this.value, "one\n\n\n> \n> two"); }, }); @@ -510,21 +516,21 @@ third line` textarea.selectionEnd = 9; await click("button.blockquote"); - assert.equal(this.value, "hello\n\n> wor\n\nld."); - assert.equal(textarea.selectionStart, 7); - assert.equal(textarea.selectionEnd, 12); + assert.strictEqual(this.value, "hello\n\n> wor\n\nld."); + assert.strictEqual(textarea.selectionStart, 7); + assert.strictEqual(textarea.selectionEnd, 12); await click("button.blockquote"); - assert.equal(this.value, "hello\n\nwor\n\nld."); - assert.equal(textarea.selectionStart, 7); - assert.equal(textarea.selectionEnd, 10); + assert.strictEqual(this.value, "hello\n\nwor\n\nld."); + assert.strictEqual(textarea.selectionStart, 7); + assert.strictEqual(textarea.selectionEnd, 10); textarea.selectionStart = 15; textarea.selectionEnd = 15; await click("button.blockquote"); - assert.equal(this.value, "hello\n\nwor\n\nld.\n\n> Blockquote"); + assert.strictEqual(this.value, "hello\n\nwor\n\nld.\n\n> Blockquote"); }); testCase( @@ -533,12 +539,12 @@ third line` const example = I18n.t("composer.list_item"); await click(`button.bullet`); - assert.equal(this.value, `hello world.\n\n* ${example}`); - assert.equal(textarea.selectionStart, 14); - assert.equal(textarea.selectionEnd, 16 + example.length); + assert.strictEqual(this.value, `hello world.\n\n* ${example}`); + assert.strictEqual(textarea.selectionStart, 14); + assert.strictEqual(textarea.selectionEnd, 16 + example.length); await click(`button.bullet`); - assert.equal(this.value, `hello world.\n\n${example}`); + assert.strictEqual(this.value, `hello world.\n\n${example}`); } ); @@ -547,14 +553,14 @@ third line` textarea.selectionEnd = 11; await click(`button.bullet`); - assert.equal(this.value, `hello\n\n* world\n\n.`); - assert.equal(textarea.selectionStart, 7); - assert.equal(textarea.selectionEnd, 14); + assert.strictEqual(this.value, `hello\n\n* world\n\n.`); + assert.strictEqual(textarea.selectionStart, 7); + assert.strictEqual(textarea.selectionEnd, 14); await click(`button.bullet`); - assert.equal(this.value, `hello\n\nworld\n\n.`); - assert.equal(textarea.selectionStart, 7); - assert.equal(textarea.selectionEnd, 12); + assert.strictEqual(this.value, `hello\n\nworld\n\n.`); + assert.strictEqual(textarea.selectionStart, 7); + assert.strictEqual(textarea.selectionEnd, 12); }); testCase( @@ -566,14 +572,14 @@ third line` textarea.selectionEnd = 20; await click(`button.bullet`); - assert.equal(this.value, "Hello\n\nWorld\n\nEvil"); - assert.equal(textarea.selectionStart, 0); - assert.equal(textarea.selectionEnd, 18); + assert.strictEqual(this.value, "Hello\n\nWorld\n\nEvil"); + assert.strictEqual(textarea.selectionStart, 0); + assert.strictEqual(textarea.selectionEnd, 18); await click(`button.bullet`); - assert.equal(this.value, "* Hello\n\n* World\n\n* Evil"); - assert.equal(textarea.selectionStart, 0); - assert.equal(textarea.selectionEnd, 24); + assert.strictEqual(this.value, "* Hello\n\n* World\n\n* Evil"); + assert.strictEqual(textarea.selectionStart, 0); + assert.strictEqual(textarea.selectionEnd, 24); } ); @@ -581,14 +587,14 @@ third line` const example = I18n.t("composer.list_item"); await click(`button.list`); - assert.equal(this.value, `hello world.\n\n1. ${example}`); - assert.equal(textarea.selectionStart, 14); - assert.equal(textarea.selectionEnd, 17 + example.length); + assert.strictEqual(this.value, `hello world.\n\n1. ${example}`); + assert.strictEqual(textarea.selectionStart, 14); + assert.strictEqual(textarea.selectionEnd, 17 + example.length); await click(`button.list`); - assert.equal(this.value, `hello world.\n\n${example}`); - assert.equal(textarea.selectionStart, 14); - assert.equal(textarea.selectionEnd, 14 + example.length); + assert.strictEqual(this.value, `hello world.\n\n${example}`); + assert.strictEqual(textarea.selectionStart, 14); + assert.strictEqual(textarea.selectionEnd, 14 + example.length); }); testCase(`list button with a selection`, async function (assert, textarea) { @@ -596,14 +602,14 @@ third line` textarea.selectionEnd = 11; await click(`button.list`); - assert.equal(this.value, `hello\n\n1. world\n\n.`); - assert.equal(textarea.selectionStart, 7); - assert.equal(textarea.selectionEnd, 15); + assert.strictEqual(this.value, `hello\n\n1. world\n\n.`); + assert.strictEqual(textarea.selectionStart, 7); + assert.strictEqual(textarea.selectionEnd, 15); await click(`button.list`); - assert.equal(this.value, `hello\n\nworld\n\n.`); - assert.equal(textarea.selectionStart, 7); - assert.equal(textarea.selectionEnd, 12); + assert.strictEqual(this.value, `hello\n\nworld\n\n.`); + assert.strictEqual(textarea.selectionStart, 7); + assert.strictEqual(textarea.selectionEnd, 12); }); testCase(`list button with line sequence`, async function (assert, textarea) { @@ -613,14 +619,14 @@ third line` textarea.selectionEnd = 18; await click(`button.list`); - assert.equal(this.value, "1. Hello\n\n2. World\n\n3. Evil"); - assert.equal(textarea.selectionStart, 0); - assert.equal(textarea.selectionEnd, 27); + assert.strictEqual(this.value, "1. Hello\n\n2. World\n\n3. Evil"); + assert.strictEqual(textarea.selectionStart, 0); + assert.strictEqual(textarea.selectionEnd, 27); await click(`button.list`); - assert.equal(this.value, "Hello\n\nWorld\n\nEvil"); - assert.equal(textarea.selectionStart, 0); - assert.equal(textarea.selectionEnd, 18); + assert.strictEqual(this.value, "Hello\n\nWorld\n\nEvil"); + assert.strictEqual(textarea.selectionStart, 0); + assert.strictEqual(textarea.selectionEnd, 18); }); componentTest("clicking the toggle-direction changes dir from ltr to rtl", { @@ -633,7 +639,7 @@ third line` async test(assert) { const textarea = queryAll("textarea.d-editor-input"); await click("button.toggle-direction"); - assert.equal(textarea.attr("dir"), "rtl"); + assert.strictEqual(textarea.attr("dir"), "rtl"); }, }); @@ -648,7 +654,7 @@ third line` const textarea = queryAll("textarea.d-editor-input"); textarea.attr("dir", "ltr"); await click("button.toggle-direction"); - assert.equal(textarea.attr("dir"), "rtl"); + assert.strictEqual(textarea.attr("dir"), "rtl"); }, }); @@ -666,7 +672,7 @@ third line` textarea.selectionEnd = 3; await click("button.bold"); - assert.equal($(textarea).scrollTop(), 0, "it stays scrolled up"); + assert.strictEqual($(textarea).scrollTop(), 0, "it stays scrolled up"); } ); @@ -698,7 +704,7 @@ third line` await click( '.emoji-picker .section[data-section="smileys_&_emotion"] img.emoji[title="grinning"]' ); - assert.equal(this.value, "hello world. :grinning:"); + assert.strictEqual(this.value, "hello world. :grinning:"); }, }); @@ -709,7 +715,7 @@ third line` .lookup("service:app-events") .trigger("composer:replace-text", "green", "yellow"); - assert.equal(this.value, "red green blue"); + assert.strictEqual(this.value, "red green blue"); }); composerTestCase("replace-text event for composer", async function (assert) { @@ -719,7 +725,7 @@ third line` .lookup("service:app-events") .trigger("composer:replace-text", "green", "yellow"); - assert.equal(this.value, "red yellow blue"); + assert.strictEqual(this.value, "red yellow blue"); }); async function paste(element, text) { @@ -739,7 +745,7 @@ third line` async test(assert) { let element = query(".d-editor"); await paste(element, "\ta\tb\n1\t2\t3"); - assert.equal(this.value, "||a|b|\n|---|---|---|\n|1|2|3|\n"); + assert.strictEqual(this.value, "||a|b|\n|---|---|---|\n|1|2|3|\n"); }, }); @@ -753,7 +759,7 @@ third line` async test(assert) { let element = query(".d-editor"); await paste(element, '\ta\tb\n1\t"2\n2.5"\t3'); - assert.equal(this.value, "||a|b|\n|---|---|---|\n|1|2
2.5|3|\n"); + assert.strictEqual(this.value, "||a|b|\n|---|---|---|\n|1|2
2.5|3|\n"); }, }); @@ -846,7 +852,7 @@ third line` this.value, getTextareaSelection(textarea) ); - assert.equal(actual, expect); + assert.strictEqual(actual, expect); }); }); } diff --git a/app/assets/javascripts/discourse/tests/integration/components/d-icon-test.js b/app/assets/javascripts/discourse/tests/integration/components/d-icon-test.js index 319157d629d..cb3a2bdd773 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/d-icon-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/d-icon-test.js @@ -15,7 +15,7 @@ discourseModule("Integration | Component | d-icon", function (hooks) { test(assert) { const html = queryAll(".test").html().trim(); - assert.equal( + assert.strictEqual( html, '' ); @@ -27,7 +27,7 @@ discourseModule("Integration | Component | d-icon", function (hooks) { test(assert) { const html = queryAll(".test").html().trim(); - assert.equal( + assert.strictEqual( html, '' ); diff --git a/app/assets/javascripts/discourse/tests/integration/components/date-input-test.js b/app/assets/javascripts/discourse/tests/integration/components/date-input-test.js index 6da694557d5..b8d31362898 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/date-input-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/date-input-test.js @@ -27,7 +27,7 @@ discourseModule("Integration | Component | date-input", function (hooks) { }, test(assert) { - assert.equal(dateInput().value, "2019-01-29"); + assert.strictEqual(dateInput().value, "2019-01-29"); }, }); diff --git a/app/assets/javascripts/discourse/tests/integration/components/date-time-input-range-test.js b/app/assets/javascripts/discourse/tests/integration/components/date-time-input-range-test.js index cb316517ecb..71e23480cf6 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/date-time-input-range-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/date-time-input-range-test.js @@ -35,10 +35,10 @@ discourseModule( }, test(assert) { - assert.equal(fromDateInput().value, "2019-01-29"); - assert.equal(fromTimeInput().dataset.name, "14:45"); - assert.equal(toDateInput().value, ""); - assert.equal(toTimeInput().dataset.name, "--:--"); + assert.strictEqual(fromDateInput().value, "2019-01-29"); + assert.strictEqual(fromTimeInput().dataset.name, "14:45"); + assert.strictEqual(toDateInput().value, ""); + assert.strictEqual(toTimeInput().dataset.name, "--:--"); }, }); } diff --git a/app/assets/javascripts/discourse/tests/integration/components/date-time-input-test.js b/app/assets/javascripts/discourse/tests/integration/components/date-time-input-test.js index 57a7136e7a6..66449bc3d40 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/date-time-input-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/date-time-input-test.js @@ -33,8 +33,8 @@ discourseModule("Integration | Component | date-time-input", function (hooks) { }, test(assert) { - assert.equal(dateInput().value, "2019-01-29"); - assert.equal(timeInput().dataset.name, "14:45"); + assert.strictEqual(dateInput().value, "2019-01-29"); + assert.strictEqual(timeInput().dataset.name, "14:45"); }, }); diff --git a/app/assets/javascripts/discourse/tests/integration/components/group-list-setting-test.js b/app/assets/javascripts/discourse/tests/integration/components/group-list-setting-test.js index ef1340f54fb..1aa7c22f7d4 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/group-list-setting-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/group-list-setting-test.js @@ -49,7 +49,7 @@ discourseModule( async test(assert) { const subject = selectKit(".list-setting"); - assert.equal( + assert.strictEqual( subject.header().value(), "1", "it selects the setting's value" @@ -58,7 +58,7 @@ discourseModule( await subject.expand(); await subject.selectRowByValue("2"); - assert.equal( + assert.strictEqual( subject.header().value(), "1,2", "it allows to select a setting from the list of choices" diff --git a/app/assets/javascripts/discourse/tests/integration/components/group-membership-button-test.js b/app/assets/javascripts/discourse/tests/integration/components/group-membership-button-test.js index 4f46c7ac68e..bb3fef96e75 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/group-membership-button-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/group-membership-button-test.js @@ -55,7 +55,11 @@ discourseModule( ); this.set("model.is_group_user", true); - assert.equal(count(".group-index-leave"), 1, "allowed to leave group"); + assert.strictEqual( + count(".group-index-leave"), + 1, + "allowed to leave group" + ); }, }); diff --git a/app/assets/javascripts/discourse/tests/integration/components/highlighted-code-test.js b/app/assets/javascripts/discourse/tests/integration/components/highlighted-code-test.js index cb726a5ffbb..b10cc00af74 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/highlighted-code-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/highlighted-code-test.js @@ -22,7 +22,7 @@ discourseModule("Integration | Component | highlighted-code", function (hooks) { }, test(assert) { - assert.equal( + assert.strictEqual( queryAll("code.ruby.hljs .hljs-function .hljs-keyword").text().trim(), "def" ); @@ -39,7 +39,10 @@ discourseModule("Integration | Component | highlighted-code", function (hooks) { }, test(assert) { - assert.equal(queryAll("code").text().trim(), LONG_CODE_BLOCK.trim()); + assert.strictEqual( + queryAll("code").text().trim(), + LONG_CODE_BLOCK.trim() + ); }, }); }); diff --git a/app/assets/javascripts/discourse/tests/integration/components/iframed-html-test.js b/app/assets/javascripts/discourse/tests/integration/components/iframed-html-test.js index f829c61f5e1..10809a6222e 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/iframed-html-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/iframed-html-test.js @@ -15,14 +15,14 @@ discourseModule("Integration | Component | iframed-html", function (hooks) { async test(assert) { const iframe = queryAll("iframe.this-is-an-iframe"); - assert.equal(iframe.length, 1, "inserts an iframe"); + assert.strictEqual(iframe.length, 1, "inserts an iframe"); assert.ok( iframe[0].classList.contains("this-is-an-iframe"), "Adds className to the iframes classList" ); - assert.equal( + assert.strictEqual( iframe[0].contentWindow.document.body.querySelectorAll("#find-me") .length, 1, diff --git a/app/assets/javascripts/discourse/tests/integration/components/image-uploader-test.js b/app/assets/javascripts/discourse/tests/integration/components/image-uploader-test.js index b92a9abc220..1ae8c058f09 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/image-uploader-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/image-uploader-test.js @@ -18,13 +18,13 @@ discourseModule("Integration | Component | image-uploader", function (hooks) { `, async test(assert) { - assert.equal( + assert.strictEqual( count(".d-icon-far-image"), 1, "it displays the upload icon" ); - assert.equal( + assert.strictEqual( count(".d-icon-far-trash-alt"), 1, "it displays the trash icon" @@ -37,7 +37,7 @@ discourseModule("Integration | Component | image-uploader", function (hooks) { await click(".image-uploader-lightbox-btn"); - assert.equal( + assert.strictEqual( document.querySelectorAll(".mfp-container").length, 1, "it displays the image lightbox" @@ -49,7 +49,7 @@ discourseModule("Integration | Component | image-uploader", function (hooks) { template: hbs`{{image-uploader}}`, test(assert) { - assert.equal( + assert.strictEqual( count(".d-icon-far-image"), 1, "it displays the upload icon" @@ -71,7 +71,7 @@ discourseModule("Integration | Component | image-uploader", function (hooks) { template: hbs`{{image-uploader placeholderUrl='/images/avatar.png'}}`, test(assert) { - assert.equal( + assert.strictEqual( count(".d-icon-far-image"), 1, "it displays the upload icon" @@ -87,7 +87,7 @@ discourseModule("Integration | Component | image-uploader", function (hooks) { "it does not display the button to open image lightbox" ); - assert.equal( + assert.strictEqual( count(".placeholder-overlay"), 1, "it displays the placeholder image" diff --git a/app/assets/javascripts/discourse/tests/integration/components/input-size-test.js b/app/assets/javascripts/discourse/tests/integration/components/input-size-test.js index 16f23a907aa..e1c6aa7afa7 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/input-size-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/input-size-test.js @@ -14,12 +14,12 @@ discourseModule( template: hbs`{{d-button icon="plus"}} {{d-button icon="plus" label="topic.create"}} {{d-button label="topic.create"}}`, test(assert) { - assert.equal( + assert.strictEqual( query(".btn:nth-child(1)").offsetHeight, query(".btn:nth-child(2)").offsetHeight, "have equal height" ); - assert.equal( + assert.strictEqual( query(".btn:nth-child(1)").offsetHeight, query(".btn:nth-child(3)").offsetHeight, "have equal height" @@ -33,7 +33,7 @@ discourseModule( template: hbs`{{text-field}} {{d-button icon="plus" label="topic.create"}}`, test(assert) { - assert.equal( + assert.strictEqual( query("input").offsetHeight, query(".btn").offsetHeight, "have equal height" @@ -47,7 +47,7 @@ discourseModule( template: hbs`{{combo-box options=(hash none="category.none")}} {{text-field}}`, test(assert) { - assert.equal( + assert.strictEqual( query("input").offsetHeight, query(".combo-box").offsetHeight, "have equal height" diff --git a/app/assets/javascripts/discourse/tests/integration/components/invite-panel-test.js b/app/assets/javascripts/discourse/tests/integration/components/invite-panel-test.js index f35ea125fae..177d0fdc49c 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/invite-panel-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/invite-panel-test.js @@ -44,7 +44,7 @@ discourseModule("Integration | Component | invite-panel", function (hooks) { await input.selectRowByValue("eviltrout@example.com"); assert.ok(!exists(".send-invite:disabled")); await click(".generate-invite-link"); - assert.equal( + assert.strictEqual( find(".invite-link-input")[0].value, "http://example.com/invites/92c297e886a0ca03089a109ccd6be155" ); diff --git a/app/assets/javascripts/discourse/tests/integration/components/relative-time-picker-test.js b/app/assets/javascripts/discourse/tests/integration/components/relative-time-picker-test.js index e0ed34fb08c..3176aa8659c 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/relative-time-picker-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/relative-time-picker-test.js @@ -19,8 +19,8 @@ discourseModule( test(assert) { const prefilledDuration = query(".relative-time-duration").value; - assert.equal(this.subject.header().value(), "mins"); - assert.equal(prefilledDuration, 5); + assert.strictEqual(this.subject.header().value(), "mins"); + assert.strictEqual(prefilledDuration, "5"); }, }); @@ -29,8 +29,8 @@ discourseModule( test(assert) { const prefilledDuration = query(".relative-time-duration").value; - assert.equal(this.subject.header().value(), "hours"); - assert.equal(prefilledDuration, 1.5); + assert.strictEqual(this.subject.header().value(), "hours"); + assert.strictEqual(prefilledDuration, "1.5"); }, }); @@ -39,8 +39,8 @@ discourseModule( test(assert) { const prefilledDuration = query(".relative-time-duration").value; - assert.equal(this.subject.header().value(), "days"); - assert.equal(prefilledDuration, 2); + assert.strictEqual(this.subject.header().value(), "days"); + assert.strictEqual(prefilledDuration, "2"); }, }); @@ -51,8 +51,8 @@ discourseModule( test(assert) { const prefilledDuration = query(".relative-time-duration").value; - assert.equal(this.subject.header().value(), "months"); - assert.equal(prefilledDuration, 3); + assert.strictEqual(this.subject.header().value(), "months"); + assert.strictEqual(prefilledDuration, "3"); }, } ); @@ -62,8 +62,8 @@ discourseModule( test(assert) { const prefilledDuration = query(".relative-time-duration").value; - assert.equal(this.subject.header().value(), "years"); - assert.equal(prefilledDuration, 1); + assert.strictEqual(this.subject.header().value(), "years"); + assert.strictEqual(prefilledDuration, "1"); }, }); @@ -72,8 +72,8 @@ discourseModule( test(assert) { const prefilledDuration = query(".relative-time-duration").value; - assert.equal(this.subject.header().value(), "hours"); - assert.equal(prefilledDuration, 5); + assert.strictEqual(this.subject.header().value(), "hours"); + assert.strictEqual(prefilledDuration, "5"); }, }); @@ -82,8 +82,8 @@ discourseModule( test(assert) { const prefilledDuration = query(".relative-time-duration").value; - assert.equal(this.subject.header().value(), "mins"); - assert.equal(prefilledDuration, 30); + assert.strictEqual(this.subject.header().value(), "mins"); + assert.strictEqual(prefilledDuration, "30"); }, }); @@ -92,8 +92,8 @@ discourseModule( test(assert) { const prefilledDuration = query(".relative-time-duration").value; - assert.equal(this.subject.header().value(), "days"); - assert.equal(prefilledDuration, 2); + assert.strictEqual(this.subject.header().value(), "days"); + assert.strictEqual(prefilledDuration, "2"); }, }); @@ -102,8 +102,8 @@ discourseModule( test(assert) { const prefilledDuration = query(".relative-time-duration").value; - assert.equal(this.subject.header().value(), "months"); - assert.equal(prefilledDuration, 3); + assert.strictEqual(this.subject.header().value(), "months"); + assert.strictEqual(prefilledDuration, "3"); }, }); @@ -112,8 +112,8 @@ discourseModule( test(assert) { const prefilledDuration = query(".relative-time-duration").value; - assert.equal(this.subject.header().value(), "years"); - assert.equal(prefilledDuration, 2); + assert.strictEqual(this.subject.header().value(), "years"); + assert.strictEqual(prefilledDuration, "2"); }, }); } diff --git a/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.js index 7e9651a86c5..6590e15cbec 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/secret-value-list-test.js @@ -25,7 +25,7 @@ discourseModule( await fillIn(".new-value-input.key", "thirdKey"); await click(".add-value-btn"); - assert.equal( + assert.strictEqual( count(".values .value"), 2, "it doesn't add the value to the list if secret is missing" @@ -35,7 +35,7 @@ discourseModule( await fillIn(".new-value-input.secret", "thirdValue"); await click(".add-value-btn"); - assert.equal( + assert.strictEqual( count(".values .value"), 2, "it doesn't add the value to the list if key is missing" @@ -45,7 +45,7 @@ discourseModule( await fillIn(".new-value-input.secret", "thirdValue"); await click(".add-value-btn"); - assert.equal( + assert.strictEqual( count(".values .value"), 3, "it adds the value to the list of values" @@ -96,13 +96,13 @@ discourseModule( await click(".values .value[data-index='0'] .remove-value-btn"); - assert.equal( + assert.strictEqual( count(".values .value"), 1, "it removes the value from the list of values" ); - assert.equal( + assert.strictEqual( this.values, "secondKey|secondValue", "it removes the expected value" diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js index d8c99d06b67..41e63a1718d 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/api-test.js @@ -51,11 +51,11 @@ discourseModule("Integration | Component | select-kit:api", function (hooks) { async test(assert) { await this.comboBox.expand(); - assert.equal(this.comboBox.rows().length, 4); + assert.strictEqual(this.comboBox.rows().length, 4); const appendedRow = this.comboBox.rowByIndex(3); assert.ok(appendedRow.exists()); - assert.equal(appendedRow.value(), "alpaca"); + assert.strictEqual(appendedRow.value(), "alpaca"); await this.comboBox.collapse(); @@ -86,11 +86,11 @@ discourseModule("Integration | Component | select-kit:api", function (hooks) { async test(assert) { await this.comboBox.expand(); - assert.equal(this.comboBox.rows().length, 4); + assert.strictEqual(this.comboBox.rows().length, 4); const prependedRow = this.comboBox.rowByIndex(0); assert.ok(prependedRow.exists()); - assert.equal(prependedRow.value(), "alpaca"); + assert.strictEqual(prependedRow.value(), "alpaca"); await this.comboBox.collapse(); @@ -118,7 +118,7 @@ discourseModule("Integration | Component | select-kit:api", function (hooks) { await this.comboBox.expand(); await this.comboBox.selectRowByIndex(0); - assert.equal(queryAll("#test").text(), "foo"); + assert.strictEqual(queryAll("#test").text(), "foo"); }, }); }); diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js index a49c4d1dae2..6840f93ecb1 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-chooser-test.js @@ -28,8 +28,8 @@ discourseModule( }, async test(assert) { - assert.equal(this.subject.header().value(), 2); - assert.equal(this.subject.header().label(), "feature"); + assert.strictEqual(this.subject.header().value(), "2"); + assert.strictEqual(this.subject.header().label(), "feature"); }, }); @@ -63,11 +63,11 @@ discourseModule( async test(assert) { await this.subject.expand(); - assert.equal(this.subject.rowByIndex(0).title(), "feature"); - assert.equal(this.subject.rowByIndex(0).value(), 2); - assert.equal(this.subject.rowByIndex(1).title(), "spec"); - assert.equal(this.subject.rowByIndex(1).value(), 26); - assert.equal( + assert.strictEqual(this.subject.rowByIndex(0).title(), "feature"); + assert.strictEqual(this.subject.rowByIndex(0).value(), "2"); + assert.strictEqual(this.subject.rowByIndex(1).title(), "spec"); + assert.strictEqual(this.subject.rowByIndex(1).value(), "26"); + assert.strictEqual( this.subject.rows().length, 2, "default content is scoped" @@ -75,7 +75,7 @@ discourseModule( await this.subject.fillInFilter("bug"); - assert.equal( + assert.strictEqual( this.subject.rowByIndex(0).name(), "bug", "search finds outside of scope" @@ -97,15 +97,15 @@ discourseModule( await this.subject.expand(); // The prioritized category - assert.equal(this.subject.rowByIndex(0).value(), 5); + assert.strictEqual(this.subject.rowByIndex(0).value(), "5"); // The prioritized category's child - assert.equal(this.subject.rowByIndex(1).value(), 22); + assert.strictEqual(this.subject.rowByIndex(1).value(), "22"); // Other categories in the default order - assert.equal(this.subject.rowByIndex(2).value(), 6); - assert.equal(this.subject.rowByIndex(3).value(), 21); - assert.equal(this.subject.rowByIndex(4).value(), 1); + assert.strictEqual(this.subject.rowByIndex(2).value(), "6"); + assert.strictEqual(this.subject.rowByIndex(3).value(), "21"); + assert.strictEqual(this.subject.rowByIndex(4).value(), "1"); - assert.equal( + assert.strictEqual( this.subject.rows().length, 21, "all categories are visible" @@ -113,7 +113,7 @@ discourseModule( await this.subject.fillInFilter("bug"); - assert.equal( + assert.strictEqual( this.subject.rowByIndex(0).name(), "bug", "search still finds categories" @@ -136,8 +136,8 @@ discourseModule( }, test(assert) { - assert.equal(this.subject.header().value(), null); - assert.equal(this.subject.header().label(), "category…"); + assert.strictEqual(this.subject.header().value(), null); + assert.strictEqual(this.subject.header().label(), "category…"); }, }); @@ -157,8 +157,8 @@ discourseModule( }, test(assert) { - assert.equal(this.subject.header().value(), null); - assert.equal(this.subject.header().label(), "(no category)"); + assert.strictEqual(this.subject.header().value(), null); + assert.strictEqual(this.subject.header().label(), "(no category)"); }, }); @@ -179,8 +179,8 @@ discourseModule( }, test(assert) { - assert.equal(this.subject.header().value(), null); - assert.equal(this.subject.header().label(), "root none label"); + assert.strictEqual(this.subject.header().value(), null); + assert.strictEqual(this.subject.header().label(), "root none label"); }, }); @@ -199,8 +199,8 @@ discourseModule( }, test(assert) { - assert.equal(this.subject.header().value(), null); - assert.equal(this.subject.header().label(), "uncategorized"); + assert.strictEqual(this.subject.header().value(), null); + assert.strictEqual(this.subject.header().label(), "uncategorized"); }, }); @@ -220,8 +220,8 @@ discourseModule( }, test(assert) { - assert.equal(this.subject.header().value(), null); - assert.equal(this.subject.header().label(), "(no category)"); + assert.strictEqual(this.subject.header().value(), null); + assert.strictEqual(this.subject.header().label(), "(no category)"); }, }); @@ -242,8 +242,8 @@ discourseModule( }, test(assert) { - assert.equal(this.subject.header().value(), null); - assert.equal(this.subject.header().label(), "root none label"); + assert.strictEqual(this.subject.header().value(), null); + assert.strictEqual(this.subject.header().label(), "root none label"); }, }); @@ -258,14 +258,14 @@ discourseModule( await this.subject.expand(); await this.subject.fillInFilter("bug"); - assert.ok(this.subject.rows().length, 1); - assert.equal(this.subject.rowByIndex(0).name(), "bug"); + assert.strictEqual(this.subject.rows().length, 1); + assert.strictEqual(this.subject.rowByIndex(0).name(), "bug"); await this.subject.emptyFilter(); await this.subject.fillInFilter("Bug"); - assert.ok(this.subject.rows().length, 1); - assert.equal(this.subject.rowByIndex(0).name(), "bug"); + assert.strictEqual(this.subject.rows().length, 1); + assert.strictEqual(this.subject.rowByIndex(0).name(), "bug"); }, }); @@ -286,10 +286,10 @@ discourseModule( async test(assert) { await this.subject.expand(); - await this.subject.fillInFilter("hữ"); + await this.subject.fillInFilter("gữ"); - assert.ok(this.subject.rows().length, 1); - assert.equal(this.subject.rowByIndex(0).name(), "chữ Quốc ngữ"); + assert.strictEqual(this.subject.rows().length, 1); + assert.strictEqual(this.subject.rowByIndex(0).name(), "chữ Quốc ngữ"); }, }); @@ -313,7 +313,7 @@ discourseModule( async test(assert) { await this.subject.expand(); - assert.equal( + assert.strictEqual( this.subject.rowByIndex(0).el()[0].querySelector(".category-desc") .innerText, 'baz "bar ‘foo’' diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.js index c72b67f9720..91b74845889 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/category-drop-test.js @@ -72,7 +72,7 @@ discourseModule( async test(assert) { const text = this.subject.header().label(); - assert.equal( + assert.strictEqual( text, I18n.t("category.all").toLowerCase(), "it uses the noneLabel" @@ -178,8 +178,8 @@ discourseModule( await this.subject.expand(); const row = this.subject.rowByValue(this.category.id); - assert.equal(row.value(), this.category.id); - assert.equal(this.category.parent_category_id, null); + assert.strictEqual(row.value(), this.category.id.toString()); + assert.strictEqual(this.category.parent_category_id, undefined); }, }); @@ -281,7 +281,7 @@ discourseModule( const row = this.subject.rowByValue(category.id); const topicCount = row.el().find(".topic-count").text().trim(); - assert.equal( + assert.strictEqual( topicCount, "× 481", "it doesn't include the topic count of subcategories" @@ -312,7 +312,7 @@ discourseModule( const row = this.subject.rowByValue(category.id); const topicCount = row.el().find(".topic-count").text().trim(); - assert.equal( + assert.strictEqual( topicCount, "× 584", "it includes the topic count of subcategories" @@ -337,9 +337,9 @@ discourseModule( async test(assert) { await this.subject.expand(); - assert.equal( + assert.strictEqual( this.subject.rowByIndex(0).value(), - this.categories.firstObject.id, + this.categories.firstObject.id.toString(), "Shortcuts are not prepended when no category is selected" ); }, @@ -361,7 +361,10 @@ discourseModule( async test(assert) { await this.subject.expand(); - assert.equal(this.subject.rowByIndex(0).value(), ALL_CATEGORIES_ID); + assert.strictEqual( + this.subject.rowByIndex(0).value(), + ALL_CATEGORIES_ID + ); }, }); @@ -384,7 +387,10 @@ discourseModule( async test(assert) { await this.subject.expand(); - assert.equal(this.subject.rowByIndex(0).value(), NO_CATEGORIES_ID); + assert.strictEqual( + this.subject.rowByIndex(0).value(), + NO_CATEGORIES_ID + ); }, }); @@ -410,8 +416,14 @@ discourseModule( async test(assert) { await this.subject.expand(); - assert.equal(this.subject.rowByIndex(0).value(), ALL_CATEGORIES_ID); - assert.equal(this.subject.rowByIndex(1).value(), NO_CATEGORIES_ID); + assert.strictEqual( + this.subject.rowByIndex(0).value(), + ALL_CATEGORIES_ID + ); + assert.strictEqual( + this.subject.rowByIndex(1).value(), + NO_CATEGORIES_ID + ); }, } ); diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.js index 8b68b09a1c3..1178156a55e 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/combo-box-test.js @@ -60,7 +60,7 @@ discourseModule( exists($header.el().find(".btn-clear")), "it shows the clear button" ); - assert.equal($header.value(), DEFAULT_VALUE); + assert.strictEqual($header.value(), DEFAULT_VALUE.toString()); await click($header.el().find(".btn-clear")[0]); @@ -68,7 +68,7 @@ discourseModule( exists($header.el().find(".btn-clear")), "it hides the clear button" ); - assert.equal($header.value(), null); + assert.strictEqual($header.value(), null); }, }); diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.js index e2e2129a154..80af3a66167 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/dropdown-select-box-test.js @@ -87,7 +87,7 @@ discourseModule( "it hides the text of the selected item" ); - assert.equal( + assert.strictEqual( this.subject.header().el().attr("title"), "[en.test_none]", "it adds a title attribute to the button" diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/list-setting-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/list-setting-test.js index adda7e2fc55..99ab0b94630 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/list-setting-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/list-setting-test.js @@ -28,13 +28,13 @@ discourseModule( }, async test(assert) { - assert.equal(this.subject.header().name(), "bold,italic"); - assert.equal(this.subject.header().value(), "bold,italic"); + assert.strictEqual(this.subject.header().name(), "bold,italic"); + assert.strictEqual(this.subject.header().value(), "bold,italic"); await this.subject.expand(); - assert.equal(this.subject.rows().length, 1); - assert.equal(this.subject.rowByIndex(0).value(), "underline"); + assert.strictEqual(this.subject.rows().length, 1); + assert.strictEqual(this.subject.rowByIndex(0).value(), "underline"); }, }); } diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js index 5f8c5f33b50..e1bb328e833 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/mini-tag-chooser-test.js @@ -26,7 +26,7 @@ discourseModule( }, async test(assert) { - assert.equal(this.subject.header().value(), "foo,bar"); + assert.strictEqual(this.subject.header().value(), "foo,bar"); }, }); @@ -38,22 +38,22 @@ discourseModule( }, async test(assert) { - assert.equal(this.subject.header().value(), "foo,bar"); + assert.strictEqual(this.subject.header().value(), "foo,bar"); await this.subject.expand(); await this.subject.fillInFilter("mon"); - assert.equal( + assert.strictEqual( queryAll(".select-kit-row").text().trim(), "monkey x1\ngazelle x2" ); await this.subject.fillInFilter("key"); - assert.equal( + assert.strictEqual( queryAll(".select-kit-row").text().trim(), "monkey x1\ngazelle x2" ); await this.subject.selectRowByValue("monkey"); - assert.equal(this.subject.header().value(), "foo,bar,monkey"); + assert.strictEqual(this.subject.header().value(), "foo,bar,monkey"); }, }); @@ -66,14 +66,14 @@ discourseModule( }, async test(assert) { - assert.equal(this.subject.header().value(), "foo,bar"); + assert.strictEqual(this.subject.header().value(), "foo,bar"); await this.subject.expand(); await this.subject.fillInFilter("baz"); await this.subject.selectRowByValue("monkey"); const error = queryAll(".select-kit-error").text(); - assert.equal( + assert.strictEqual( error, I18n.t("select_kit.max_content_reached", { count: this.siteSettings.max_tags_per_topic, diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.js index c6939fd3f1a..83520188571 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/multi-select-test.js @@ -47,18 +47,18 @@ discourseModule( await this.subject.expand(); const content = this.subject.displayedContent(); - assert.equal(content.length, 3, "it shows rows"); - assert.equal( + assert.strictEqual(content.length, 3, "it shows rows"); + assert.strictEqual( content[0].name, this.content.firstObject.name, "it has the correct name" ); - assert.equal( + assert.strictEqual( content[0].id, - this.content.firstObject.id, + this.content.firstObject.id.toString(), "it has the correct value" ); - assert.equal( + assert.strictEqual( this.subject.header().value(), null, "it doesn't set a value from the content" diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/pinned-options-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/pinned-options-test.js index 567dfae951a..0294ef8a8bb 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/pinned-options-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/pinned-options-test.js @@ -33,12 +33,12 @@ discourseModule( }, async test(assert) { - assert.equal(this.subject.header().name(), "pinned"); + assert.strictEqual(this.subject.header().name(), "pinned"); await this.subject.expand(); await this.subject.selectRowByValue("unpinned"); - assert.equal(this.subject.header().name(), "unpinned"); + assert.strictEqual(this.subject.header().name(), "unpinned"); }, }); @@ -51,12 +51,12 @@ discourseModule( }, async test(assert) { - assert.equal(this.subject.header().name(), "unpinned"); + assert.strictEqual(this.subject.header().name(), "unpinned"); await this.subject.expand(); await this.subject.selectRowByValue("pinned"); - assert.equal(this.subject.header().name(), "pinned"); + assert.strictEqual(this.subject.header().name(), "pinned"); }, }); } diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.js index 73ba8bed099..9455f8dcb46 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/single-select-test.js @@ -50,18 +50,18 @@ discourseModule( await this.subject.expand(); const content = this.subject.displayedContent(); - assert.equal(content.length, 3, "it shows rows"); - assert.equal( + assert.strictEqual(content.length, 3, "it shows rows"); + assert.strictEqual( content[0].name, this.content.firstObject.name, "it has the correct name" ); - assert.equal( + assert.strictEqual( content[0].id, - this.content.firstObject.id, + this.content.firstObject.id.toString(), "it has the correct value" ); - assert.equal( + assert.strictEqual( this.subject.header().value(), null, "it doesn't set a value from the content" @@ -85,9 +85,9 @@ discourseModule( }, test(assert) { - assert.equal( + assert.strictEqual( this.subject.header().value(this.content), - 1, + "1", "it selects the correct content to display" ); }, @@ -117,7 +117,7 @@ discourseModule( const filter = this.subject.displayedContent()[1].name; await this.subject.fillInFilter(filter); - assert.equal( + assert.strictEqual( this.subject.displayedContent()[0].name, filter, "it filters the list" @@ -148,7 +148,7 @@ discourseModule( await this.subject.expand(); await this.subject.fillInFilter("ba"); - assert.equal( + assert.strictEqual( this.subject.displayedContent().length, 1, "it returns only 1 result" @@ -181,7 +181,7 @@ discourseModule( async test(assert) { await this.subject.expand(); - assert.equal(this.subject.selectedRow().value(), this.value); + assert.strictEqual(this.subject.selectedRow().value(), this.value); }, }); @@ -208,8 +208,8 @@ discourseModule( await this.subject.expand(); const noneRow = this.subject.rowByIndex(0); - assert.equal(noneRow.value(), null); - assert.equal(noneRow.name(), I18n.t("test.none")); + assert.strictEqual(noneRow.value(), null); + assert.strictEqual(noneRow.name(), I18n.t("test.none")); }, }); @@ -235,8 +235,8 @@ discourseModule( await this.subject.expand(); const noneRow = this.subject.rowByIndex(0); - assert.equal(noneRow.value(), null); - assert.equal(noneRow.name(), "(default)"); + assert.strictEqual(noneRow.value(), null); + assert.strictEqual(noneRow.name(), "(default)"); }, }); @@ -268,13 +268,13 @@ discourseModule( await this.subject.expand(); const noneRow = this.subject.rowByIndex(0); - assert.equal(noneRow.value(), I18n.t("test.none")); - assert.equal(noneRow.name(), I18n.t("test.none")); - assert.equal(this.value, "foo"); + assert.strictEqual(noneRow.value(), I18n.t("test.none")); + assert.strictEqual(noneRow.name(), I18n.t("test.none")); + assert.strictEqual(this.value, "foo"); await this.subject.selectRowByIndex(0); - assert.equal(this.value, null); + assert.strictEqual(this.value, null); }, }); @@ -300,12 +300,12 @@ discourseModule( }, async test(assert) { - assert.equal(this.subject.header().value(), 1); + assert.strictEqual(this.subject.header().value(), "1"); await this.subject.expand(); await this.subject.selectRowByValue(0); - assert.equal(this.subject.header().value(), 0); + assert.strictEqual(this.subject.header().value(), "0"); }, }); @@ -329,9 +329,9 @@ discourseModule( }, async test(assert) { - assert.equal(this.value, DEFAULT_VALUE); + assert.strictEqual(this.value, DEFAULT_VALUE); await this.subject.expand(); - assert.equal(this.value, DEFAULT_VALUE); + assert.strictEqual(this.value, DEFAULT_VALUE); }, }); @@ -352,13 +352,13 @@ discourseModule( }, async test(assert) { - assert.equal(this.subject.header().label(), "JACKSON"); + assert.strictEqual(this.subject.header().label(), "JACKSON"); await this.subject.expand(); const row = this.subject.rowByValue(1); - assert.equal(row.label(), "JACKSON"); + assert.strictEqual(row.label(), "JACKSON"); }, }); @@ -379,13 +379,13 @@ discourseModule( }, async test(assert) { - assert.equal(this.subject.header().title(), "JACKSON"); + assert.strictEqual(this.subject.header().title(), "JACKSON"); await this.subject.expand(); const row = this.subject.rowByValue(1); - assert.equal(row.title(), "JACKSON"); + assert.strictEqual(row.title(), "JACKSON"); }, }); @@ -400,7 +400,7 @@ discourseModule( }, async test(assert) { - assert.equal( + assert.strictEqual( this.subject.header().el()[0].querySelector(".selected-name").lang, "" ); @@ -408,11 +408,11 @@ discourseModule( await this.subject.expand(); const row = this.subject.rowByValue(1); - assert.equal(row.el()[0].lang, "be"); + assert.strictEqual(row.el()[0].lang, "be"); await this.subject.selectRowByValue(1); - assert.equal( + assert.strictEqual( this.subject.header().el()[0].querySelector(".selected-name").lang, "be" ); @@ -430,7 +430,7 @@ discourseModule( }, async test(assert) { - assert.equal( + assert.strictEqual( this.subject.header().el()[0].getAttribute("name"), I18n.t("select_kit.select_to_filter") ); @@ -438,7 +438,7 @@ discourseModule( await this.subject.expand(); await this.subject.selectRowByValue(1); - assert.equal( + assert.strictEqual( this.subject.header().el()[0].getAttribute("name"), I18n.t("select_kit.filter_by", { name: this.content.firstObject.name, diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/tag-drop-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/tag-drop-test.js index 9947bac92f9..2dfef5b5e4f 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/tag-drop-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/tag-drop-test.js @@ -75,12 +75,12 @@ discourseModule( const content = this.subject.displayedContent(); - assert.equal( + assert.strictEqual( content[0].name, I18n.t("tagging.selector_no_tags"), "it has the translated label for no-tags" ); - assert.equal( + assert.strictEqual( content[1].name, I18n.t("tagging.selector_all_tags"), "it has the correct label for all-tags" diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-button-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-button-test.js index c6e1e9f4630..5f9555f9fd7 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-button-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-button-test.js @@ -50,7 +50,7 @@ discourseModule( }, async test(assert) { - assert.equal( + assert.strictEqual( selectKit().header().label(), "Normal", "it has the correct label" @@ -58,7 +58,7 @@ discourseModule( await this.set("topic", buildTopic({ level: 2 })); - assert.equal( + assert.strictEqual( selectKit().header().label(), "Tracking", "it correctly changes the label" @@ -83,7 +83,7 @@ discourseModule( }, test(assert) { - assert.equal( + assert.strictEqual( selectKit().header().label(), `${originalTranslation} PM`, "it has the correct label for PMs" @@ -105,7 +105,7 @@ discourseModule( }, test(assert) { - assert.equal( + assert.strictEqual( queryAll(".topic-notifications-button .text").text(), I18n.t("topic.notifications.reasons.mailing_list_mode"), "mailing_list_mode enabled for the user shows unique text" @@ -128,7 +128,7 @@ discourseModule( test(assert) { this.set("topic", buildTopic({ level: 3, reason: 999 })); - assert.equal( + assert.strictEqual( queryAll(".topic-notifications-button .text").text(), I18n.t("topic.notifications.reasons.3"), "fallback to regular level translation if reason does not exist" @@ -150,7 +150,7 @@ discourseModule( }, test(assert) { - assert.equal( + assert.strictEqual( queryAll(".topic-notifications-button .text").text(), I18n.t("topic.notifications.reasons.2_8"), "use 2_8 notification if user is still tracking category" @@ -177,7 +177,7 @@ discourseModule( }, test(assert) { - assert.equal( + assert.strictEqual( queryAll(".topic-notifications-button .text").text(), I18n.t("topic.notifications.reasons.2_8_stale"), "use _stale notification if user is no longer tracking category" @@ -200,7 +200,7 @@ discourseModule( }, test(assert) { - assert.equal( + assert.strictEqual( queryAll(".topic-notifications-button .text").text(), I18n.t("topic.notifications.reasons.3_6"), "use 3_6 notification if user is still watching category" @@ -227,7 +227,7 @@ discourseModule( }, test(assert) { - assert.equal( + assert.strictEqual( queryAll(".topic-notifications-button .text").text(), I18n.t("topic.notifications.reasons.3_6_stale"), "use _stale notification if user is no longer watching category" @@ -250,7 +250,7 @@ discourseModule( }, test(assert) { - assert.equal( + assert.strictEqual( queryAll(".topic-notifications-button .text").text(), I18n.t("topic.notifications.reasons.3_10"), "use 3_10 notification if user is still watching tag" @@ -272,7 +272,7 @@ discourseModule( }, test(assert) { - assert.equal( + assert.strictEqual( queryAll(".topic-notifications-button .text").text(), I18n.t("topic.notifications.reasons.3_10_stale"), "use _stale notification if user is no longer watching tag" diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-options-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-options-test.js index 41be156071a..56e754ecc35 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-options-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/topic-notifications-options-test.js @@ -56,13 +56,13 @@ discourseModule( const uiTexts = extractDescs(selectKit().rows()); const descriptions = getTranslations(); - assert.equal( + assert.strictEqual( uiTexts.length, descriptions.length, "it has the correct copy" ); uiTexts.forEach((text, index) => { - assert.equal( + assert.strictEqual( text.trim(), descriptions[index].trim(), "it has the correct copy" @@ -89,14 +89,14 @@ discourseModule( const uiTexts = extractDescs(selectKit().rows()); const descriptions = getTranslations("_pm"); - assert.equal( + assert.strictEqual( uiTexts.length, descriptions.length, "it has the correct copy" ); uiTexts.forEach((text, index) => { - assert.equal( + assert.strictEqual( text.trim(), descriptions[index].trim(), "it has the correct copy" diff --git a/app/assets/javascripts/discourse/tests/integration/components/select-kit/user-chooser-test.js b/app/assets/javascripts/discourse/tests/integration/components/select-kit/user-chooser-test.js index 22cd0c624b7..74b7a2eb213 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/select-kit/user-chooser-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/select-kit/user-chooser-test.js @@ -22,7 +22,7 @@ discourseModule( }, async test(assert) { - assert.equal(this.subject.header().name(), "bob,martin"); + assert.strictEqual(this.subject.header().name(), "bob,martin"); }, }); @@ -36,7 +36,7 @@ discourseModule( async test(assert) { await this.subject.expand(); await this.subject.deselectItemByValue("bob"); - assert.equal(this.subject.header().name(), "martin"); + assert.strictEqual(this.subject.header().name(), "martin"); }, }); } diff --git a/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.js index 73c421bbe47..59011fc2a8b 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/simple-list-test.js @@ -29,7 +29,7 @@ discourseModule("Integration | Component | simple-list", function (hooks) { await fillIn(".add-value-input", "penar"); await click(".add-value-btn"); - assert.equal( + assert.strictEqual( count(".values .value"), 3, "it adds the value to the list of values" @@ -43,7 +43,7 @@ discourseModule("Integration | Component | simple-list", function (hooks) { await fillIn(".add-value-input", "eviltrout"); await triggerKeyEvent(".add-value-input", "keydown", 13); // enter - assert.equal( + assert.strictEqual( count(".values .value"), 4, "it adds the value when keying Enter" @@ -61,7 +61,7 @@ discourseModule("Integration | Component | simple-list", function (hooks) { async test(assert) { await click(".values .value[data-index='0'] .remove-value-btn"); - assert.equal( + assert.strictEqual( count(".values .value"), 1, "it removes the value from the list of values" @@ -85,7 +85,7 @@ discourseModule("Integration | Component | simple-list", function (hooks) { await fillIn(".add-value-input", "eviltrout"); await click(".add-value-btn"); - assert.equal( + assert.strictEqual( count(".values .value"), 3, "it adds the value to the list of values" diff --git a/app/assets/javascripts/discourse/tests/integration/components/site-header-test.js b/app/assets/javascripts/discourse/tests/integration/components/site-header-test.js index cf33a76b3ac..1556c47ccda 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/site-header-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/site-header-test.js @@ -21,7 +21,7 @@ discourseModule("Integration | Component | site-header", function (hooks) { }, async test(assert) { - assert.equal( + assert.strictEqual( count(".ring-backdrop"), 1, "there is the first notification mask" diff --git a/app/assets/javascripts/discourse/tests/integration/components/slow-mode-info-test.js b/app/assets/javascripts/discourse/tests/integration/components/slow-mode-info-test.js index fbc2e8df9cf..628b15e8b3a 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/slow-mode-info-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/slow-mode-info-test.js @@ -43,7 +43,7 @@ discourseModule("Integration | Component | slow-mode-info", function (hooks) { }, test(assert) { - assert.equal(count(".slow-mode-heading"), 1); + assert.strictEqual(count(".slow-mode-heading"), 1); }, }); @@ -58,7 +58,7 @@ discourseModule("Integration | Component | slow-mode-info", function (hooks) { }, test(assert) { - assert.equal(count(".slow-mode-remove"), 1); + assert.strictEqual(count(".slow-mode-remove"), 1); }, }); diff --git a/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js b/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js index dc89583291c..250052e6163 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/text-field-test.js @@ -31,7 +31,7 @@ discourseModule("Integration | Component | text-field", function (hooks) { test(assert) { assert.ok(exists("input[type=text]")); - assert.equal( + assert.strictEqual( queryAll("input").prop("placeholder"), "placeholder.i18n.key" ); @@ -45,7 +45,7 @@ discourseModule("Integration | Component | text-field", function (hooks) { }, test(assert) { - assert.equal(queryAll("input").attr("dir"), "rtl"); + assert.strictEqual(queryAll("input").attr("dir"), "rtl"); }, }); @@ -56,7 +56,7 @@ discourseModule("Integration | Component | text-field", function (hooks) { }, test(assert) { - assert.equal(queryAll("input").attr("dir"), "ltr"); + assert.strictEqual(queryAll("input").attr("dir"), "ltr"); }, }); @@ -76,7 +76,7 @@ discourseModule("Integration | Component | text-field", function (hooks) { assert.ok(!this.called); await fillIn(".tf-test", "new text"); assert.ok(this.called); - assert.equal(this.newValue, "new text"); + assert.strictEqual(this.newValue, "new text"); }, }); @@ -96,7 +96,7 @@ discourseModule("Integration | Component | text-field", function (hooks) { assert.ok(!this.called); await fillIn(".tf-test", "no longer old"); assert.ok(this.called); - assert.equal(this.newValue, "no longer old"); + assert.strictEqual(this.newValue, "no longer old"); }, }); }); diff --git a/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.js b/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.js index 56c517c5beb..49a74ca2961 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/themes-list-item-test.js @@ -20,7 +20,7 @@ discourseModule("Integration | Component | themes-list-item", function (hooks) { test(assert) { assert.expect(1); - assert.equal(count(".d-icon-check"), 1, "shows default theme icon"); + assert.strictEqual(count(".d-icon-check"), 1, "shows default theme icon"); }, }); @@ -35,7 +35,7 @@ discourseModule("Integration | Component | themes-list-item", function (hooks) { test(assert) { assert.expect(1); - assert.equal(count(".d-icon-sync"), 1, "shows pending update icon"); + assert.strictEqual(count(".d-icon-sync"), 1, "shows pending update icon"); }, }); @@ -53,7 +53,7 @@ discourseModule("Integration | Component | themes-list-item", function (hooks) { test(assert) { assert.expect(1); - assert.equal( + assert.strictEqual( count(".d-icon-exclamation-circle"), 1, "shows broken theme icon" diff --git a/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.js index cb820a21605..6392cc84b81 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/themes-list-test.js @@ -45,23 +45,23 @@ discourseModule("Integration | Component | themes-list", function (hooks) { }, test(assert) { - assert.equal( + assert.strictEqual( queryAll(".themes-tab").hasClass("active"), true, "themes tab is active" ); - assert.equal( + assert.strictEqual( queryAll(".components-tab").hasClass("active"), false, "components tab is not active" ); - assert.equal( + assert.strictEqual( queryAll(".inactive-indicator").index(), -1, "there is no inactive themes separator when all themes are inactive" ); - assert.equal(count(".themes-list-item"), 5, "displays all themes"); + assert.strictEqual(count(".themes-list-item"), 5, "displays all themes"); [2, 3].forEach((num) => this.themes[num].set("user_selectable", true)); this.themes[4].set("default", true); @@ -74,7 +74,7 @@ discourseModule("Integration | Component | themes-list", function (hooks) { names, "sorts themes correctly" ); - assert.equal( + assert.strictEqual( queryAll(".inactive-indicator").index(), 3, "the separator is in the right location" @@ -82,19 +82,19 @@ discourseModule("Integration | Component | themes-list", function (hooks) { this.themes.forEach((theme) => theme.set("user_selectable", true)); this.set("themes", this.themes); - assert.equal( + assert.strictEqual( queryAll(".inactive-indicator").index(), -1, "there is no inactive themes separator when all themes are user-selectable" ); this.set("themes", []); - assert.equal( + assert.strictEqual( count(".themes-list-item"), 1, "shows one entry with a message when there is nothing to display" ); - assert.equal( + assert.strictEqual( queryAll(".themes-list-item span.empty").text().trim(), I18n.t("admin.customize.theme.empty"), "displays the right message" @@ -122,31 +122,35 @@ discourseModule("Integration | Component | themes-list", function (hooks) { }, test(assert) { - assert.equal( + assert.strictEqual( queryAll(".components-tab").hasClass("active"), true, "components tab is active" ); - assert.equal( + assert.strictEqual( queryAll(".themes-tab").hasClass("active"), false, "themes tab is not active" ); - assert.equal( + assert.strictEqual( queryAll(".inactive-indicator").index(), -1, "there is no separator" ); - assert.equal(count(".themes-list-item"), 5, "displays all components"); + assert.strictEqual( + count(".themes-list-item"), + 5, + "displays all components" + ); this.set("components", []); - assert.equal( + assert.strictEqual( count(".themes-list-item"), 1, "shows one entry with a message when there is nothing to display" ); - assert.equal( + assert.strictEqual( queryAll(".themes-list-item span.empty").text().trim(), I18n.t("admin.customize.theme.empty"), "displays the right message" @@ -228,7 +232,7 @@ discourseModule("Integration | Component | themes-list", function (hooks) { }, async test(assert) { await fillIn(".themes-list-filter .filter-input", "11"); - assert.equal( + assert.strictEqual( query(".themes-list-container").textContent.trim(), "Theme 11", "only 1 theme is shown" @@ -273,14 +277,14 @@ discourseModule("Integration | Component | themes-list", function (hooks) { ); await fillIn(".themes-list-filter .filter-input", "66"); - assert.equal( + assert.strictEqual( query(".themes-list-container").textContent.trim(), "Component 66", "only 1 component is shown" ); await click(".themes-list-header .themes-tab"); - assert.equal( + assert.strictEqual( query(".themes-list-container").textContent.trim(), "Theme 66", "filter term persisted between tabs because both have more than 10 items" diff --git a/app/assets/javascripts/discourse/tests/integration/components/time-input-test.js b/app/assets/javascripts/discourse/tests/integration/components/time-input-test.js index 3a4da4eaf33..2a06b622684 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/time-input-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/time-input-test.js @@ -24,7 +24,7 @@ discourseModule("Integration | Component | time-input", function (hooks) { }, test(assert) { - assert.equal(this.subject.header().name(), "14:58"); + assert.strictEqual(this.subject.header().name(), "14:58"); }, }); @@ -38,7 +38,7 @@ discourseModule("Integration | Component | time-input", function (hooks) { async test(assert) { await this.subject.expand(); await this.subject.selectRowByIndex(3); - assert.equal(this.subject.header().name(), "14:58"); + assert.strictEqual(this.subject.header().name(), "14:58"); }, }); @@ -53,7 +53,7 @@ discourseModule("Integration | Component | time-input", function (hooks) { async test(assert) { await this.subject.expand(); await this.subject.selectRowByIndex(3); - assert.equal(this.subject.header().name(), "00:45"); + assert.strictEqual(this.subject.header().name(), "00:45"); }, }); }); diff --git a/app/assets/javascripts/discourse/tests/integration/components/topic-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/topic-list-test.js index 971e7488baf..7d0cd8db84a 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/topic-list-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/topic-list-test.js @@ -40,12 +40,12 @@ discourseModule("Integration | Component | topic-list", function (hooks) { }, async test(assert) { - assert.equal(this.selected.length, 0, "defaults to 0"); + assert.strictEqual(this.selected.length, 0, "defaults to 0"); await click("button.bulk-select"); assert.ok(this.bulkSelectEnabled, "bulk select is enabled"); await click("button.bulk-select-all"); - assert.equal( + assert.strictEqual( this.selected.length, 2, "clicking Select All selects all loaded topics" @@ -56,7 +56,7 @@ discourseModule("Integration | Component | topic-list", function (hooks) { ); await click("button.bulk-clear-all"); - assert.equal( + assert.strictEqual( this.selected.length, 0, "clicking Clear All deselects all topics" diff --git a/app/assets/javascripts/discourse/tests/integration/components/uppy-image-uploader-test.js b/app/assets/javascripts/discourse/tests/integration/components/uppy-image-uploader-test.js index 1a81bb14457..41410e677f7 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/uppy-image-uploader-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/uppy-image-uploader-test.js @@ -20,13 +20,13 @@ discourseModule( `, async test(assert) { - assert.equal( + assert.strictEqual( count(".d-icon-far-image"), 1, "it displays the upload icon" ); - assert.equal( + assert.strictEqual( count(".d-icon-far-trash-alt"), 1, "it displays the trash icon" @@ -39,7 +39,7 @@ discourseModule( await click(".image-uploader-lightbox-btn"); - assert.equal( + assert.strictEqual( document.querySelectorAll(".mfp-container").length, 1, "it displays the image lightbox" @@ -51,7 +51,7 @@ discourseModule( template: hbs`{{uppy-image-uploader id="test-uppy-image-uploader"}}`, test(assert) { - assert.equal( + assert.strictEqual( count(".d-icon-far-image"), 1, "it displays the upload icon" @@ -73,7 +73,7 @@ discourseModule( template: hbs`{{uppy-image-uploader id="test-uppy-image-uploader" placeholderUrl='/images/avatar.png'}}`, test(assert) { - assert.equal( + assert.strictEqual( count(".d-icon-far-image"), 1, "it displays the upload icon" @@ -89,7 +89,7 @@ discourseModule( "it does not display the button to open image lightbox" ); - assert.equal( + assert.strictEqual( count(".placeholder-overlay"), 1, "it displays the placeholder image" diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-avatar-flair-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-avatar-flair-test.js index d9ecf2f0397..e9fc44e45c9 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/user-avatar-flair-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/user-avatar-flair-test.js @@ -64,7 +64,7 @@ discourseModule( test(assert) { assert.ok(exists(".avatar-flair"), "it has the tag"); assert.ok(exists("svg.d-icon-bars"), "it has the svg icon"); - assert.equal( + assert.strictEqual( queryAll(".avatar-flair").attr("style"), "background-color: #CC000A; color: #FFFFFA; ", "it has styles" @@ -89,7 +89,7 @@ discourseModule( test(assert) { assert.ok(exists(".avatar-flair"), "it has the tag"); assert.ok(exists("svg.d-icon-bars"), "it has the svg icon"); - assert.equal( + assert.strictEqual( queryAll(".avatar-flair").attr("style"), "background-color: #CC0005; color: #FFFFF5; ", "it has styles" @@ -114,7 +114,7 @@ discourseModule( test(assert) { assert.ok(exists(".avatar-flair"), "it has the tag"); assert.ok(exists("svg.d-icon-dice-two"), "it has the svg icon"); - assert.equal( + assert.strictEqual( queryAll(".avatar-flair").attr("style"), "background-color: #CC0002; color: #FFFFF2; ", "it has styles" @@ -139,7 +139,7 @@ discourseModule( test(assert) { assert.ok(exists(".avatar-flair"), "it has the tag"); assert.ok(exists("svg.d-icon-dice-two"), "it has the svg icon"); - assert.equal( + assert.strictEqual( queryAll(".avatar-flair").attr("style"), "background-color: #CC0002; color: #FFFFF2; ", "it has styles" @@ -189,7 +189,7 @@ discourseModule( test(assert) { assert.ok(exists(".avatar-flair"), "it has the tag"); assert.ok(exists("svg.d-icon-times"), "it has the svg icon"); - assert.equal( + assert.strictEqual( queryAll(".avatar-flair").attr("style"), "background-color: #123456; color: #B0B0B0; ", "it has styles" diff --git a/app/assets/javascripts/discourse/tests/integration/components/user-selector-test.js b/app/assets/javascripts/discourse/tests/integration/components/user-selector-test.js index 9ca7a9be2f4..0409551dca7 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/user-selector-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/user-selector-test.js @@ -23,23 +23,23 @@ discourseModule("Integration | Component | user-selector", function (hooks) { test(assert) { let element = query(".test-selector"); - assert.equal(this.get("usernames"), "evil,trout"); + assert.strictEqual(this.get("usernames"), "evil,trout"); paste(element, "zip,zap,zoom"); - assert.equal(this.get("usernames"), "evil,trout,zip,zap,zoom"); + assert.strictEqual(this.get("usernames"), "evil,trout,zip,zap,zoom"); paste(element, "evil,abc,abc,abc"); - assert.equal(this.get("usernames"), "evil,trout,zip,zap,zoom,abc"); + assert.strictEqual(this.get("usernames"), "evil,trout,zip,zap,zoom,abc"); this.set("usernames", ""); paste(element, "names with spaces"); - assert.equal(this.get("usernames"), "names,with,spaces"); + assert.strictEqual(this.get("usernames"), "names,with,spaces"); this.set("usernames", null); paste(element, "@eviltrout,@codinghorror sam"); - assert.equal(this.get("usernames"), "eviltrout,codinghorror,sam"); + assert.strictEqual(this.get("usernames"), "eviltrout,codinghorror,sam"); this.set("usernames", null); paste(element, "eviltrout\nsam\ncodinghorror"); - assert.equal(this.get("usernames"), "eviltrout,sam,codinghorror"); + assert.strictEqual(this.get("usernames"), "eviltrout,sam,codinghorror"); }, }); @@ -54,7 +54,7 @@ discourseModule("Integration | Component | user-selector", function (hooks) { test(assert) { let element = query(".test-selector"); paste(element, "roman,penar,jeff,robin"); - assert.equal(this.get("usernames"), "mark,roman,penar"); + assert.strictEqual(this.get("usernames"), "mark,roman,penar"); }, }); }); diff --git a/app/assets/javascripts/discourse/tests/integration/components/value-list-test.js b/app/assets/javascripts/discourse/tests/integration/components/value-list-test.js index 3e86f3294ad..46a8d1e207f 100644 --- a/app/assets/javascripts/discourse/tests/integration/components/value-list-test.js +++ b/app/assets/javascripts/discourse/tests/integration/components/value-list-test.js @@ -27,7 +27,7 @@ discourseModule("Integration | Component | value-list", function (hooks) { await selectKit().fillInFilter("eviltrout"); await selectKit().keyboard("Enter"); - assert.equal( + assert.strictEqual( count(".values .value"), 3, "it adds the value to the list of values" @@ -51,13 +51,13 @@ discourseModule("Integration | Component | value-list", function (hooks) { async test(assert) { await click(".values .value[data-index='0'] .remove-value-btn"); - assert.equal( + assert.strictEqual( count(".values .value"), 1, "it removes the value from the list of values" ); - assert.equal(this.values, "osama", "it removes the expected value"); + assert.strictEqual(this.values, "osama", "it removes the expected value"); await selectKit().expand(); @@ -83,7 +83,7 @@ discourseModule("Integration | Component | value-list", function (hooks) { await selectKit().expand(); await selectKit().selectRowByValue("maja"); - assert.equal( + assert.strictEqual( count(".values .value"), 3, "it adds the value to the list of values" @@ -111,7 +111,7 @@ discourseModule("Integration | Component | value-list", function (hooks) { await selectKit().fillInFilter("eviltrout"); await selectKit().selectRowByValue("eviltrout"); - assert.equal( + assert.strictEqual( count(".values .value"), 3, "it adds the value to the list of values" @@ -139,7 +139,7 @@ discourseModule("Integration | Component | value-list", function (hooks) { await selectKit().fillInFilter("eviltrout"); await selectKit().keyboard("Enter"); - assert.equal( + assert.strictEqual( count(".values .value"), 3, "it adds the value to the list of values" diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/actions-summary-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/actions-summary-test.js index 0b036d76cbf..f99a79b6697 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/actions-summary-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/actions-summary-test.js @@ -19,12 +19,12 @@ discourseModule( }); }, test(assert) { - assert.equal( + assert.strictEqual( count(".post-action .d-icon-far-trash-alt"), 1, "it has the deleted icon" ); - assert.equal( + assert.strictEqual( count(".avatar[title=eviltrout]"), 1, "it has the deleted by avatar" diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/avatar-flair-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/avatar-flair-test.js index 022b1e9f2e3..49a43589a71 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/avatar-flair-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/avatar-flair-test.js @@ -25,7 +25,7 @@ discourseModule( test(assert) { assert.ok(exists(".avatar-flair"), "it has the tag"); assert.ok(exists("svg.d-icon-bars"), "it has the svg icon"); - assert.equal( + assert.strictEqual( queryAll(".avatar-flair").attr("style"), "background-color: #CC0000; color: #FFFFFF; ", "it has styles" diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/button-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/button-test.js index 1e08782e4af..e91386951ff 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/button-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/button-test.js @@ -62,7 +62,10 @@ discourseModule("Integration | Component | Widget | button", function (hooks) { }, test(assert) { - assert.equal(query("button span.d-button-label").innerText, "foo bar"); + assert.strictEqual( + query("button span.d-button-label").innerText, + "foo bar" + ); }, }); @@ -74,7 +77,7 @@ discourseModule("Integration | Component | Widget | button", function (hooks) { }, test(assert) { - assert.equal(query("button").title, "foo bar"); + assert.strictEqual(query("button").title, "foo bar"); }, }); }); diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/default-notification-item-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/default-notification-item-test.js index 6b09fb28892..b21b598345b 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/default-notification-item-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/default-notification-item-test.js @@ -48,7 +48,7 @@ discourseModule( pretender.put("/notifications/mark-read", (request) => { ++requests; - assert.equal( + assert.strictEqual( request.requestBody, `id=${this.args.id}`, "it sets correct request parameters" @@ -72,8 +72,8 @@ discourseModule( ); await settled(); - assert.equal(count("li.read"), 1); - assert.equal(requests, 1); + assert.strictEqual(count("li.read"), 1); + assert.strictEqual(requests, 1); }, }); } diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/hamburger-menu-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/hamburger-menu-test.js index c11c5c7e3c3..a43bbf0b239 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/hamburger-menu-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/hamburger-menu-test.js @@ -124,8 +124,8 @@ discourseModule( }, test(assert) { - assert.equal(count(".category-link"), 8); - assert.equal( + assert.strictEqual(count(".category-link"), 8); + assert.strictEqual( queryAll(".category-link .category-name").text(), this.site .get("categoriesByCount") @@ -146,8 +146,8 @@ discourseModule( }, test(assert) { - assert.equal(count(".category-link"), 8); - assert.equal( + assert.strictEqual(count(".category-link"), 8); + assert.strictEqual( queryAll(".category-link .category-name").text(), this.site .get("categoriesByCount") @@ -201,7 +201,7 @@ discourseModule( }, test(assert) { - assert.equal( + assert.strictEqual( count(".category-link"), maxCategoriesToDisplay, "categories displayed limited by header_dropdown_category_count" @@ -218,7 +218,7 @@ discourseModule( .uniq() .slice(0, maxCategoriesToDisplay); - assert.equal( + assert.strictEqual( queryAll(".category-link .category-name").text(), ids .map( diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/home-logo-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/home-logo-test.js index ca23507ac78..515dcd85617 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/home-logo-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/home-logo-test.js @@ -33,11 +33,11 @@ discourseModule( }, test(assert) { - assert.equal(count(".title"), 1); + assert.strictEqual(count(".title"), 1); - assert.equal(count("img#site-logo.logo-big"), 1); - assert.equal(queryAll("#site-logo").attr("src"), bigLogo); - assert.equal(queryAll("#site-logo").attr("alt"), title); + assert.strictEqual(count("img#site-logo.logo-big"), 1); + assert.strictEqual(queryAll("#site-logo").attr("src"), bigLogo); + assert.strictEqual(queryAll("#site-logo").attr("alt"), title); }, }); @@ -51,10 +51,10 @@ discourseModule( }, test(assert) { - assert.equal(count("img.logo-small"), 1); - assert.equal(queryAll("img.logo-small").attr("src"), smallLogo); - assert.equal(queryAll("img.logo-small").attr("alt"), title); - assert.equal(queryAll("img.logo-small").attr("width"), 36); + assert.strictEqual(count("img.logo-small"), 1); + assert.strictEqual(queryAll("img.logo-small").attr("src"), smallLogo); + assert.strictEqual(queryAll("img.logo-small").attr("alt"), title); + assert.strictEqual(queryAll("img.logo-small").attr("width"), "36"); }, }); @@ -68,8 +68,8 @@ discourseModule( }, test(assert) { - assert.equal(count("h1#site-text-logo.text-logo"), 1); - assert.equal(queryAll("#site-text-logo").text(), title); + assert.strictEqual(count("h1#site-text-logo.text-logo"), 1); + assert.strictEqual(queryAll("#site-text-logo").text(), title); }, }); @@ -83,7 +83,7 @@ discourseModule( }, test(assert) { - assert.equal(count(".d-icon-home"), 1); + assert.strictEqual(count(".d-icon-home"), 1); }, }); @@ -96,8 +96,8 @@ discourseModule( }, test(assert) { - assert.equal(count("img#site-logo.logo-mobile"), 1); - assert.equal(queryAll("#site-logo").attr("src"), mobileLogo); + assert.strictEqual(count("img#site-logo.logo-mobile"), 1); + assert.strictEqual(queryAll("#site-logo").attr("src"), mobileLogo); }, }); @@ -109,8 +109,8 @@ discourseModule( }, test(assert) { - assert.equal(count("img#site-logo.logo-big"), 1); - assert.equal(queryAll("#site-logo").attr("src"), bigLogo); + assert.strictEqual(count("img#site-logo.logo-big"), 1); + assert.strictEqual(queryAll("#site-logo").attr("src"), bigLogo); }, }); @@ -126,15 +126,15 @@ discourseModule( }, test(assert) { - assert.equal(count("img#site-logo.logo-big"), 1); - assert.equal(queryAll("#site-logo").attr("src"), bigLogo); + assert.strictEqual(count("img#site-logo.logo-big"), 1); + assert.strictEqual(queryAll("#site-logo").attr("src"), bigLogo); - assert.equal( + assert.strictEqual( queryAll("picture source").attr("media"), prefersDark, "includes dark mode media attribute" ); - assert.equal( + assert.strictEqual( queryAll("picture source").attr("srcset"), darkLogo, "includes dark mode alternative logo source" @@ -157,14 +157,14 @@ discourseModule( }, test(assert) { - assert.equal(queryAll("#site-logo").attr("src"), mobileLogo); + assert.strictEqual(queryAll("#site-logo").attr("src"), mobileLogo); - assert.equal( + assert.strictEqual( queryAll("picture source").attr("media"), prefersDark, "includes dark mode media attribute" ); - assert.equal( + assert.strictEqual( queryAll("picture source").attr("srcset"), darkLogo, "includes dark mode alternative logo source" @@ -184,8 +184,8 @@ discourseModule( }, test(assert) { - assert.equal(count("img#site-logo.logo-big"), 1); - assert.equal(queryAll("#site-logo").attr("src"), bigLogo); + assert.strictEqual(count("img#site-logo.logo-big"), 1); + assert.strictEqual(queryAll("#site-logo").attr("src"), bigLogo); assert.ok(!exists("picture"), "does not include alternative logo"); }, }); @@ -198,8 +198,8 @@ discourseModule( }, test(assert) { - assert.equal(count("img#site-logo.logo-big"), 1); - assert.equal(queryAll("#site-logo").attr("src"), bigLogo); + assert.strictEqual(count("img#site-logo.logo-big"), 1); + assert.strictEqual(queryAll("#site-logo").attr("src"), bigLogo); assert.ok(!exists("picture"), "does not include alternative logo"); }, }); @@ -215,8 +215,8 @@ discourseModule( Session.currentProp("defaultColorSchemeIsDark", null); }, test(assert) { - assert.equal(count("img#site-logo.logo-big"), 1); - assert.equal( + assert.strictEqual(count("img#site-logo.logo-big"), 1); + assert.strictEqual( queryAll("#site-logo").attr("src"), darkLogo, "uses dark logo" @@ -236,8 +236,8 @@ discourseModule( Session.currentProp("defaultColorSchemeIsDark", null); }, test(assert) { - assert.equal(count("img#site-logo.logo-big"), 1); - assert.equal( + assert.strictEqual(count("img#site-logo.logo-big"), 1); + assert.strictEqual( queryAll("#site-logo").attr("src"), bigLogo, "uses regular logo on dark scheme if no dark logo" diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/post-links-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/post-links-test.js index e1d56b45083..34b78dd6a5e 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/post-links-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/post-links-test.js @@ -30,7 +30,7 @@ discourseModule( }); }, test(assert) { - assert.equal( + assert.strictEqual( count(".post-links a.track-link"), 1, "it hides the dupe link" @@ -83,9 +83,9 @@ discourseModule( }); }, async test(assert) { - assert.equal(count(".expand-links"), 1, "collapsed by default"); + assert.strictEqual(count(".expand-links"), 1, "collapsed by default"); await click("a.expand-links"); - assert.equal(count(".post-links a.track-link"), 7); + assert.strictEqual(count(".post-links a.track-link"), 7); }, }); } diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/post-menu-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/post-menu-test.js index 4c03c0c8f32..1458fa9cf7a 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/post-menu-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/post-menu-test.js @@ -31,7 +31,7 @@ discourseModule( }); }, async test(assert) { - assert.equal( + assert.strictEqual( count(".actions .extra-buttons .hot-coffee"), 1, "It renders extra button" diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/post-stream-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/post-stream-test.js index eb3a5ba6caf..76e63c55dd1 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/post-stream-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/post-stream-test.js @@ -73,54 +73,54 @@ discourseModule( }, test(assert) { - assert.equal(count(".post-stream"), 1); - assert.equal(count(".topic-post"), 6, "renders all posts"); + assert.strictEqual(count(".post-stream"), 1); + assert.strictEqual(count(".topic-post"), 6, "renders all posts"); // look for special class bindings - assert.equal( + assert.strictEqual( queryAll(".topic-post:nth-of-type(1).topic-owner").length, 1, "it applies the topic owner class" ); - assert.equal( + assert.strictEqual( queryAll(".topic-post:nth-of-type(1).group-trout").length, 1, "it applies the primary group class" ); - assert.equal( + assert.strictEqual( queryAll(".topic-post:nth-of-type(1).regular").length, 1, "it applies the regular class" ); - assert.equal( + assert.strictEqual( queryAll(".topic-post:nth-of-type(2).moderator").length, 1, "it applies the moderator class" ); - assert.equal( + assert.strictEqual( queryAll(".topic-post:nth-of-type(3).post-hidden").length, 1, "it applies the hidden class" ); - assert.equal( + assert.strictEqual( queryAll(".topic-post:nth-of-type(4).whisper").length, 1, "it applies the whisper class" ); - assert.equal( + assert.strictEqual( queryAll(".topic-post:nth-of-type(5).wiki").length, 1, "it applies the wiki class" ); // it renders an article for the body with appropriate attributes - assert.equal(count("article#post_2"), 1); - assert.equal(count('article[data-user-id="123"]'), 1); - assert.equal(count('article[data-post-id="3"]'), 1); - assert.equal(count("article#post_5.via-email"), 1); - assert.equal(count("article#post_6.is-auto-generated"), 1); + assert.strictEqual(count("article#post_2"), 1); + assert.strictEqual(count('article[data-user-id="123"]'), 1); + assert.strictEqual(count('article[data-post-id="3"]'), 1); + assert.strictEqual(count("article#post_5.via-email"), 1); + assert.strictEqual(count("article#post_6.is-auto-generated"), 1); - assert.equal( + assert.strictEqual( queryAll("article:nth-of-type(1) .main-avatar").length, 1, "renders the main avatar" @@ -143,12 +143,12 @@ discourseModule( }, test(assert) { - assert.equal( + assert.strictEqual( count(".topic-post.deleted"), 1, "it applies the deleted class" ); - assert.equal( + assert.strictEqual( count(".deleted-user-avatar"), 1, "it has the trash avatar" diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/post-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/post-test.js index 3604069da84..e66db63725a 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/post-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/post-test.js @@ -42,8 +42,8 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { }); }, async test(assert) { - assert.equal(queryAll(".badge.clicks:nth(0)").text(), "1"); - assert.equal(queryAll(".badge.clicks:nth(1)").text(), "2"); + assert.strictEqual(queryAll(".badge.clicks:nth(0)").text(), "1"); + assert.strictEqual(queryAll(".badge.clicks:nth(1)").text(), "2"); }, }); @@ -70,9 +70,9 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { }); }, async test(assert) { - assert.equal(queryAll(".badge.clicks").length, 2); - assert.equal(queryAll(".badge.clicks:nth(0)").text(), "1"); - assert.equal(queryAll(".badge.clicks:nth(1)").text(), "2"); + assert.strictEqual(queryAll(".badge.clicks").length, 2); + assert.strictEqual(queryAll(".badge.clicks:nth(0)").text(), "1"); + assert.strictEqual(queryAll(".badge.clicks:nth(1)").text(), "2"); }, }); @@ -178,8 +178,8 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { this.set("args", { isWhisper: true }); }, test(assert) { - assert.equal(count(".topic-post.whisper"), 1); - assert.equal(count(".post-info.whisper"), 1); + assert.strictEqual(count(".topic-post.whisper"), 1); + assert.strictEqual(count(".post-info.whisper"), 1); }, }); @@ -198,13 +198,13 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { this.set("args", { likeCount: 1 }); }, async test(assert) { - assert.equal(count("button.like-count"), 1); + assert.strictEqual(count("button.like-count"), 1); assert.ok(!exists(".who-liked")); // toggle it on await click("button.like-count"); - assert.equal(count(".who-liked"), 1); - assert.equal(count(".who-liked a.trigger-user-card"), 1); + assert.strictEqual(count(".who-liked"), 1); + assert.strictEqual(count(".who-liked a.trigger-user-card"), 1); // toggle it off await click("button.like-count"); @@ -255,7 +255,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { await click(".actions button.like"); assert.ok(!exists(".actions button.like")); assert.ok(exists(".actions button.has-like")); - assert.equal(count(".actions button.like-count"), 1); + assert.strictEqual(count(".actions button.like-count"), 1); await click(".actions button.has-like"); assert.ok(exists(".actions button.like")); @@ -278,7 +278,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { assert.ok(exists(".actions button.like")); assert.ok(!exists(".actions button.like-count")); - assert.equal( + assert.strictEqual( queryAll("button.like").attr("title"), I18n.t("post.controls.like"), `shows the right button title for anonymous users` @@ -366,9 +366,13 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { async test(assert) { await click(".show-more-actions"); - assert.equal(count("button.create-flag"), 1, `button is displayed`); - assert.equal(count("button.delete"), 1, `button is displayed`); - assert.equal( + assert.strictEqual( + count("button.create-flag"), + 1, + `button is displayed` + ); + assert.strictEqual(count("button.delete"), 1, `button is displayed`); + assert.strictEqual( queryAll("button.delete").attr("title"), I18n.t("post.controls.delete_topic_disallowed"), `shows the right button title for users without permissions` @@ -474,7 +478,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { this.set("showFlags", () => (this.flagsShown = true)); }, async test(assert) { - assert.equal(count("button.create-flag"), 1); + assert.strictEqual(count("button.create-flag"), 1); await click("button.create-flag"); assert.ok(this.flagsShown, "it triggered the action"); @@ -547,7 +551,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { }, test(assert) { assert.ok(exists("a.reply-to-tab"), "shows the tab"); - assert.equal(count(".avoid-tab"), 1, "has the avoid tab class"); + assert.strictEqual(count(".avoid-tab"), 1, "has the avoid tab class"); }, }); @@ -562,10 +566,10 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { this.siteSettings.suppress_reply_directly_above = false; }, async test(assert) { - assert.equal(count(".avoid-tab"), 1, "has the avoid tab class"); + assert.strictEqual(count(".avoid-tab"), 1, "has the avoid tab class"); await click("a.reply-to-tab"); - assert.equal(count("section.embedded-posts.top .cooked"), 1); - assert.equal(count("section.embedded-posts .d-icon-arrow-up"), 1); + assert.strictEqual(count("section.embedded-posts.top .cooked"), 1); + assert.strictEqual(count("section.embedded-posts .d-icon-arrow-up"), 1); }, }); @@ -617,7 +621,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { this.set("toggleBookmark", () => (args.bookmarked = true)); }, async test(assert) { - assert.equal(count(".post-menu-area .bookmark"), 1); + assert.strictEqual(count(".post-menu-area .bookmark"), 1); assert.ok(!exists("button.bookmarked")); }, }); @@ -640,7 +644,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { async test(assert) { assert.ok(!exists(".post-admin-menu")); await click(".post-menu-area .show-post-admin-menu"); - assert.equal(count(".post-admin-menu"), 1, "it shows the popup"); + assert.strictEqual(count(".post-admin-menu"), 1, "it shows the popup"); await click(".post-menu-area"); assert.ok( !exists(".post-admin-menu"), @@ -805,7 +809,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { this.set("args", { replyCount: 2, replyDirectlyBelow: true }); }, test(assert) { - assert.equal(count("button.show-replies"), 1); + assert.strictEqual(count("button.show-replies"), 1); }, }); @@ -828,8 +832,8 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { }, async test(assert) { await click("button.show-replies"); - assert.equal(count("section.embedded-posts.bottom .cooked"), 1); - assert.equal(count("section.embedded-posts .d-icon-arrow-down"), 1); + assert.strictEqual(count("section.embedded-posts.bottom .cooked"), 1); + assert.strictEqual(count("section.embedded-posts .d-icon-arrow-down"), 1); }, }); @@ -859,7 +863,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { ); await click("nav.buttons button"); - assert.equal( + assert.strictEqual( count(".topic-map-expanded a.poster"), 2, "shows all when expanded" @@ -883,7 +887,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { }); }, async test(assert) { - assert.equal( + assert.strictEqual( count("li.avatars a.poster"), 3, "limits to three participants" @@ -891,12 +895,12 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { await click("nav.buttons button"); assert.ok(!exists("li.avatars a.poster")); - assert.equal( + assert.strictEqual( count(".topic-map-expanded a.poster"), 4, "shows all when expanded" ); - assert.equal(count("a.poster.toggled"), 2, "two are toggled"); + assert.strictEqual(count("a.poster.toggled"), 2, "two are toggled"); }, }); @@ -916,22 +920,22 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { }); }, async test(assert) { - assert.equal(count(".topic-map"), 1); - assert.equal(count(".map.map-collapsed"), 1); + assert.strictEqual(count(".topic-map"), 1); + assert.strictEqual(count(".map.map-collapsed"), 1); assert.ok(!exists(".topic-map-expanded")); await click("nav.buttons button"); assert.ok(!exists(".map.map-collapsed")); - assert.equal(count(".topic-map .d-icon-chevron-up"), 1); - assert.equal(count(".topic-map-expanded"), 1); - assert.equal( + assert.strictEqual(count(".topic-map .d-icon-chevron-up"), 1); + assert.strictEqual(count(".topic-map-expanded"), 1); + assert.strictEqual( count(".topic-map-expanded .topic-link"), 5, "it limits the links displayed" ); await click(".link-summary button"); - assert.equal( + assert.strictEqual( count(".topic-map-expanded .topic-link"), 6, "all links now shown" @@ -956,7 +960,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { this.set("showSummary", () => (this.summaryToggled = true)); }, async test(assert) { - assert.equal(count(".toggle-summary"), 1); + assert.strictEqual(count(".toggle-summary"), 1); await click(".toggle-summary button"); assert.ok(this.summaryToggled); @@ -974,8 +978,8 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { }); }, test(assert) { - assert.equal(count(".private-message-map"), 1); - assert.equal(count(".private-message-map .user"), 1); + assert.strictEqual(count(".private-message-map"), 1); + assert.strictEqual(count(".private-message-map .user"), 1); }, }); @@ -998,7 +1002,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { }); }, test(assert) { - assert.equal( + assert.strictEqual( queryAll(".post-notice.returning-user:not(.old)").text().trim(), I18n.t("post.notice.returning_user", { user: "codinghorror", @@ -1022,7 +1026,7 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { }); }, test(assert) { - assert.equal( + assert.strictEqual( queryAll(".post-notice.old.new-user").text().trim(), I18n.t("post.notice.new_user", { user: "Jeff", time: "Jan '10" }) ); @@ -1039,8 +1043,8 @@ discourseModule("Integration | Component | Widget | post", function (hooks) { }, test(assert) { const link = queryAll(".group-request a"); - assert.equal(link.text().trim(), I18n.t("groups.requests.handle")); - assert.equal(link.attr("href"), "/g/testGroup/requests?filter=foo"); + assert.strictEqual(link.text().trim(), I18n.t("groups.requests.handle")); + assert.strictEqual(link.attr("href"), "/g/testGroup/requests?filter=foo"); }, }); }); diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/poster-name-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/poster-name-test.js index b46077a3d33..4b62324e76c 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/poster-name-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/poster-name-test.js @@ -27,9 +27,9 @@ discourseModule( assert.ok(exists(".names")); assert.ok(exists("span.username")); assert.ok(exists('a[data-user-card="eviltrout"]')); - assert.equal(queryAll(".username a").text(), "eviltrout"); - assert.equal(queryAll(".full-name a").text(), "Robin Ward"); - assert.equal(queryAll(".user-title").text(), "Trout Master"); + assert.strictEqual(queryAll(".username a").text(), "eviltrout"); + assert.strictEqual(queryAll(".full-name a").text(), "Robin Ward"); + assert.strictEqual(queryAll(".user-title").text(), "Trout Master"); }, }); diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/quick-access-item-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/quick-access-item-test.js index 69a9f9525e2..be52259f424 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/quick-access-item-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/quick-access-item-test.js @@ -20,7 +20,7 @@ discourseModule( test(assert) { const contentDiv = query(CONTENT_DIV_SELECTOR); - assert.equal(contentDiv.innerText, "bold"); + assert.strictEqual(contentDiv.innerText, "bold"); }, }); @@ -33,7 +33,7 @@ discourseModule( test(assert) { const contentDiv = query(CONTENT_DIV_SELECTOR); - assert.equal(contentDiv.innerText, '"quote"'); + assert.strictEqual(contentDiv.innerText, '"quote"'); }, }); } diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/small-user-list-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/small-user-list-test.js index 3488879b19f..b79df35d367 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/small-user-list-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/small-user-list-test.js @@ -24,7 +24,7 @@ discourseModule( }); }, async test(assert) { - assert.equal(count('[data-user-card="eviltrout"]'), 1); + assert.strictEqual(count('[data-user-card="eviltrout"]'), 1); assert.ok(!exists('[data-user-card="someone"]')); assert.ok(exists(".unknown"), "includes unknown user"); }, diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/software-update-prompt-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/software-update-prompt-test.js index 881f94aa95a..21aee3a4473 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/software-update-prompt-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/software-update-prompt-test.js @@ -30,7 +30,7 @@ discourseModule( const done = assert.async(); later(() => { - assert.equal( + assert.strictEqual( count("div.software-update-prompt.require-software-refresh"), 1, "it does have the class to show the prompt" diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/user-menu-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/user-menu-test.js index f41fd83fc34..91dbd076f23 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/user-menu-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/user-menu-test.js @@ -37,7 +37,7 @@ discourseModule( async test(assert) { const $links = queryAll(".quick-access-panel li a"); - assert.equal($links.length, 6); + assert.strictEqual($links.length, 6); assert.ok($links[1].href.includes("/t/a-slug/123")); assert.ok( @@ -46,7 +46,7 @@ discourseModule( ) ); - assert.equal( + assert.strictEqual( $links[2].text, `aquaman ${I18n.t("notifications.liked_consolidated_description", { count: 5, diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/widget-dropdown-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/widget-dropdown-test.js index 2b298090b49..b6942f5d16b 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/widget-dropdown-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/widget-dropdown-test.js @@ -95,7 +95,7 @@ discourseModule( }, test(assert) { - assert.equal(headerLabel(), "FooBaz"); + assert.strictEqual(headerLabel(), "FooBaz"); }, }); @@ -115,7 +115,7 @@ discourseModule( }, test(assert) { - assert.equal(headerLabel(), this.translatedLabel); + assert.strictEqual(headerLabel(), this.translatedLabel); }, }); @@ -128,9 +128,9 @@ discourseModule( async test(assert) { await toggle(); - assert.equal(rowById(1).dataset.id, 1, "it creates rows"); - assert.equal(rowById(2).dataset.id, 2, "it creates rows"); - assert.equal(rowById(3).dataset.id, 3, "it creates rows"); + assert.strictEqual(rowById(1).dataset.id, "1", "it creates rows"); + assert.strictEqual(rowById(2).dataset.id, "2", "it creates rows"); + assert.strictEqual(rowById(3).dataset.id, "3", "it creates rows"); }, }); @@ -157,9 +157,9 @@ discourseModule( async test(assert) { await toggle(); await clickRowById(2); - assert.equal( + assert.strictEqual( queryAll("#test").text(), - 2, + "2", "it calls the onChange actions" ); }, @@ -176,7 +176,7 @@ discourseModule( assert.ok(exists("#my-dropdown.closed")); assert.ok(!exists("#my-dropdown .widget-dropdown-body")); await toggle(); - assert.equal(rowById(2).innerText.trim(), "FooBar"); + assert.strictEqual(rowById(2).innerText.trim(), "FooBar"); assert.ok(exists("#my-dropdown.opened")); assert.ok(exists("#my-dropdown .widget-dropdown-body")); await toggle(); @@ -220,7 +220,7 @@ discourseModule( async test(assert) { await toggle(); - assert.equal(rowById(2).innerText.trim(), "FooBar"); + assert.strictEqual(rowById(2).innerText.trim(), "FooBar"); }, }); @@ -240,7 +240,7 @@ discourseModule( async test(assert) { await toggle(); - assert.equal(rowById(1).innerText.trim(), "FooBaz"); + assert.strictEqual(rowById(1).innerText.trim(), "FooBaz"); }, }); @@ -266,7 +266,10 @@ discourseModule( async test(assert) { await toggle(); - assert.equal(rowById(4).innerHTML.trim(), "baz"); + assert.strictEqual( + rowById(4).innerHTML.trim(), + "baz" + ); }, }); @@ -360,7 +363,7 @@ discourseModule( async test(assert) { await toggle(); - assert.equal(rowById(1), undefined, "it does not display options"); + assert.strictEqual(rowById(1), null, "it does not display options"); }, }); diff --git a/app/assets/javascripts/discourse/tests/integration/widgets/widget-test.js b/app/assets/javascripts/discourse/tests/integration/widgets/widget-test.js index d8f7198f5a9..6151faab179 100644 --- a/app/assets/javascripts/discourse/tests/integration/widgets/widget-test.js +++ b/app/assets/javascripts/discourse/tests/integration/widgets/widget-test.js @@ -33,7 +33,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { }, test(assert) { - assert.equal(queryAll(".test").text(), "Hello Robin"); + assert.strictEqual(queryAll(".test").text(), "Hello Robin"); }, }); @@ -51,7 +51,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { }, test(assert) { - assert.equal(queryAll(".base-url-test").text(), "/"); + assert.strictEqual(queryAll(".base-url-test").text(), "/"); }, }); @@ -67,7 +67,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { }, test(assert) { - assert.equal(queryAll("div.test").text(), "Hello Robin"); + assert.strictEqual(queryAll("div.test").text(), "Hello Robin"); }, }); @@ -84,7 +84,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { }, test(assert) { - assert.equal(queryAll("div.test").text(), "Hello Robin"); + assert.strictEqual(queryAll("div.test").text(), "Hello Robin"); }, }); @@ -98,7 +98,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { }, test(assert) { - assert.equal(queryAll("div.mydiv").data("my-test"), "hello world"); + assert.strictEqual(queryAll("div.mydiv").data("my-test"), "hello world"); }, }); @@ -182,10 +182,10 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { async test(assert) { assert.ok(exists("button.test"), "it renders the button"); - assert.equal(queryAll("button.test").text(), "0 clicks"); + assert.strictEqual(queryAll("button.test").text(), "0 clicks"); await click(query("button")); - assert.equal(queryAll("button.test").text(), "1 clicks"); + assert.strictEqual(queryAll("button.test").text(), "1 clicks"); }, }); @@ -216,10 +216,10 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { }, async test(assert) { - assert.equal(queryAll("button.test").text().trim(), "No name"); + assert.strictEqual(queryAll("button.test").text().trim(), "No name"); await click(query("button")); - assert.equal(queryAll("button.test").text().trim(), "Robin"); + assert.strictEqual(queryAll("button.test").text().trim(), "Robin"); }, }); @@ -276,7 +276,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { test(assert) { assert.ok(exists(".container"), "renders container"); - assert.equal(queryAll(".container .value").text(), "hello world"); + assert.strictEqual(queryAll(".container .value").text(), "hello world"); }, }); @@ -300,7 +300,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { test(assert) { assert.ok(queryAll(".container").length, "renders container"); - assert.equal(queryAll(".container .value").text(), "hello world"); + assert.strictEqual(queryAll(".container .value").text(), "hello world"); }, }); @@ -314,7 +314,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { }, test(assert) { - assert.equal(count(".d-icon-arrow-down"), 1); + assert.strictEqual(count(".d-icon-arrow-down"), 1); }, }); @@ -348,9 +348,9 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { test(assert) { // coming up - assert.equal(queryAll("span.string").text(), "evil"); - assert.equal(queryAll("span.var").text(), "trout"); - assert.equal(queryAll("a").prop("title"), "evil"); + assert.strictEqual(queryAll("span.string").text(), "evil"); + assert.strictEqual(queryAll("span.var").text(), "trout"); + assert.strictEqual(queryAll("a").prop("title"), "evil"); }, }); @@ -373,8 +373,8 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { }, test(assert) { - assert.equal(count("ul li"), 3); - assert.equal(queryAll("ul li:nth-of-type(1)").text(), "one"); + assert.strictEqual(count("ul li"), 3); + assert.strictEqual(queryAll("ul li:nth-of-type(1)").text(), "one"); }, }); @@ -400,8 +400,8 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { test(assert) { assert.ok(exists(".decorate")); - assert.equal(queryAll(".decorate b").text(), "before"); - assert.equal(queryAll(".decorate i").text(), "after"); + assert.strictEqual(queryAll(".decorate b").text(), "before"); + assert.strictEqual(queryAll(".decorate i").text(), "after"); }, }); @@ -417,7 +417,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { }, test(assert) { - assert.equal(queryAll(".settings").text(), "age is 36"); + assert.strictEqual(queryAll(".settings").text(), "age is 36"); }, }); @@ -437,7 +437,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { }, test(assert) { - assert.equal(queryAll(".settings").text(), "age is 37"); + assert.strictEqual(queryAll(".settings").text(), "age is 37"); }, }); @@ -457,7 +457,7 @@ discourseModule("Integration | Component | Widget | base", function (hooks) { }, test(assert) { - assert.equal(queryAll("div.test").text(), "Hello eviltrout"); + assert.strictEqual(queryAll("div.test").text(), "Hello eviltrout"); }, }); diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/avatar-selector-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/avatar-selector-test.js index a0bd81e1347..5fccc71c59b 100644 --- a/app/assets/javascripts/discourse/tests/unit/controllers/avatar-selector-test.js +++ b/app/assets/javascripts/discourse/tests/unit/controllers/avatar-selector-test.js @@ -23,21 +23,21 @@ discourseModule("Unit | Controller | avatar-selector", function (hooks) { }); user.set("avatar_template", "system"); - assert.equal( + assert.strictEqual( avatarSelectorController.get("selectedUploadId"), 1, "we are using system by default" ); user.set("avatar_template", "gravatar"); - assert.equal( + assert.strictEqual( avatarSelectorController.get("selectedUploadId"), 2, "we are using gravatar when set" ); user.set("avatar_template", "avatar"); - assert.equal( + assert.strictEqual( avatarSelectorController.get("selectedUploadId"), 3, "we are using custom when set" diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/create-account-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/create-account-test.js index efaab7dbf7c..a361bf19e7f 100644 --- a/app/assets/javascripts/discourse/tests/unit/controllers/create-account-test.js +++ b/app/assets/javascripts/discourse/tests/unit/controllers/create-account-test.js @@ -10,14 +10,14 @@ discourseModule("Unit | Controller | create-account", function () { let validation = controller.basicUsernameValidation(username); assert.ok(validation.failed, "username should be invalid: " + username); - assert.equal( + assert.strictEqual( validation.reason, expectedReason, "username validation reason: " + username + ", " + expectedReason ); }; - testInvalidUsername("", undefined); + testInvalidUsername("", null); testInvalidUsername("x", I18n.t("user.username.too_short")); testInvalidUsername( "123456789012345678901", @@ -32,7 +32,7 @@ discourseModule("Unit | Controller | create-account", function () { let validation = controller.basicUsernameValidation("porkchops"); assert.ok(validation.ok, "Prefilled username is valid"); - assert.equal( + assert.strictEqual( validation.reason, I18n.t("user.username.prefilled"), "Prefilled username is valid" @@ -48,12 +48,12 @@ discourseModule("Unit | Controller | create-account", function () { controller.set("prefilledUsername", "porkchops"); controller.set("accountPassword", "b4fcdae11f9167"); - assert.equal( + assert.strictEqual( controller.get("passwordValidation.ok"), true, "Password is ok" ); - assert.equal( + assert.strictEqual( controller.get("passwordValidation.reason"), I18n.t("user.password.ok"), "Password is valid" @@ -62,19 +62,19 @@ discourseModule("Unit | Controller | create-account", function () { const testInvalidPassword = (password, expectedReason) => { controller.set("accountPassword", password); - assert.equal( + assert.strictEqual( controller.get("passwordValidation.failed"), true, "password should be invalid: " + password ); - assert.equal( + assert.strictEqual( controller.get("passwordValidation.reason"), expectedReason, "password validation reason: " + password + ", " + expectedReason ); }; - testInvalidPassword("", undefined); + testInvalidPassword("", null); testInvalidPassword("x", I18n.t("user.password.too_short")); testInvalidPassword("porkchops", I18n.t("user.password.same_as_username")); testInvalidPassword( @@ -86,13 +86,13 @@ discourseModule("Unit | Controller | create-account", function () { test("authProviderDisplayName", async function (assert) { const controller = this.owner.lookup("controller:create-account"); - assert.equal( + assert.strictEqual( controller.authProviderDisplayName("facebook"), I18n.t("login.facebook.name"), "provider name is translated correctly" ); - assert.equal( + assert.strictEqual( controller.authProviderDisplayName("idontexist"), "idontexist", "provider name falls back if not found" diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/history-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/history-test.js index ac1d7a6281e..e82b084c833 100644 --- a/app/assets/javascripts/discourse/tests/unit/controllers/history-test.js +++ b/app/assets/javascripts/discourse/tests/unit/controllers/history-test.js @@ -10,7 +10,7 @@ discourseModule("Unit | Controller | history", function () { topicController: {}, }); - assert.equal( + assert.strictEqual( HistoryController.get("displayEdit"), false, "it should not display edit button when user cannot edit the post" @@ -18,14 +18,14 @@ discourseModule("Unit | Controller | history", function () { HistoryController.set("model.can_edit", true); - assert.equal( + assert.strictEqual( HistoryController.get("displayEdit"), true, "it should display edit button when user can edit the post" ); HistoryController.set("topicController", null); - assert.equal( + assert.strictEqual( HistoryController.get("displayEdit"), false, "it should not display edit button when there is not topic controller" @@ -33,7 +33,7 @@ discourseModule("Unit | Controller | history", function () { HistoryController.set("topicController", {}); HistoryController.set("model.current_revision", 2); - assert.equal( + assert.strictEqual( HistoryController.get("displayEdit"), false, "it should only display the edit button on the latest revision" @@ -109,7 +109,7 @@ discourseModule("Unit | Controller | history", function () { await HistoryController.bodyDiffChanged(); const output = HistoryController.get("bodyDiff"); - assert.equal( + assert.strictEqual( output, expectedOutput, "it keeps HTML safe and doesn't strip onebox tags" diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/preferences-account-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/preferences-account-test.js index 5209fc88508..c9598f238a4 100644 --- a/app/assets/javascripts/discourse/tests/unit/controllers/preferences-account-test.js +++ b/app/assets/javascripts/discourse/tests/unit/controllers/preferences-account-test.js @@ -20,15 +20,15 @@ discourseModule("Unit | Controller | preferences/account", function () { }, }); - assert.equal(controller.get("canUpdateAssociatedAccounts"), false); + assert.strictEqual(controller.get("canUpdateAssociatedAccounts"), false); controller.set("model.second_factor_enabled", false); - assert.equal(controller.get("canUpdateAssociatedAccounts"), false); + assert.strictEqual(controller.get("canUpdateAssociatedAccounts"), false); controller.set("model.is_anonymous", false); - assert.equal(controller.get("canUpdateAssociatedAccounts"), false); + assert.strictEqual(controller.get("canUpdateAssociatedAccounts"), false); controller.set("model.id", 1234); - assert.equal(controller.get("canUpdateAssociatedAccounts"), true); + assert.strictEqual(controller.get("canUpdateAssociatedAccounts"), true); }); }); diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/preferences-profile-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/preferences-profile-test.js index bd0f9624321..b301d717909 100644 --- a/app/assets/javascripts/discourse/tests/unit/controllers/preferences-profile-test.js +++ b/app/assets/javascripts/discourse/tests/unit/controllers/preferences-profile-test.js @@ -26,13 +26,17 @@ discourseModule("Unit | Controller | preferences/profile", function () { EmberObject.create({ value: [], field: { id: "field_3" } }), ]); controller.send("_updateUserFields"); - assert.equal( + assert.strictEqual( controller.model.user_fields.field_1, "2", "updates string value" ); - assert.equal(controller.model.user_fields.field_2, null, "updates null"); - assert.equal( + assert.strictEqual( + controller.model.user_fields.field_2, + null, + "updates null" + ); + assert.strictEqual( controller.model.user_fields.field_3, null, "updates empty array as null" diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/preferences-second-factor-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/preferences-second-factor-test.js index d4194011fc2..604c59dbb83 100644 --- a/app/assets/javascripts/discourse/tests/unit/controllers/preferences-second-factor-test.js +++ b/app/assets/javascripts/discourse/tests/unit/controllers/preferences-second-factor-test.js @@ -8,6 +8,6 @@ discourseModule("Unit | Controller | preferences/second-factor", function () { enable_google_oauth2_logins: true, }, }); - assert.equal(controller.get("displayOAuthWarning"), true); + assert.strictEqual(controller.get("displayOAuthWarning"), true); }); }); diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/reorder-categories-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/reorder-categories-test.js index 821b2cbb85c..d88ee256a97 100644 --- a/app/assets/javascripts/discourse/tests/unit/controllers/reorder-categories-test.js +++ b/app/assets/javascripts/discourse/tests/unit/controllers/reorder-categories-test.js @@ -17,7 +17,7 @@ discourseModule("Unit | Controller | reorder-categories", function () { controller.reorder(); controller.get("categoriesOrdered").forEach((category, index) => { - assert.equal(category.get("position"), index); + assert.strictEqual(category.get("position"), index); }); }); diff --git a/app/assets/javascripts/discourse/tests/unit/controllers/topic-test.js b/app/assets/javascripts/discourse/tests/unit/controllers/topic-test.js index 6920e74a485..7da6519769c 100644 --- a/app/assets/javascripts/discourse/tests/unit/controllers/topic-test.js +++ b/app/assets/javascripts/discourse/tests/unit/controllers/topic-test.js @@ -51,8 +51,8 @@ discourseModule("Unit | Controller | topic", function (hooks) { controller.get("editingTopic"), "calling editTopic enables editing if the user can edit" ); - assert.equal(controller.get("buffered.title"), model.get("title")); - assert.equal( + assert.strictEqual(controller.get("buffered.title"), model.get("title")); + assert.strictEqual( controller.get("buffered.category_id"), model.get("category_id") ); @@ -103,7 +103,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { ); controller.get("selectedPostIds").pushObject(1); - assert.equal(controller.get("selectedPostIds.length"), 1); + assert.strictEqual(controller.get("selectedPostIds.length"), 1); controller.send("toggleMultiSelect"); await settled(); @@ -112,14 +112,14 @@ discourseModule("Unit | Controller | topic", function (hooks) { controller.get("multiSelect"), "calling 'toggleMultiSelect' once enables multi selection mode" ); - assert.equal( + assert.strictEqual( controller.get("selectedPostIds.length"), 0, "toggling 'multiSelect' clears 'selectedPostIds'" ); controller.get("selectedPostIds").pushObject(2); - assert.equal(controller.get("selectedPostIds.length"), 1); + assert.strictEqual(controller.get("selectedPostIds.length"), 1); controller.send("toggleMultiSelect"); await settled(); @@ -128,7 +128,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { controller.get("multiSelect"), "calling 'toggleMultiSelect' twice disables multi selection mode" ); - assert.equal( + assert.strictEqual( controller.get("selectedPostIds.length"), 0, "toggling 'multiSelect' clears 'selectedPostIds'" @@ -141,7 +141,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { controller.set("selectedPostIds", [1, 2, 42]); - assert.equal( + assert.strictEqual( controller.get("selectedPosts.length"), 2, "selectedPosts only contains already loaded posts" @@ -197,7 +197,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { const controller = this.getController("topic", { model }); const selectedPostIds = controller.get("selectedPostIds"); - assert.equal( + assert.strictEqual( controller.get("selectedPostsUsername"), undefined, "no username when no selected posts" @@ -205,7 +205,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { selectedPostIds.pushObject(1); - assert.equal( + assert.strictEqual( controller.get("selectedPostsUsername"), "gary", "username of the selected posts" @@ -213,7 +213,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { selectedPostIds.pushObject(2); - assert.equal( + assert.strictEqual( controller.get("selectedPostsUsername"), "gary", "username of all the selected posts when same user" @@ -221,7 +221,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { selectedPostIds.pushObject(3); - assert.equal( + assert.strictEqual( controller.get("selectedPostsUsername"), undefined, "no username when more than 1 user" @@ -229,7 +229,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { selectedPostIds.replace(2, 1, [42]); - assert.equal( + assert.strictEqual( controller.get("selectedPostsUsername"), undefined, "no username when not already loaded posts are selected" @@ -455,7 +455,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { let model = topicWithStream({ stream: [1, 2, 3] }); const controller = this.getController("topic", { model }); - assert.equal( + assert.strictEqual( controller.get("selectedPostsCount"), 0, "no posts selected by default" @@ -463,7 +463,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { controller.send("selectAll"); - assert.equal( + assert.strictEqual( controller.get("selectedPostsCount"), 3, "calling 'selectAll' selects all posts" @@ -471,7 +471,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { controller.send("deselectAll"); - assert.equal( + assert.strictEqual( controller.get("selectedPostsCount"), 0, "calling 'deselectAll' deselects all posts" @@ -482,11 +482,15 @@ discourseModule("Unit | Controller | topic", function (hooks) { const controller = this.getController("topic"); const selectedPostIds = controller.get("selectedPostIds"); - assert.equal(selectedPostIds[0], undefined, "no posts selected by default"); + assert.strictEqual( + selectedPostIds[0], + undefined, + "no posts selected by default" + ); controller.send("togglePostSelection", { id: 1 }); - assert.equal( + assert.strictEqual( selectedPostIds[0], 1, "adds the selected post id if not already selected" @@ -494,7 +498,7 @@ discourseModule("Unit | Controller | topic", function (hooks) { controller.send("togglePostSelection", { id: 1 }); - assert.equal( + assert.strictEqual( selectedPostIds[0], undefined, "removes the selected post id if already selected" @@ -516,14 +520,30 @@ discourseModule("Unit | Controller | topic", function (hooks) { const controller = this.getController("topic", { site, model }); let selectedPostIds = controller.get("selectedPostIds"); - assert.equal(selectedPostIds[0], undefined, "no posts selected by default"); + assert.strictEqual( + selectedPostIds[0], + undefined, + "no posts selected by default" + ); controller.send("selectBelow", { id: 3 }); - assert.equal(selectedPostIds[0], 3, "selected post #3"); - assert.equal(selectedPostIds[1], 4, "also selected 1st post below post #3"); - assert.equal(selectedPostIds[2], 5, "also selected 2nd post below post #3"); - assert.equal(selectedPostIds[3], 8, "also selected 3rd post below post #3"); + assert.strictEqual(selectedPostIds[0], 3, "selected post #3"); + assert.strictEqual( + selectedPostIds[1], + 4, + "also selected 1st post below post #3" + ); + assert.strictEqual( + selectedPostIds[2], + 5, + "also selected 2nd post below post #3" + ); + assert.strictEqual( + selectedPostIds[3], + 8, + "also selected 3rd post below post #3" + ); }); test("topVisibleChanged", function (assert) { @@ -533,11 +553,11 @@ discourseModule("Unit | Controller | topic", function (hooks) { const controller = this.getController("topic", { model }); const placeholder = new Placeholder("post-placeholder"); - assert.equal( + assert.strictEqual( controller.send("topVisibleChanged", { post: placeholder, }), - null, + undefined, "it should work with a post-placeholder" ); }); diff --git a/app/assets/javascripts/discourse/tests/unit/ember/resolver-test.js b/app/assets/javascripts/discourse/tests/unit/ember/resolver-test.js index 155af390152..3392c1ce2dd 100644 --- a/app/assets/javascripts/discourse/tests/unit/ember/resolver-test.js +++ b/app/assets/javascripts/discourse/tests/unit/ember/resolver-test.js @@ -7,7 +7,7 @@ let resolver; function lookupTemplate(assert, name, expectedTemplate, message) { let parseName = resolver.parseName(name); let result = resolver.resolveTemplate(parseName); - assert.equal(result, expectedTemplate, message); + assert.strictEqual(result, expectedTemplate, message); } function setTemplates(lookupTemplateStrings) { diff --git a/app/assets/javascripts/discourse/tests/unit/lib/bookmark-test.js b/app/assets/javascripts/discourse/tests/unit/lib/bookmark-test.js index 68c83e398a1..476a9c760ab 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/bookmark-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/bookmark-test.js @@ -16,7 +16,7 @@ module("Unit | Utility | bookmark", function (hooks) { let reminderAtDate = moment .tz(reminderAt, "Australia/Brisbane") .format("H:mm a"); - assert.equal( + assert.strictEqual( formattedReminderTime(reminderAt, "Australia/Brisbane"), "tomorrow at " + reminderAtDate ); @@ -27,7 +27,7 @@ module("Unit | Utility | bookmark", function (hooks) { let reminderAtDate = moment .tz(reminderAt, "Australia/Brisbane") .format("H:mm a"); - assert.equal( + assert.strictEqual( formattedReminderTime(reminderAt, "Australia/Brisbane"), "today at " + reminderAtDate ); @@ -38,7 +38,7 @@ module("Unit | Utility | bookmark", function (hooks) { let reminderAtDate = moment .tz(reminderAt, "Australia/Brisbane") .format("H:mm a"); - assert.equal( + assert.strictEqual( formattedReminderTime(reminderAt, "Australia/Brisbane"), "at Apr 15, 2020 " + reminderAtDate ); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/category-badge-test.js b/app/assets/javascripts/discourse/tests/unit/lib/category-badge-test.js index 21236dec84f..35b858ef4d5 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/category-badge-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/category-badge-test.js @@ -21,16 +21,20 @@ discourseModule("Unit | Utility | category-badge", function () { }); const tag = $.parseHTML(categoryBadgeHTML(category))[0]; - assert.equal(tag.tagName, "A", "it creates a `a` wrapper tag"); - assert.equal( + assert.strictEqual(tag.tagName, "A", "it creates a `a` wrapper tag"); + assert.strictEqual( tag.className.trim(), "badge-wrapper", "it has the correct class" ); const label = tag.children[1]; - assert.equal(label.title, "cool description", "it has the correct title"); - assert.equal( + assert.strictEqual( + label.title, + "cool description", + "it has the correct title" + ); + assert.strictEqual( label.children[0].innerText, "hello", "it has the category name" @@ -52,7 +56,7 @@ discourseModule("Unit | Utility | category-badge", function () { const store = createStore(); const category = store.createRecord("category", { name: "hello", id: 123 }); - assert.equal( + assert.strictEqual( categoryBadgeHTML(category).indexOf("topic-count"), -1, "it does not include topic count by default" @@ -104,11 +108,11 @@ discourseModule("Unit | Utility | category-badge", function () { let tag = $.parseHTML(categoryBadgeHTML(rtlCategory))[0]; let dirSpan = tag.children[1].children[0]; - assert.equal(dirSpan.dir, "rtl"); + assert.strictEqual(dirSpan.dir, "rtl"); tag = $.parseHTML(categoryBadgeHTML(ltrCategory))[0]; dirSpan = tag.children[1].children[0]; - assert.equal(dirSpan.dir, "ltr"); + assert.strictEqual(dirSpan.dir, "ltr"); }); test("recursive", function (assert) { diff --git a/app/assets/javascripts/discourse/tests/unit/lib/click-track-edit-history-test.js b/app/assets/javascripts/discourse/tests/unit/lib/click-track-edit-history-test.js index c5eea3a33ab..ae13699e88d 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/click-track-edit-history-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/click-track-edit-history-test.js @@ -63,7 +63,7 @@ module("Unit | Utility | click-track-edit-history", function (hooks) { const done = assert.async(); pretender.post("/clicks/track", (request) => { - assert.equal( + assert.strictEqual( request.requestBody, "url=http%3A%2F%2Fdiscuss.domain.com&post_id=42&topic_id=1337" ); @@ -78,7 +78,7 @@ module("Unit | Utility | click-track-edit-history", function (hooks) { const done = assert.async(); pretender.post("/clicks/track", (request) => { - assert.equal( + assert.strictEqual( request.requestBody, "url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337" ); @@ -94,7 +94,7 @@ module("Unit | Utility | click-track-edit-history", function (hooks) { const done = assert.async(); pretender.post("/clicks/track", (request) => { - assert.equal( + assert.strictEqual( request.requestBody, "url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337" ); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/click-track-profile-page-test.js b/app/assets/javascripts/discourse/tests/unit/lib/click-track-profile-page-test.js index 9d74ee8f6f8..8373b517103 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/click-track-profile-page-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/click-track-profile-page-test.js @@ -56,7 +56,10 @@ module("Unit | Utility | click-track-profile-page", function (hooks) { const done = assert.async(); pretender.post("/clicks/track", (request) => { - assert.equal(request.requestBody, "url=http%3A%2F%2Fdiscuss.domain.com"); + assert.strictEqual( + request.requestBody, + "url=http%3A%2F%2Fdiscuss.domain.com" + ); done(); }); @@ -68,7 +71,7 @@ module("Unit | Utility | click-track-profile-page", function (hooks) { const done = assert.async(); pretender.post("/clicks/track", (request) => { - assert.equal( + assert.strictEqual( request.requestBody, "url=http%3A%2F%2Fwww.google.com&post_id=42&topic_id=1337" ); @@ -83,7 +86,7 @@ module("Unit | Utility | click-track-profile-page", function (hooks) { const done = assert.async(); pretender.post("/clicks/track", (request) => { - assert.equal( + assert.strictEqual( request.requestBody, "url=http%3A%2F%2Fwww.google.com&post_id=24&topic_id=7331" ); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/click-track-test.js b/app/assets/javascripts/discourse/tests/unit/lib/click-track-test.js index d7bed4aebf8..7092e24c19d 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/click-track-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/click-track-test.js @@ -189,7 +189,7 @@ module("Unit | Utility | click-track", function (hooks) { let link = fixture("a"); assert.ok(link.classList.contains("no-href")); - assert.equal(link.dataset.href, "http://www.google.com/"); + assert.strictEqual(link.dataset.href, "http://www.google.com/"); assert.blank(link.getAttribute("href")); assert.ok(link.dataset.autoRoute); assert.ok(window.open.calledWith("http://www.google.com/", "_blank")); @@ -204,7 +204,10 @@ module("Unit | Utility | click-track", function (hooks) { const done = assert.async(); later(() => { - assert.equal(fixture("a").getAttribute("href"), "http://www.google.com"); + assert.strictEqual( + fixture("a").getAttribute("href"), + "http://www.google.com" + ); done(); }); }); @@ -212,7 +215,7 @@ module("Unit | Utility | click-track", function (hooks) { function badgeClickCount(assert, id, expected) { track(generateClickEventOn(`#${id}`)); const badge = fixture(`#${id}`).querySelector("span.badge"); - assert.equal(parseInt(badge.innerHTML, 10), expected); + assert.strictEqual(parseInt(badge.innerHTML, 10), expected); } test("does not update badge clicks on my own link", async function (assert) { diff --git a/app/assets/javascripts/discourse/tests/unit/lib/computed-test.js b/app/assets/javascripts/discourse/tests/unit/lib/computed-test.js index e8d7cd3db90..6bb55daa138 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/computed-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/computed-test.js @@ -33,7 +33,7 @@ discourseModule("Unit | Utility | computed", function (hooks) { }).create(); this.siteSettings.vehicle = "airplane"; - assert.equal( + assert.strictEqual( t.get("vehicle"), "airplane", "it has the value of the site setting" @@ -79,25 +79,25 @@ discourseModule("Unit | Utility | computed", function (hooks) { mood: "happy", }); - assert.equal( + assert.strictEqual( t.get("exclaimyUsername"), "!!! eviltrout !!!", "it inserts the string" ); - assert.equal( + assert.strictEqual( t.get("multiple"), "eviltrout is happy", "it inserts multiple strings" ); t.set("username", "codinghorror"); - assert.equal( + assert.strictEqual( t.get("multiple"), "codinghorror is happy", "it supports changing properties" ); t.set("mood", "ecstatic"); - assert.equal( + assert.strictEqual( t.get("multiple"), "codinghorror is ecstatic", "it supports changing another property" @@ -113,25 +113,25 @@ discourseModule("Unit | Utility | computed", function (hooks) { mood: "happy", }); - assert.equal( + assert.strictEqual( t.get("exclaimyUsername"), "%@ translated: !!! eviltrout !!!", "it inserts the string and then translates" ); - assert.equal( + assert.strictEqual( t.get("multiple"), "%@ translated: eviltrout is happy", "it inserts multiple strings and then translates" ); t.set("username", "codinghorror"); - assert.equal( + assert.strictEqual( t.get("multiple"), "%@ translated: codinghorror is happy", "it supports changing properties" ); t.set("mood", "ecstatic"); - assert.equal( + assert.strictEqual( t.get("multiple"), "%@ translated: codinghorror is ecstatic", "it supports changing another property" @@ -146,7 +146,7 @@ discourseModule("Unit | Utility | computed", function (hooks) { }); t = testClass.create({ username: "eviltrout" }); - assert.equal( + assert.strictEqual( t.get("userUrl"), "/u/eviltrout", "it supports urls without a prefix" @@ -154,7 +154,7 @@ discourseModule("Unit | Utility | computed", function (hooks) { setPrefix("/prefixed"); t = testClass.create({ username: "eviltrout" }); - assert.equal( + assert.strictEqual( t.get("userUrl"), "/prefixed/u/eviltrout", "it supports urls with a prefix" @@ -167,6 +167,6 @@ discourseModule("Unit | Utility | computed", function (hooks) { desc: htmlSafe("cookies"), }).create({ cookies }); - assert.equal(t.get("desc").string, cookies); + assert.strictEqual(t.get("desc").string, cookies); }); }); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/emoji-store-test.js b/app/assets/javascripts/discourse/tests/unit/lib/emoji-store-test.js index fa17f404e63..45801e9da40 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/emoji-store-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/emoji-store-test.js @@ -13,12 +13,12 @@ discourseModule("Unit | Utility | emoji-emojiStore", function (hooks) { test("defaults", function (assert) { assert.deepEqual(this.emojiStore.favorites, []); - assert.equal(this.emojiStore.diversity, 1); + assert.strictEqual(this.emojiStore.diversity, 1); }); test("diversity", function (assert) { this.emojiStore.diversity = 2; - assert.equal(this.emojiStore.diversity, 2); + assert.strictEqual(this.emojiStore.diversity, 2); }); test("favorites", function (assert) { diff --git a/app/assets/javascripts/discourse/tests/unit/lib/emoji-test.js b/app/assets/javascripts/discourse/tests/unit/lib/emoji-test.js index 8c75f8efb84..e50b963a131 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/emoji-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/emoji-test.js @@ -13,7 +13,7 @@ discourseModule("Unit | Utility | emoji", function () { this.siteSettings[key] = value; } - assert.equal(emojiUnescape(input), expected, description); + assert.strictEqual(emojiUnescape(input), expected, description); for (const [key, value] of Object.entries(originalSettings)) { this.siteSettings[key] = value; @@ -132,10 +132,10 @@ discourseModule("Unit | Utility | emoji", function () { test("Emoji search", function (assert) { // able to find an alias - assert.equal(emojiSearch("+1").length, 1); + assert.strictEqual(emojiSearch("+1").length, 1); // able to find middle of line search - assert.equal(emojiSearch("check", { maxResults: 3 }).length, 3); + assert.strictEqual(emojiSearch("check", { maxResults: 3 }).length, 3); // appends diversity assert.deepEqual(emojiSearch("woman_artist", { diversity: 5 }), [ diff --git a/app/assets/javascripts/discourse/tests/unit/lib/formatter-test.js b/app/assets/javascripts/discourse/tests/unit/lib/formatter-test.js index 959719c0c3e..af36cf34359 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/formatter-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/formatter-test.js @@ -59,62 +59,74 @@ discourseModule("Unit | Utility | formatter", function (hooks) { test("formating medium length dates", function (assert) { let shortDateYear = shortDateTester("MMM D, 'YY"); - assert.equal( + assert.strictEqual( strip(formatMins(1.4, { format: "medium", leaveAgo: true })), "1 min ago" ); - assert.equal( + assert.strictEqual( strip(formatMins(2, { format: "medium", leaveAgo: true })), "2 mins ago" ); - assert.equal( + assert.strictEqual( strip(formatMins(55, { format: "medium", leaveAgo: true })), "55 mins ago" ); - assert.equal( + assert.strictEqual( strip(formatMins(56, { format: "medium", leaveAgo: true })), "1 hour ago" ); - assert.equal( + assert.strictEqual( strip(formatHours(4, { format: "medium", leaveAgo: true })), "4 hours ago" ); - assert.equal( + assert.strictEqual( strip(formatHours(22, { format: "medium", leaveAgo: true })), "22 hours ago" ); - assert.equal( + assert.strictEqual( strip(formatHours(23, { format: "medium", leaveAgo: true })), "23 hours ago" ); - assert.equal( + assert.strictEqual( strip(formatHours(23.5, { format: "medium", leaveAgo: true })), "1 day ago" ); - assert.equal( + assert.strictEqual( strip(formatDays(4.85, { format: "medium", leaveAgo: true })), "4 days ago" ); - assert.equal(strip(formatMins(0, { format: "medium" })), "just now"); - assert.equal(strip(formatMins(1.4, { format: "medium" })), "1 min"); - assert.equal(strip(formatMins(2, { format: "medium" })), "2 mins"); - assert.equal(strip(formatMins(55, { format: "medium" })), "55 mins"); - assert.equal(strip(formatMins(56, { format: "medium" })), "1 hour"); - assert.equal(strip(formatHours(4, { format: "medium" })), "4 hours"); - assert.equal(strip(formatHours(22, { format: "medium" })), "22 hours"); - assert.equal(strip(formatHours(23, { format: "medium" })), "23 hours"); - assert.equal(strip(formatHours(23.5, { format: "medium" })), "1 day"); - assert.equal(strip(formatDays(4.85, { format: "medium" })), "4 days"); + assert.strictEqual(strip(formatMins(0, { format: "medium" })), "just now"); + assert.strictEqual(strip(formatMins(1.4, { format: "medium" })), "1 min"); + assert.strictEqual(strip(formatMins(2, { format: "medium" })), "2 mins"); + assert.strictEqual(strip(formatMins(55, { format: "medium" })), "55 mins"); + assert.strictEqual(strip(formatMins(56, { format: "medium" })), "1 hour"); + assert.strictEqual(strip(formatHours(4, { format: "medium" })), "4 hours"); + assert.strictEqual( + strip(formatHours(22, { format: "medium" })), + "22 hours" + ); + assert.strictEqual( + strip(formatHours(23, { format: "medium" })), + "23 hours" + ); + assert.strictEqual(strip(formatHours(23.5, { format: "medium" })), "1 day"); + assert.strictEqual(strip(formatDays(4.85, { format: "medium" })), "4 days"); - assert.equal(strip(formatDays(6, { format: "medium" })), shortDate(6)); - assert.equal(strip(formatDays(100, { format: "medium" })), shortDate(100)); // eg: Jan 23 - assert.equal( + assert.strictEqual( + strip(formatDays(6, { format: "medium" })), + shortDate(6) + ); + assert.strictEqual( + strip(formatDays(100, { format: "medium" })), + shortDate(100) + ); // eg: Jan 23 + assert.strictEqual( strip(formatDays(500, { format: "medium" })), shortDateYear(500) ); - assert.equal( + assert.strictEqual( stringToDOMNode(formatDays(0, { format: "medium" })).title, longDate(new Date()) ); @@ -128,8 +140,11 @@ discourseModule("Unit | Utility | formatter", function (hooks) { this.clock.restore(); this.clock = sinon.useFakeTimers(new Date(2012, 0, 9, 12, 0).getTime()); // Jan 9, 2012 - assert.equal(strip(formatDays(8, { format: "medium" })), shortDate(8)); - assert.equal( + assert.strictEqual( + strip(formatDays(8, { format: "medium" })), + shortDate(8) + ); + assert.strictEqual( strip(formatDays(10, { format: "medium" })), shortDateYear(10) ); @@ -138,78 +153,78 @@ discourseModule("Unit | Utility | formatter", function (hooks) { test("formating tiny dates", function (assert) { let shortDateYear = shortDateTester("MMM 'YY"); - assert.equal(formatMins(0), "1m"); - assert.equal(formatMins(1), "1m"); - assert.equal(formatMins(2), "2m"); - assert.equal(formatMins(60), "1h"); - assert.equal(formatHours(4), "4h"); - assert.equal(formatHours(23), "23h"); - assert.equal(formatHours(23.5), "1d"); - assert.equal(formatDays(1), "1d"); - assert.equal(formatDays(14), "14d"); - assert.equal(formatDays(15), shortDate(15)); - assert.equal(formatDays(92), shortDate(92)); - assert.equal(formatDays(364), shortDate(364)); - assert.equal(formatDays(365), shortDate(365)); - assert.equal(formatDays(366), shortDateYear(366)); // leap year - assert.equal(formatDays(500), shortDateYear(500)); - assert.equal(formatDays(365 * 2 + 1), shortDateYear(365 * 2 + 1)); // one leap year + assert.strictEqual(formatMins(0), "1m"); + assert.strictEqual(formatMins(1), "1m"); + assert.strictEqual(formatMins(2), "2m"); + assert.strictEqual(formatMins(60), "1h"); + assert.strictEqual(formatHours(4), "4h"); + assert.strictEqual(formatHours(23), "23h"); + assert.strictEqual(formatHours(23.5), "1d"); + assert.strictEqual(formatDays(1), "1d"); + assert.strictEqual(formatDays(14), "14d"); + assert.strictEqual(formatDays(15), shortDate(15)); + assert.strictEqual(formatDays(92), shortDate(92)); + assert.strictEqual(formatDays(364), shortDate(364)); + assert.strictEqual(formatDays(365), shortDate(365)); + assert.strictEqual(formatDays(366), shortDateYear(366)); // leap year + assert.strictEqual(formatDays(500), shortDateYear(500)); + assert.strictEqual(formatDays(365 * 2 + 1), shortDateYear(365 * 2 + 1)); // one leap year - assert.equal(formatMins(-1), "1m"); - assert.equal(formatMins(-2), "2m"); - assert.equal(formatMins(-60), "1h"); - assert.equal(formatHours(-4), "4h"); - assert.equal(formatHours(-23), "23h"); - assert.equal(formatHours(-23.5), "1d"); - assert.equal(formatDays(-1), "1d"); - assert.equal(formatDays(-14), "14d"); - assert.equal(formatDays(-15), shortDateYear(-15)); - assert.equal(formatDays(-92), shortDateYear(-92)); - assert.equal(formatDays(-364), shortDateYear(-364)); - assert.equal(formatDays(-365), shortDateYear(-365)); - assert.equal(formatDays(-366), shortDateYear(-366)); // leap year - assert.equal(formatDays(-500), shortDateYear(-500)); - assert.equal(formatDays(-365 * 2 - 1), shortDateYear(-365 * 2 - 1)); // one leap year + assert.strictEqual(formatMins(-1), "1m"); + assert.strictEqual(formatMins(-2), "2m"); + assert.strictEqual(formatMins(-60), "1h"); + assert.strictEqual(formatHours(-4), "4h"); + assert.strictEqual(formatHours(-23), "23h"); + assert.strictEqual(formatHours(-23.5), "1d"); + assert.strictEqual(formatDays(-1), "1d"); + assert.strictEqual(formatDays(-14), "14d"); + assert.strictEqual(formatDays(-15), shortDateYear(-15)); + assert.strictEqual(formatDays(-92), shortDateYear(-92)); + assert.strictEqual(formatDays(-364), shortDateYear(-364)); + assert.strictEqual(formatDays(-365), shortDateYear(-365)); + assert.strictEqual(formatDays(-366), shortDateYear(-366)); // leap year + assert.strictEqual(formatDays(-500), shortDateYear(-500)); + assert.strictEqual(formatDays(-365 * 2 - 1), shortDateYear(-365 * 2 - 1)); // one leap year let originalValue = this.siteSettings.relative_date_duration; this.siteSettings.relative_date_duration = 7; - assert.equal(formatDays(7), "7d"); - assert.equal(formatDays(8), shortDate(8)); + assert.strictEqual(formatDays(7), "7d"); + assert.strictEqual(formatDays(8), shortDate(8)); this.siteSettings.relative_date_duration = 1; - assert.equal(formatDays(1), "1d"); - assert.equal(formatDays(2), shortDate(2)); + assert.strictEqual(formatDays(1), "1d"); + assert.strictEqual(formatDays(2), shortDate(2)); this.siteSettings.relative_date_duration = 0; - assert.equal(formatMins(0), "1m"); - assert.equal(formatMins(1), "1m"); - assert.equal(formatMins(2), "2m"); - assert.equal(formatMins(60), "1h"); - assert.equal(formatDays(1), shortDate(1)); - assert.equal(formatDays(2), shortDate(2)); - assert.equal(formatDays(366), shortDateYear(366)); + assert.strictEqual(formatMins(0), "1m"); + assert.strictEqual(formatMins(1), "1m"); + assert.strictEqual(formatMins(2), "2m"); + assert.strictEqual(formatMins(60), "1h"); + assert.strictEqual(formatDays(1), shortDate(1)); + assert.strictEqual(formatDays(2), shortDate(2)); + assert.strictEqual(formatDays(366), shortDateYear(366)); this.siteSettings.relative_date_duration = null; - assert.equal(formatDays(1), "1d"); - assert.equal(formatDays(14), "14d"); - assert.equal(formatDays(15), shortDate(15)); + assert.strictEqual(formatDays(1), "1d"); + assert.strictEqual(formatDays(14), "14d"); + assert.strictEqual(formatDays(15), shortDate(15)); this.siteSettings.relative_date_duration = 14; this.clock.restore(); this.clock = sinon.useFakeTimers(new Date(2012, 0, 12, 12, 0).getTime()); // Jan 12, 2012 - assert.equal(formatDays(11), "11d"); - assert.equal(formatDays(14), "14d"); - assert.equal(formatDays(15), shortDateYear(15)); - assert.equal(formatDays(366), shortDateYear(366)); + assert.strictEqual(formatDays(11), "11d"); + assert.strictEqual(formatDays(14), "14d"); + assert.strictEqual(formatDays(15), shortDateYear(15)); + assert.strictEqual(formatDays(366), shortDateYear(366)); this.clock.restore(); this.clock = sinon.useFakeTimers(new Date(2012, 0, 20, 12, 0).getTime()); // Jan 20, 2012 - assert.equal(formatDays(14), "14d"); - assert.equal(formatDays(15), shortDate(15)); - assert.equal(formatDays(20), shortDateYear(20)); + assert.strictEqual(formatDays(14), "14d"); + assert.strictEqual(formatDays(15), shortDate(15)); + assert.strictEqual(formatDays(20), shortDateYear(20)); this.siteSettings.relative_date_duration = originalValue; }); @@ -218,12 +233,12 @@ discourseModule("Unit | Utility | formatter", function (hooks) { let d = moment().subtract(1, "day").toDate(); let elem = stringToDOMNode(autoUpdatingRelativeAge(d)); - assert.equal(elem.dataset.format, "tiny"); - assert.equal(elem.dataset.time, d.getTime()); - assert.equal(elem.title, ""); + assert.strictEqual(elem.dataset.format, "tiny"); + assert.strictEqual(elem.dataset.time, d.getTime().toString()); + assert.strictEqual(elem.title, ""); elem = stringToDOMNode(autoUpdatingRelativeAge(d, { title: true })); - assert.equal(elem.title, longDate(d)); + assert.strictEqual(elem.title, longDate(d)); elem = stringToDOMNode( autoUpdatingRelativeAge(d, { @@ -233,16 +248,16 @@ discourseModule("Unit | Utility | formatter", function (hooks) { }) ); - assert.equal(elem.dataset.format, "medium-with-ago"); - assert.equal(elem.dataset.time, d.getTime()); - assert.equal(elem.title, longDate(d)); - assert.equal(elem.innerHTML, "1 day ago"); + assert.strictEqual(elem.dataset.format, "medium-with-ago"); + assert.strictEqual(elem.dataset.time, d.getTime().toString()); + assert.strictEqual(elem.title, longDate(d)); + assert.strictEqual(elem.innerHTML, "1 day ago"); elem = stringToDOMNode(autoUpdatingRelativeAge(d, { format: "medium" })); - assert.equal(elem.dataset.format, "medium"); - assert.equal(elem.dataset.time, d.getTime()); - assert.equal(elem.title, ""); - assert.equal(elem.innerHTML, "1 day"); + assert.strictEqual(elem.dataset.format, "medium"); + assert.strictEqual(elem.dataset.time, d.getTime().toString()); + assert.strictEqual(elem.title, ""); + assert.strictEqual(elem.innerHTML, "1 day"); }); test("updateRelativeAge", function (assert) { @@ -252,7 +267,7 @@ discourseModule("Unit | Utility | formatter", function (hooks) { updateRelativeAge(elem); - assert.equal(elem.innerHTML, "2m"); + assert.strictEqual(elem.innerHTML, "2m"); d = new Date(); elem = stringToDOMNode( @@ -262,42 +277,42 @@ discourseModule("Unit | Utility | formatter", function (hooks) { updateRelativeAge(elem); - assert.equal(elem.innerHTML, "2 mins ago"); + assert.strictEqual(elem.innerHTML, "2 mins ago"); }); test("number", function (assert) { - assert.equal( + assert.strictEqual( number(123), "123", "it returns a string version of the number" ); - assert.equal(number("123"), "123", "it works with a string command"); - assert.equal(number(NaN), "0", "it returns 0 for NaN"); - assert.equal(number(3333), "3.3k", "it abbreviates thousands"); - assert.equal(number(2499999), "2.5M", "it abbreviates millions"); - assert.equal(number("2499999.5"), "2.5M", "it abbreviates millions"); - assert.equal(number(1000000), "1.0M", "it abbreviates a million"); - assert.equal( + assert.strictEqual(number("123"), "123", "it works with a string command"); + assert.strictEqual(number(NaN), "0", "it returns 0 for NaN"); + assert.strictEqual(number(3333), "3.3k", "it abbreviates thousands"); + assert.strictEqual(number(2499999), "2.5M", "it abbreviates millions"); + assert.strictEqual(number("2499999.5"), "2.5M", "it abbreviates millions"); + assert.strictEqual(number(1000000), "1.0M", "it abbreviates a million"); + assert.strictEqual( number(999999), "999k", "it abbreviates hundreds of thousands" ); - assert.equal( + assert.strictEqual( number(18.2), "18", "it returns a float number rounded to an integer as a string" ); - assert.equal( + assert.strictEqual( number(18.6), "19", "it returns a float number rounded to an integer as a string" ); - assert.equal( + assert.strictEqual( number("12.3"), "12", "it returns a string float rounded to an integer as a string" ); - assert.equal( + assert.strictEqual( number("12.6"), "13", "it returns a string float rounded to an integer as a string" @@ -305,34 +320,50 @@ discourseModule("Unit | Utility | formatter", function (hooks) { }); test("durationTiny", function (assert) { - assert.equal(durationTiny(), "—", "undefined is a dash"); - assert.equal(durationTiny(null), "—", "null is a dash"); - assert.equal(durationTiny(0), "< 1m", "0 seconds shows as < 1m"); - assert.equal(durationTiny(59), "< 1m", "59 seconds shows as < 1m"); - assert.equal(durationTiny(60), "1m", "60 seconds shows as 1m"); - assert.equal(durationTiny(90), "2m", "90 seconds shows as 2m"); - assert.equal(durationTiny(120), "2m", "120 seconds shows as 2m"); - assert.equal(durationTiny(60 * 45), "1h", "45 minutes shows as 1h"); - assert.equal(durationTiny(60 * 60), "1h", "60 minutes shows as 1h"); - assert.equal(durationTiny(60 * 90), "2h", "90 minutes shows as 2h"); - assert.equal(durationTiny(3600 * 23), "23h", "23 hours shows as 23h"); - assert.equal( + assert.strictEqual(durationTiny(), "—", "undefined is a dash"); + assert.strictEqual(durationTiny(null), "—", "null is a dash"); + assert.strictEqual(durationTiny(0), "< 1m", "0 seconds shows as < 1m"); + assert.strictEqual(durationTiny(59), "< 1m", "59 seconds shows as < 1m"); + assert.strictEqual(durationTiny(60), "1m", "60 seconds shows as 1m"); + assert.strictEqual(durationTiny(90), "2m", "90 seconds shows as 2m"); + assert.strictEqual(durationTiny(120), "2m", "120 seconds shows as 2m"); + assert.strictEqual(durationTiny(60 * 45), "1h", "45 minutes shows as 1h"); + assert.strictEqual(durationTiny(60 * 60), "1h", "60 minutes shows as 1h"); + assert.strictEqual(durationTiny(60 * 90), "2h", "90 minutes shows as 2h"); + assert.strictEqual(durationTiny(3600 * 23), "23h", "23 hours shows as 23h"); + assert.strictEqual( durationTiny(3600 * 24 - 29), "1d", "23 hours 31 mins shows as 1d" ); - assert.equal(durationTiny(3600 * 24 * 89), "89d", "89 days shows as 89d"); - assert.equal( + assert.strictEqual( + durationTiny(3600 * 24 * 89), + "89d", + "89 days shows as 89d" + ); + assert.strictEqual( durationTiny(60 * (525600 - 1)), "12mon", "364 days shows as 12mon" ); - assert.equal(durationTiny(60 * 525600), "1y", "365 days shows as 1y"); - assert.equal(durationTiny(86400 * 456), "1y", "456 days shows as 1y"); - assert.equal(durationTiny(86400 * 457), "> 1y", "457 days shows as > 1y"); - assert.equal(durationTiny(86400 * 638), "> 1y", "638 days shows as > 1y"); - assert.equal(durationTiny(86400 * 639), "2y", "639 days shows as 2y"); - assert.equal(durationTiny(86400 * 821), "2y", "821 days shows as 2y"); - assert.equal(durationTiny(86400 * 822), "> 2y", "822 days shows as > 2y"); + assert.strictEqual(durationTiny(60 * 525600), "1y", "365 days shows as 1y"); + assert.strictEqual(durationTiny(86400 * 456), "1y", "456 days shows as 1y"); + assert.strictEqual( + durationTiny(86400 * 457), + "> 1y", + "457 days shows as > 1y" + ); + assert.strictEqual( + durationTiny(86400 * 638), + "> 1y", + "638 days shows as > 1y" + ); + assert.strictEqual(durationTiny(86400 * 639), "2y", "639 days shows as 2y"); + assert.strictEqual(durationTiny(86400 * 821), "2y", "821 days shows as 2y"); + assert.strictEqual( + durationTiny(86400 * 822), + "> 2y", + "822 days shows as > 2y" + ); }); }); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/get-url-test.js b/app/assets/javascripts/discourse/tests/unit/lib/get-url-test.js index 2e26ef3f5e5..4f2a337c468 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/get-url-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/get-url-test.js @@ -19,63 +19,75 @@ module("Unit | Utility | get-url", function () { test("getAbsoluteURL", function (assert) { setupURL(null, "https://example.com", "/forum"); - assert.equal(getAbsoluteURL("/cool/path"), "https://example.com/cool/path"); + assert.strictEqual( + getAbsoluteURL("/cool/path"), + "https://example.com/cool/path" + ); }); test("withoutPrefix", function (assert) { setPrefix("/eviltrout"); - assert.equal(withoutPrefix("/eviltrout/hello"), "/hello"); - assert.equal(withoutPrefix("/eviltrout/"), "/"); - assert.equal(withoutPrefix("/eviltrout"), ""); + assert.strictEqual(withoutPrefix("/eviltrout/hello"), "/hello"); + assert.strictEqual(withoutPrefix("/eviltrout/"), "/"); + assert.strictEqual(withoutPrefix("/eviltrout"), ""); setPrefix(""); - assert.equal(withoutPrefix("/eviltrout/hello"), "/eviltrout/hello"); - assert.equal(withoutPrefix("/eviltrout"), "/eviltrout"); - assert.equal(withoutPrefix("/"), "/"); + assert.strictEqual(withoutPrefix("/eviltrout/hello"), "/eviltrout/hello"); + assert.strictEqual(withoutPrefix("/eviltrout"), "/eviltrout"); + assert.strictEqual(withoutPrefix("/"), "/"); setPrefix(null); - assert.equal(withoutPrefix("/eviltrout/hello"), "/eviltrout/hello"); - assert.equal(withoutPrefix("/eviltrout"), "/eviltrout"); - assert.equal(withoutPrefix("/"), "/"); + assert.strictEqual(withoutPrefix("/eviltrout/hello"), "/eviltrout/hello"); + assert.strictEqual(withoutPrefix("/eviltrout"), "/eviltrout"); + assert.strictEqual(withoutPrefix("/"), "/"); setPrefix("/f"); - assert.equal(withoutPrefix("/faq"), "/faq"); - assert.equal(withoutPrefix("/f/faq"), "/faq"); - assert.equal(withoutPrefix("/f"), ""); + assert.strictEqual(withoutPrefix("/faq"), "/faq"); + assert.strictEqual(withoutPrefix("/f/faq"), "/faq"); + assert.strictEqual(withoutPrefix("/f"), ""); }); test("withoutPrefix called multiple times on the same path", function (assert) { setPrefix("/eviltrout"); - assert.equal(withoutPrefix(withoutPrefix("/eviltrout/hello")), "/hello"); - assert.equal(withoutPrefix(withoutPrefix("/eviltrout/")), "/"); - assert.equal(withoutPrefix(withoutPrefix("/eviltrout")), ""); + assert.strictEqual( + withoutPrefix(withoutPrefix("/eviltrout/hello")), + "/hello" + ); + assert.strictEqual(withoutPrefix(withoutPrefix("/eviltrout/")), "/"); + assert.strictEqual(withoutPrefix(withoutPrefix("/eviltrout")), ""); setPrefix(""); - assert.equal( + assert.strictEqual( withoutPrefix(withoutPrefix("/eviltrout/hello")), "/eviltrout/hello" ); - assert.equal(withoutPrefix(withoutPrefix("/eviltrout")), "/eviltrout"); - assert.equal(withoutPrefix(withoutPrefix("/")), "/"); + assert.strictEqual( + withoutPrefix(withoutPrefix("/eviltrout")), + "/eviltrout" + ); + assert.strictEqual(withoutPrefix(withoutPrefix("/")), "/"); setPrefix(null); - assert.equal( + assert.strictEqual( withoutPrefix(withoutPrefix("/eviltrout/hello")), "/eviltrout/hello" ); - assert.equal(withoutPrefix(withoutPrefix("/eviltrout")), "/eviltrout"); - assert.equal(withoutPrefix(withoutPrefix("/")), "/"); + assert.strictEqual( + withoutPrefix(withoutPrefix("/eviltrout")), + "/eviltrout" + ); + assert.strictEqual(withoutPrefix(withoutPrefix("/")), "/"); setPrefix("/f"); - assert.equal( + assert.strictEqual( withoutPrefix(withoutPrefix("/f/t/falco-says-hello")), "/t/falco-says-hello" ); - assert.equal( + assert.strictEqual( withoutPrefix(withoutPrefix("/f/tag/fast-chain-food")), "/tag/fast-chain-food" ); - assert.equal( + assert.strictEqual( withoutPrefix(withoutPrefix("/f/u/falco/summary")), "/u/falco/summary" ); @@ -83,56 +95,56 @@ module("Unit | Utility | get-url", function () { test("getURL with empty paths", function (assert) { setupURL(null, "https://example.com", "/"); - assert.equal(getURL("/"), "/"); - assert.equal(getURL(""), ""); + assert.strictEqual(getURL("/"), "/"); + assert.strictEqual(getURL(""), ""); setupURL(null, "https://example.com", ""); - assert.equal(getURL("/"), "/"); - assert.equal(getURL(""), ""); + assert.strictEqual(getURL("/"), "/"); + assert.strictEqual(getURL(""), ""); setupURL(null, "https://example.com", undefined); - assert.equal(getURL("/"), "/"); - assert.equal(getURL(""), ""); + assert.strictEqual(getURL("/"), "/"); + assert.strictEqual(getURL(""), ""); }); test("getURL on subfolder install", function (assert) { setupURL(null, "", "/forum"); - assert.equal(getURL("/"), "/forum/", "root url has subfolder"); - assert.equal( + assert.strictEqual(getURL("/"), "/forum/", "root url has subfolder"); + assert.strictEqual( getURL("/u/neil"), "/forum/u/neil", "relative url has subfolder" ); - assert.equal( + assert.strictEqual( getURL("/u/forumadmin"), "/forum/u/forumadmin", "relative url has subfolder even if username contains subfolder" ); - assert.equal( + assert.strictEqual( getURL(""), "/forum", "relative url has subfolder without trailing slash" ); - assert.equal( + assert.strictEqual( getURL("/svg-sprite/forum.example.com/svg-sprite.js"), "/forum/svg-sprite/forum.example.com/svg-sprite.js", "works when the url has the prefix in the middle" ); - assert.equal( + assert.strictEqual( getURL("/forum/t/123"), "/forum/t/123", "does not prefix if the URL is already prefixed" ); setPrefix("/f"); - assert.equal( + assert.strictEqual( getURL("/faq"), "/f/faq", "relative path has subfolder even if it starts with the prefix without trailing slash" ); - assert.equal( + assert.strictEqual( getURL("/f/faq"), "/f/faq", "does not prefix if the URL is already prefixed" @@ -149,6 +161,6 @@ module("Unit | Utility | get-url", function () { let url = "//test.s3-us-west-1.amazonaws.com/site/forum/awesome.png"; let expected = "https://awesome.cdn/site/forum/awesome.png"; - assert.equal(getURLWithCDN(url), expected, "at correct path"); + assert.strictEqual(getURLWithCDN(url), expected, "at correct path"); }); }); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/highlight-search-test.js b/app/assets/javascripts/discourse/tests/unit/lib/highlight-search-test.js index e069ec83f38..ac5acaedbed 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/highlight-search-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/highlight-search-test.js @@ -12,7 +12,7 @@ module("Unit | Utility | highlight-search", function () { const terms = [fixture(`.${CLASS_NAME}`).textContent]; - assert.equal( + assert.strictEqual( terms.join(" "), "some text", "it should highlight the terms correctly" @@ -28,7 +28,7 @@ module("Unit | Utility | highlight-search", function () { const terms = [fixture(`.${CLASS_NAME}`).textContent]; - assert.equal( + assert.strictEqual( terms.join(" "), "தமிழ் & русский", "it should highlight the terms correctly" diff --git a/app/assets/javascripts/discourse/tests/unit/lib/i18n-test.js b/app/assets/javascripts/discourse/tests/unit/lib/i18n-test.js index bbc2635a20e..be4699d6846 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/i18n-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/i18n-test.js @@ -100,27 +100,31 @@ module("Unit | Utility | i18n", function (hooks) { }); test("defaults", function (assert) { - assert.equal(I18n.defaultLocale, "en", "it has English as default locale"); + assert.strictEqual( + I18n.defaultLocale, + "en", + "it has English as default locale" + ); assert.ok(I18n.pluralizationRules["en"], "it has English pluralizer"); }); test("translations", function (assert) { - assert.equal( + assert.strictEqual( I18n.t("topic.reply.title"), "Répondre", "uses locale translations when they exist" ); - assert.equal( + assert.strictEqual( I18n.t("topic.reply.help"), "begin composing a reply to this topic", "fallbacks to English translations" ); - assert.equal( + assert.strictEqual( I18n.t("hello.world"), "Hello World!", "doesn't break if a key is overriden in a locale" ); - assert.equal(I18n.t("hello.universe"), "", "allows empty strings"); + assert.strictEqual(I18n.t("hello.universe"), "", "allows empty strings"); }); test("extra translations", function (assert) { @@ -176,19 +180,19 @@ module("Unit | Utility | i18n", function (hooks) { return "other"; }; - assert.equal( + assert.strictEqual( I18n.t("admin.dashboard.title"), "Raporty", "it uses extra translations when they exists" ); - assert.equal( + assert.strictEqual( I18n.t("admin.web_hooks.events.incoming", { count: 2 }), "Istnieją 2 nowe wydarzenia.", "it uses pluralized extra translation when it exists" ); - assert.equal( + assert.strictEqual( I18n.t("admin.dashboard.backup_count", { count: 2 }), "2 backups", "it falls back to English and uses extra translations when they exists" @@ -196,28 +200,28 @@ module("Unit | Utility | i18n", function (hooks) { }); test("pluralizations", function (assert) { - assert.equal(I18n.t("character_count", { count: 0 }), "0 ZERO"); - assert.equal(I18n.t("character_count", { count: 1 }), "1 ONE"); - assert.equal(I18n.t("character_count", { count: 2 }), "2 TWO"); - assert.equal(I18n.t("character_count", { count: 3 }), "3 FEW"); - assert.equal(I18n.t("character_count", { count: 10 }), "10 MANY"); - assert.equal(I18n.t("character_count", { count: 100 }), "100 OTHER"); + assert.strictEqual(I18n.t("character_count", { count: 0 }), "0 ZERO"); + assert.strictEqual(I18n.t("character_count", { count: 1 }), "1 ONE"); + assert.strictEqual(I18n.t("character_count", { count: 2 }), "2 TWO"); + assert.strictEqual(I18n.t("character_count", { count: 3 }), "3 FEW"); + assert.strictEqual(I18n.t("character_count", { count: 10 }), "10 MANY"); + assert.strictEqual(I18n.t("character_count", { count: 100 }), "100 OTHER"); - assert.equal(I18n.t("word_count", { count: 0 }), "0 words"); - assert.equal(I18n.t("word_count", { count: 1 }), "1 word"); - assert.equal(I18n.t("word_count", { count: 2 }), "2 words"); - assert.equal(I18n.t("word_count", { count: 3 }), "3 words"); - assert.equal(I18n.t("word_count", { count: 10 }), "10 words"); - assert.equal(I18n.t("word_count", { count: 100 }), "100 words"); + assert.strictEqual(I18n.t("word_count", { count: 0 }), "0 words"); + assert.strictEqual(I18n.t("word_count", { count: 1 }), "1 word"); + assert.strictEqual(I18n.t("word_count", { count: 2 }), "2 words"); + assert.strictEqual(I18n.t("word_count", { count: 3 }), "3 words"); + assert.strictEqual(I18n.t("word_count", { count: 10 }), "10 words"); + assert.strictEqual(I18n.t("word_count", { count: 100 }), "100 words"); }); test("fallback", function (assert) { - assert.equal( + assert.strictEqual( I18n.t("days", { count: 1 }), "1 day", "uses fallback locale for missing plural key" ); - assert.equal( + assert.strictEqual( I18n.t("days", { count: 200 }), "200 jours", "uses existing French plural key" @@ -226,17 +230,17 @@ module("Unit | Utility | i18n", function (hooks) { I18n.locale = "fr_FOO"; I18n.fallbackLocale = "fr"; - assert.equal( + assert.strictEqual( I18n.t("topic.reply.title"), "Foo", "uses locale translations when they exist" ); - assert.equal( + assert.strictEqual( I18n.t("topic.share.title"), "Partager", "falls back to fallbackLocale translations when they exist" ); - assert.equal( + assert.strictEqual( I18n.t("topic.reply.help"), "begin composing a reply to this topic", "falls back to English translations" @@ -244,7 +248,7 @@ module("Unit | Utility | i18n", function (hooks) { }); test("Dollar signs are properly escaped", function (assert) { - assert.equal( + assert.strictEqual( I18n.t("dollar_sign", { description: "$& $&", }), diff --git a/app/assets/javascripts/discourse/tests/unit/lib/icon-library-test.js b/app/assets/javascripts/discourse/tests/unit/lib/icon-library-test.js index de03fa9c142..88a3dda459a 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/icon-library-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/icon-library-test.js @@ -10,8 +10,8 @@ module("Unit | Utility | icon-library", function () { assert.ok(iconHTML("bars").indexOf('use xlink:href="#bars"') > -1); const nodeIcon = iconNode("bars"); - assert.equal(nodeIcon.tagName, "svg"); - assert.equal( + assert.strictEqual(nodeIcon.tagName, "svg"); + assert.strictEqual( nodeIcon.properties.attributes.class, "fa d-icon d-icon-bars svg-icon svg-node" ); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/key-value-store-test.js b/app/assets/javascripts/discourse/tests/unit/lib/key-value-store-test.js index a2fa6876a95..243dc9a981a 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/key-value-store-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/key-value-store-test.js @@ -5,7 +5,7 @@ module("Unit | Utility | key-value-store", function () { test("it's able to get the result back from the store", function (assert) { const store = new KeyValueStore("_test"); store.set({ key: "bob", value: "uncle" }); - assert.equal(store.get("bob"), "uncle"); + assert.strictEqual(store.get("bob"), "uncle"); }); test("is able to nuke the store", function (assert) { @@ -13,7 +13,7 @@ module("Unit | Utility | key-value-store", function () { store.set({ key: "bob1", value: "uncle" }); store.abandonLocal(); localStorage.a = 1; - assert.equal(store.get("bob1"), void 0); - assert.equal(localStorage.a, "1"); + assert.strictEqual(store.get("bob1"), void 0); + assert.strictEqual(localStorage.a, "1"); }); }); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/link-mentions-test.js b/app/assets/javascripts/discourse/tests/unit/lib/link-mentions-test.js index c18887b6e6a..8be7cc30f53 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/link-mentions-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/link-mentions-test.js @@ -59,12 +59,15 @@ module("Unit | Utility | link-mentions", function () { }, 500); }); - assert.equal(root.querySelector("a").innerText, "@valid_user"); - assert.equal(root.querySelectorAll("a")[1].innerText, "@valid_group"); - assert.equal( + assert.strictEqual(root.querySelector("a").innerText, "@valid_user"); + assert.strictEqual(root.querySelectorAll("a")[1].innerText, "@valid_group"); + assert.strictEqual( root.querySelector("a.notify").innerText, "@mentionable_group" ); - assert.equal(root.querySelector("span.mention").innerHTML, "@invalid"); + assert.strictEqual( + root.querySelector("span.mention").innerHTML, + "@invalid" + ); }); }); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/load-script-test.js b/app/assets/javascripts/discourse/tests/unit/lib/load-script-test.js index 8fbb43605b4..f977a03ad98 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/load-script-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/load-script-test.js @@ -19,22 +19,22 @@ module("Unit | Utility | load-script", function () { }); test("works when a value is not present", function (assert) { - assert.equal( + assert.strictEqual( cacheBuster("/javascripts/my-script.js"), "/javascripts/my-script.js" ); - assert.equal( + assert.strictEqual( cacheBuster("/javascripts/my-project/script.js"), "/javascripts/my-project/script.js" ); }); test("generates URLs with version number in the query params", function (assert) { - assert.equal( + assert.strictEqual( cacheBuster("/javascripts/pikaday.js"), `/javascripts/${jsVersions["pikaday.js"]}` ); - assert.equal( + assert.strictEqual( cacheBuster("/javascripts/ace/ace.js"), `/javascripts/${jsVersions["ace/ace.js"]}` ); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/oneboxer-test.js b/app/assets/javascripts/discourse/tests/unit/lib/oneboxer-test.js index 6510a5ab38e..dcc6d4a2e60 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/oneboxer-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/oneboxer-test.js @@ -21,12 +21,12 @@ module("Unit | Utility | oneboxer", function () { await loadOnebox(element); - assert.equal( + assert.strictEqual( failedCache["http://somebadurl.com"], true, "stores the url as failed in a cache" ); - assert.equal( + assert.strictEqual( loadOnebox(element), undefined, "it returns early for a failed cache" diff --git a/app/assets/javascripts/discourse/tests/unit/lib/parse-bbcode-tag-test.js b/app/assets/javascripts/discourse/tests/unit/lib/parse-bbcode-tag-test.js index ac433caa377..969a9bb2674 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/parse-bbcode-tag-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/parse-bbcode-tag-test.js @@ -5,8 +5,8 @@ module("Unit | Utility | parseBBCodeTag", function () { test("block with multiple quoted attributes", function (assert) { const parsed = parseBBCodeTag('[test one="foo" two="bar bar"]', 0, 30); - assert.equal(parsed.tag, "test"); - assert.equal(parsed.attrs.one, "foo"); - assert.equal(parsed.attrs.two, "bar bar"); + assert.strictEqual(parsed.tag, "test"); + assert.strictEqual(parsed.attrs.one, "foo"); + assert.strictEqual(parsed.attrs.two, "bar bar"); }); }); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/preload-store-test.js b/app/assets/javascripts/discourse/tests/unit/lib/preload-store-test.js index abdde2fec6b..089ef194d66 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/preload-store-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/preload-store-test.js @@ -9,7 +9,7 @@ module("Unit | Utility | preload-store", function (hooks) { test("get", function (assert) { assert.blank(PreloadStore.get("joker"), "returns blank for a missing key"); - assert.equal( + assert.strictEqual( PreloadStore.get("bane"), "evil", "returns the value for that key" @@ -32,26 +32,26 @@ module("Unit | Utility | preload-store", function (hooks) { const finder = () => "batdance"; const result = await PreloadStore.getAndRemove("joker", finder); - assert.equal(result, "batdance"); + assert.strictEqual(result, "batdance"); }); test("getAndRemove returns a promise that resolves to the result of the finder's promise", async function (assert) { const finder = () => Promise.resolve("hahahah"); const result = await PreloadStore.getAndRemove("joker", finder); - assert.equal(result, "hahahah"); + assert.strictEqual(result, "hahahah"); }); test("returns a promise that rejects with the result of the finder's rejected promise", async function (assert) { const finder = () => Promise.reject("error"); await PreloadStore.getAndRemove("joker", finder).catch((result) => { - assert.equal(result, "error"); + assert.strictEqual(result, "error"); }); }); test("returns a promise that resolves to 'evil'", async function (assert) { const result = await PreloadStore.getAndRemove("bane"); - assert.equal(result, "evil"); + assert.strictEqual(result, "evil"); }); }); diff --git a/app/assets/javascripts/discourse/tests/unit/lib/pretty-text-test.js b/app/assets/javascripts/discourse/tests/unit/lib/pretty-text-test.js index 1b8d7951af0..2a64ccc6159 100644 --- a/app/assets/javascripts/discourse/tests/unit/lib/pretty-text-test.js +++ b/app/assets/javascripts/discourse/tests/unit/lib/pretty-text-test.js @@ -1268,7 +1268,7 @@ eviltrout

}); function formatQuote(val, expected, text, opts) { - assert.equal(buildQuote(post, val, opts), expected, text); + assert.strictEqual(buildQuote(post, val, opts), expected, text); } formatQuote(undefined, "", "empty string for undefined content"); @@ -1334,7 +1334,7 @@ eviltrout

'[quote="sam, post:1, topic:1, full:true"]\nhello\n[/quote]' ); - assert.equal( + assert.strictEqual( quote, '[quote="eviltrout, post:1, topic:2"]\n[quote="sam, post:1, topic:1, full:true"]\nhello\n[/quote]\n[/quote]\n\n', "allows quoting a quote" @@ -1447,7 +1447,7 @@ var bar = 'bar'; const result = new PrettyText(defaultOpts).cook( '[quote="EvilTrout, post:123, topic:456, full:true"]\nhello\n[/quote]\n*Test*' ); - assert.equal( + assert.strictEqual( result, `