DEV: Convert more `notOk` assertions (#29556)

…to either qunit-dom or `strictEqual`
This commit is contained in:
Jarek Radosz 2024-11-04 10:27:30 +01:00 committed by GitHub
parent 693a4e691b
commit 9694d2477a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
36 changed files with 133 additions and 141 deletions

View File

@ -195,26 +195,29 @@ acceptance("Admin Sidebar - Sections - Plugin API", function (needs) {
"link is appended to the root section" "link is appended to the root section"
); );
assert.notOk( assert
exists( .dom(
".sidebar-section[data-section-name='admin-root'] .sidebar-section-link-wrapper[data-list-item-name=\"admin_additional_root_test_section_link_no_route_or_href\"]" ".sidebar-section[data-section-name='admin-root'] .sidebar-section-link-wrapper[data-list-item-name=\"admin_additional_root_test_section_link_no_route_or_href\"]"
), )
"invalid link that has no route or href is not appended to the root section" .doesNotExist(
); "invalid link that has no route or href is not appended to the root section"
);
assert.notOk( assert
exists( .dom(
".sidebar-section[data-section-name='admin-root'] .sidebar-section-link-wrapper[data-list-item-name=\"admin_additional_root_test_section_link_no_label_or_text\"]" ".sidebar-section[data-section-name='admin-root'] .sidebar-section-link-wrapper[data-list-item-name=\"admin_additional_root_test_section_link_no_label_or_text\"]"
), )
"invalid link that has no label or text is not appended to the root section" .doesNotExist(
); "invalid link that has no label or text is not appended to the root section"
);
assert.notOk( assert
exists( .dom(
".sidebar-section[data-section-name='admin-root'] .sidebar-section-link-wrapper[data-list-item-name=\"admin_additional_root_test_section_link_invalid_label\"]" ".sidebar-section[data-section-name='admin-root'] .sidebar-section-link-wrapper[data-list-item-name=\"admin_additional_root_test_section_link_invalid_label\"]"
), )
"invalid link with an invalid I18n key is not appended to the root section" .doesNotExist(
); "invalid link with an invalid I18n key is not appended to the root section"
);
}); });
test("community section links are added to primary and secondary sections with the plugin API", async function (assert) { test("community section links are added to primary and secondary sections with the plugin API", async function (assert) {
@ -225,25 +228,24 @@ acceptance("Admin Sidebar - Sections - Plugin API", function (needs) {
"#sidebar-section-content-community .sidebar-section-link[data-link-name='primary']" "#sidebar-section-content-community .sidebar-section-link[data-link-name='primary']"
) )
); );
assert.notOk( assert
exists( .dom(
"#sidebar-section-content-community .sidebar-section-link[data-link-name='secondary']" "#sidebar-section-content-community .sidebar-section-link[data-link-name='secondary']"
) )
); .doesNotExist();
await click(".sidebar-more-section-links-details-summary"); await click(".sidebar-more-section-links-details-summary");
assert.notOk( assert
exists( .dom(
".sidebar-more-section-links-details-content .sidebar-section-link[data-link-name='primary']" ".sidebar-more-section-links-details-content .sidebar-section-link[data-link-name='primary']"
) )
); .doesNotExist();
assert.ok( assert.ok(
exists( exists(
".sidebar-more-section-links-details-content .sidebar-section-link[data-link-name='secondary']" ".sidebar-more-section-links-details-content .sidebar-section-link[data-link-name='secondary']"
) )
); );
assert.ok(true);
}); });
}); });

View File

@ -267,7 +267,7 @@ acceptance("Admin - User Index", function (needs) {
await click(".dialog-footer .btn-primary"); await click(".dialog-footer .btn-primary");
assert.notOk(deleteAndBlock, "user does not get blocked"); assert.false(deleteAndBlock, "user does not get blocked");
}); });
test("delete user - delete and block works as expected", async function (assert) { test("delete user - delete and block works as expected", async function (assert) {

View File

@ -29,7 +29,7 @@ acceptance("Category Edit - Security", function (needs) {
await visit("/c/bug/edit/security"); await visit("/c/bug/edit/security");
await availableGroups.expand(); await availableGroups.expand();
assert.notOk( assert.false(
availableGroups.rowByValue("everyone").exists(), availableGroups.rowByValue("everyone").exists(),
"everyone is already used and is not in the available groups" "everyone is already used and is not in the available groups"
); );

View File

@ -1104,7 +1104,7 @@ acceptance("Composer - Error Extensibility", function (needs) {
await fillIn("#reply-title", "this title triggers an error"); await fillIn("#reply-title", "this title triggers an error");
await fillIn(".d-editor-input", "this is the *content* of a post"); await fillIn(".d-editor-input", "this is the *content* of a post");
await click("#reply-control button.create"); await click("#reply-control button.create");
assert.notOk(exists(".dialog-body"), "it does not pop up an error message"); assert.dom(".dialog-body").doesNotExist("does not pop up an error message");
}); });
test("Create a topic with server side errors not handled by a plugin", async function (assert) { test("Create a topic with server side errors not handled by a plugin", async function (assert) {

View File

@ -149,7 +149,7 @@ acceptance("Dashboard: dashboard_hidden_reports", function (needs) {
await visit("/admin"); await visit("/admin");
assert.ok(exists(".admin-report.signups.is-visible"), "signups report"); assert.ok(exists(".admin-report.signups.is-visible"), "signups report");
assert.notOk(exists(".admin-report.is-visible.posts"), "posts report"); assert.dom(".admin-report.is-visible.posts").doesNotExist("posts report");
assert assert
.dom(".admin-report.is-visible.dau-by-mau") .dom(".admin-report.is-visible.dau-by-mau")
.doesNotExist("dau-by-mau report"); .doesNotExist("dau-by-mau report");

View File

@ -90,12 +90,11 @@ acceptance(
".sidebar-section[data-section-name='messages'] .sidebar-section-header" ".sidebar-section[data-section-name='messages'] .sidebar-section-header"
); );
assert.notOk( assert
exists( .dom(
".sidebar-section[data-section-name='messages'] .sidebar-section-content" ".sidebar-section[data-section-name='messages'] .sidebar-section-content"
), )
"hides the content of the section" .doesNotExist("hides the content of the section");
);
}); });
test("personal messages section links", async function (assert) { test("personal messages section links", async function (assert) {
@ -176,12 +175,13 @@ acceptance(
`personal message ${type} link is marked as active` `personal message ${type} link is marked as active`
); );
assert.notOk( assert
exists( .dom(
`.sidebar-section[data-section-name='messages'] .sidebar-section-link[data-link-name='personal-messages-${type}'] .sidebar-section-link-prefix` `.sidebar-section[data-section-name='messages'] .sidebar-section-link[data-link-name='personal-messages-${type}'] .sidebar-section-link-prefix`
), )
`prefix is not displayed for ${type} personal message section link` .doesNotExist(
); `prefix is not displayed for ${type} personal message section link`
);
}); });
}); });

View File

@ -16,10 +16,9 @@ module(
hbs`<FormTemplateField::Wrapper @content={{this.content}} />` hbs`<FormTemplateField::Wrapper @content={{this.content}} />`
); );
assert.notOk( assert
exists(".form-template-field"), .dom(".form-template-field")
"A form template field should not exist" .doesNotExist("A form template field should not exist");
);
assert.ok(exists(".alert"), "An alert message should exist"); assert.ok(exists(".alert"), "An alert message should exist");
}); });

View File

@ -40,7 +40,7 @@ module(
await this.subject.expand(); await this.subject.expand();
assert.notOk(this.subject.rowByValue(2).exists()); assert.false(this.subject.rowByValue(2).exists());
}); });
test("with scopedCategoryId", async function (assert) { test("with scopedCategoryId", async function (assert) {

View File

@ -57,10 +57,9 @@ module("Integration | Component | select-kit/combo-box", function (hooks) {
await click(header.el().querySelector(".btn-clear")); await click(header.el().querySelector(".btn-clear"));
assert.notOk( assert
header.el().querySelector(".btn-clear"), .dom(".btn-clear", header.el())
"it hides the clear button" .doesNotExist("hides the clear button");
);
assert.strictEqual(header.value(), null); assert.strictEqual(header.value(), null);
}); });

View File

@ -49,9 +49,9 @@ module(
assert.ok(this.subject.isExpanded()); assert.ok(this.subject.isExpanded());
await this.subject.selectRowByValue(DEFAULT_VALUE); await this.subject.selectRowByValue(DEFAULT_VALUE);
assert.notOk( assert.false(
this.subject.isExpanded(), this.subject.isExpanded(),
"it collapses the dropdown on select" "collapses the dropdown on select"
); );
}); });
@ -74,10 +74,9 @@ module(
/> />
`); `);
assert.notOk( assert
this.subject.header().el().querySelector(".selected-name"), .dom(".selected-name", this.subject.header().el())
"it hides the text of the selected item" .doesNotExist("hides the text of the selected item");
);
assert.strictEqual( assert.strictEqual(
this.subject.header().el().getAttribute("title"), this.subject.header().el().getAttribute("title"),

View File

@ -108,7 +108,7 @@ module(
const options = getOptions(); const options = getOptions();
const customDateAndTime = I18n.t("time_shortcut.custom"); const customDateAndTime = I18n.t("time_shortcut.custom");
assert.notOk(options.includes(customDateAndTime)); assert.false(options.includes(customDateAndTime));
}); });
test("shows the now option if enabled", async function (assert) { test("shows the now option if enabled", async function (assert) {

View File

@ -74,7 +74,7 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
await this.subject.expand(); await this.subject.expand();
await this.subject.selectRowByValue(1); await this.subject.selectRowByValue(1);
assert.notOk(this.subject.isExpanded(), "it closes the dropdown"); assert.false(this.subject.isExpanded(), "closes the dropdown");
await this.subject.expand(); await this.subject.expand();
await this.subject.deselectItemByValue(1); await this.subject.deselectItemByValue(1);

View File

@ -97,7 +97,7 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
await tab(); await tab();
assert.notOk( assert.false(
this.subject.isExpanded(), this.subject.isExpanded(),
"when there are no more rows, Tab collapses the dropdown" "when there are no more rows, Tab collapses the dropdown"
); );
@ -108,7 +108,7 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
await tab({ backwards: true }); await tab({ backwards: true });
assert.notOk(this.subject.isExpanded(), "Shift+Tab collapses the dropdown"); assert.false(this.subject.isExpanded(), "Shift+Tab collapses the dropdown");
}); });
test("value", async function (assert) { test("value", async function (assert) {

View File

@ -2,12 +2,7 @@ import { fillIn, render } from "@ember/test-helpers";
import { hbs } from "ember-cli-htmlbars"; import { hbs } from "ember-cli-htmlbars";
import { module, test } from "qunit"; import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test"; import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { import { count, query, queryAll } from "discourse/tests/helpers/qunit-helpers";
count,
exists,
query,
queryAll,
} from "discourse/tests/helpers/qunit-helpers";
import selectKit from "discourse/tests/helpers/select-kit-helper"; import selectKit from "discourse/tests/helpers/select-kit-helper";
import I18n from "discourse-i18n"; import I18n from "discourse-i18n";
import Theme, { COMPONENTS, THEMES } from "admin/models/theme"; import Theme, { COMPONENTS, THEMES } from "admin/models/theme";
@ -137,7 +132,7 @@ module("Integration | Component | themes-list", function (hooks) {
"themes tab is not active" "themes tab is not active"
); );
assert.notOk(exists(".inactive-indicator"), "there is no separator"); assert.dom(".inactive-indicator").doesNotExist("there is no separator");
assert.strictEqual( assert.strictEqual(
count(".themes-list-container__item .info"), count(".themes-list-container__item .info"),
5, 5,

View File

@ -36,9 +36,9 @@ module("Integration | Component | user-info", function (hooks) {
assert.ok(exists(`.name-line a[href="/u/${this.currentUser.username}"]`)); assert.ok(exists(`.name-line a[href="/u/${this.currentUser.username}"]`));
this.set("includeLink", false); this.set("includeLink", false);
assert.notOk( assert
exists(`.name-line a[href="/u/${this.currentUser.username}"]`) .dom(`.name-line a[href="/u/${this.currentUser.username}"]`)
); .doesNotExist();
}); });
test("includeAvatar", async function (assert) { test("includeAvatar", async function (assert) {

View File

@ -56,10 +56,11 @@ module(
this.currentUser.set("grouped_unread_notifications", {}); this.currentUser.set("grouped_unread_notifications", {});
await settled(); await settled();
assert.notOk( assert
exists(".panel-body-bottom .notifications-dismiss"), .dom(".panel-body-bottom .notifications-dismiss")
"dismiss button is not shown if the user no unread bookmark_reminder notifications" .doesNotExist(
); "dismiss button is not shown if the user no unread bookmark_reminder notifications"
);
}); });
test("empty state (aka blank page syndrome)", async function (assert) { test("empty state (aka blank page syndrome)", async function (assert) {

View File

@ -108,10 +108,11 @@ module(
hbs`<MountWidget @widget="post-small-action" @args={{this.args}} />` hbs`<MountWidget @widget="post-small-action" @args={{this.args}} />`
); );
assert.notOk( assert
exists(".abcde"), .dom(".abcde")
"custom CSS class is not added when condition is not met" .doesNotExist(
); "custom CSS class is not added when condition is not met"
);
this.set("args", { id: 123, canRecover: true }); this.set("args", { id: 123, canRecover: true });

View File

@ -452,7 +452,7 @@ module("Integration | Component | Widget | base", function (hooks) {
const parent = elementOneBefore.parentNode; const parent = elementOneBefore.parentNode;
const observer = new MutationObserver(function (mutations) { const observer = new MutationObserver(function (mutations) {
assert.notOk( assert.false(
mutations.some((m) => mutations.some((m) =>
Array.from(m.addedNodes).includes(elementOneBefore) Array.from(m.addedNodes).includes(elementOneBefore)
) )

View File

@ -55,7 +55,7 @@ module("Unit | Controller | admin-user-badges", function (hooks) {
const sortedNames = [badgeFirst.name, badgeMiddle.name, badgeLast.name]; const sortedNames = [badgeFirst.name, badgeMiddle.name, badgeLast.name];
const badgeNames = controller.availableBadges.map((badge) => badge.name); const badgeNames = controller.availableBadges.map((badge) => badge.name);
assert.notOk( assert.false(
badgeNames.includes(badgeDisabled), badgeNames.includes(badgeDisabled),
"excludes disabled badges" "excludes disabled badges"
); );

View File

@ -27,7 +27,7 @@ module("Unit | Lib | DAG", function (hooks) {
dag.delete("key2"); dag.delete("key2");
assert.ok(dag.has("key1")); assert.ok(dag.has("key1"));
assert.notOk(dag.has("key2")); assert.false(dag.has("key2"));
assert.ok(dag.has("key3")); assert.ok(dag.has("key3"));
}); });

View File

@ -68,7 +68,7 @@ module(
const result = await preloadItemImages(lightboxItem); const result = await preloadItemImages(lightboxItem);
assert.notOk( assert.false(
result.canZoom, result.canZoom,
"canZoom should be false if fullsizeImage width or height is smaller than window inner width or height" "canZoom should be false if fullsizeImage width or height is smaller than window inner width or height"
); );

View File

@ -237,12 +237,12 @@ module("Unit | Utility | sanitizer", function (hooks) {
) )
.match(/muted/) .match(/muted/)
); );
assert.notOk( assert.false(
engine /muted/.test(
.sanitize( engine.sanitize(
`<p>Hey</p><video><source src="http://example.com/music.mp4" type="audio/mpeg"></video>` `<p>Hey</p><video><source src="http://example.com/music.mp4" type="audio/mpeg"></video>`
) )
.match(/muted/) )
); );
}); });

View File

@ -28,7 +28,7 @@ module(
this.clock.restore(); this.clock.restore();
this.clock = fakeTime("2100-04-19 18:00:00", timezone, true); // evening this.clock = fakeTime("2100-04-19 18:00:00", timezone, true); // evening
result = hideDynamicTimeShortcuts(shortcuts, timezone).mapBy("id"); result = hideDynamicTimeShortcuts(shortcuts, timezone).mapBy("id");
assert.notOk(result.includes("doesn't show later_today in the evening")); assert.false(result.includes("doesn't show later_today in the evening"));
}); });
test("hides 'Later This Week' starting from Thursday", function (assert) { test("hides 'Later This Week' starting from Thursday", function (assert) {
@ -45,7 +45,7 @@ module(
this.clock.restore(); this.clock.restore();
this.clock = fakeTime("2100-04-22 18:00:00", timezone, true); // Thursday this.clock = fakeTime("2100-04-22 18:00:00", timezone, true); // Thursday
result = hideDynamicTimeShortcuts(shortcuts, timezone).mapBy("id"); result = hideDynamicTimeShortcuts(shortcuts, timezone).mapBy("id");
assert.notOk( assert.false(
result.includes("later_this_week"), result.includes("later_this_week"),
"doesn't show later_this_week on Thursdays" "doesn't show later_this_week on Thursdays"
); );
@ -53,7 +53,7 @@ module(
this.clock.restore(); this.clock.restore();
this.clock = fakeTime("2100-04-23 18:00:00", timezone, true); // Friday this.clock = fakeTime("2100-04-23 18:00:00", timezone, true); // Friday
result = hideDynamicTimeShortcuts(shortcuts, timezone).mapBy("id"); result = hideDynamicTimeShortcuts(shortcuts, timezone).mapBy("id");
assert.notOk( assert.false(
result.includes("later_this_week"), result.includes("later_this_week"),
"doesn't show later_this_week on Fridays" "doesn't show later_this_week on Fridays"
); );
@ -82,7 +82,7 @@ module(
timezone, timezone,
siteSettings siteSettings
).mapBy("id"); ).mapBy("id");
assert.notOk( assert.false(
result.includes("this_weekend"), result.includes("this_weekend"),
"doesn't show this_weekend on Fridays" "doesn't show this_weekend on Fridays"
); );
@ -94,7 +94,7 @@ module(
timezone, timezone,
siteSettings siteSettings
).mapBy("id"); ).mapBy("id");
assert.notOk( assert.false(
result.includes("this_weekend"), result.includes("this_weekend"),
"doesn't show this_weekend on Saturdays" "doesn't show this_weekend on Saturdays"
); );
@ -106,7 +106,7 @@ module(
timezone, timezone,
siteSettings siteSettings
).mapBy("id"); ).mapBy("id");
assert.notOk( assert.false(
result.includes("this_weekend"), result.includes("this_weekend"),
"doesn't show this_weekend on Sundays" "doesn't show this_weekend on Sundays"
); );
@ -123,7 +123,7 @@ module(
timezone, timezone,
siteSettings siteSettings
).mapBy("id"); ).mapBy("id");
assert.notOk( assert.false(
result.includes("this_weekend"), result.includes("this_weekend"),
"shows this_weekend on Thursdays" "shows this_weekend on Thursdays"
); );

View File

@ -23,15 +23,15 @@ module("Unit | Utility | uploads", function (hooks) {
}); });
test("validateUploadedFiles", function (assert) { test("validateUploadedFiles", function (assert) {
assert.notOk( assert.false(
validateUploadedFiles(null, { siteSettings: this.siteSettings }), validateUploadedFiles(null, { siteSettings: this.siteSettings }),
"no files are invalid" "no files are invalid"
); );
assert.notOk( assert.false(
validateUploadedFiles(undefined, { siteSettings: this.siteSettings }), validateUploadedFiles(undefined, { siteSettings: this.siteSettings }),
"undefined files are invalid" "undefined files are invalid"
); );
assert.notOk( assert.false(
validateUploadedFiles([], { siteSettings: this.siteSettings }), validateUploadedFiles([], { siteSettings: this.siteSettings }),
"empty array of files is invalid" "empty array of files is invalid"
); );
@ -40,7 +40,7 @@ module("Unit | Utility | uploads", function (hooks) {
test("uploading one file", function (assert) { test("uploading one file", function (assert) {
sinon.stub(dialog, "alert"); sinon.stub(dialog, "alert");
assert.notOk( assert.false(
validateUploadedFiles([1, 2], { siteSettings: this.siteSettings }) validateUploadedFiles([1, 2], { siteSettings: this.siteSettings })
); );
assert.ok(dialog.alert.calledWith(I18n.t("post.errors.too_many_uploads"))); assert.ok(dialog.alert.calledWith(I18n.t("post.errors.too_many_uploads")));
@ -50,7 +50,7 @@ module("Unit | Utility | uploads", function (hooks) {
this.siteSettings.newuser_max_embedded_media = 0; this.siteSettings.newuser_max_embedded_media = 0;
sinon.stub(dialog, "alert"); sinon.stub(dialog, "alert");
assert.notOk( assert.false(
validateUploadedFiles([{ name: "image.png" }], { validateUploadedFiles([{ name: "image.png" }], {
user: this.store.createRecord("user"), user: this.store.createRecord("user"),
siteSettings: this.siteSettings, siteSettings: this.siteSettings,
@ -94,7 +94,7 @@ module("Unit | Utility | uploads", function (hooks) {
this.siteSettings.newuser_max_attachments = 0; this.siteSettings.newuser_max_attachments = 0;
sinon.stub(dialog, "alert"); sinon.stub(dialog, "alert");
assert.notOk( assert.false(
validateUploadedFiles([{ name: "roman.txt" }], { validateUploadedFiles([{ name: "roman.txt" }], {
user: this.store.createRecord("user"), user: this.store.createRecord("user"),
siteSettings: this.siteSettings, siteSettings: this.siteSettings,
@ -109,7 +109,7 @@ module("Unit | Utility | uploads", function (hooks) {
test("ensures an authorized upload", function (assert) { test("ensures an authorized upload", function (assert) {
sinon.stub(dialog, "alert"); sinon.stub(dialog, "alert");
assert.notOk( assert.false(
validateUploadedFiles([{ name: "unauthorized.html" }], { validateUploadedFiles([{ name: "unauthorized.html" }], {
siteSettings: this.siteSettings, siteSettings: this.siteSettings,
}) })
@ -130,7 +130,7 @@ module("Unit | Utility | uploads", function (hooks) {
const files = [{ name: "backup.tar.gz" }]; const files = [{ name: "backup.tar.gz" }];
sinon.stub(dialog, "alert"); sinon.stub(dialog, "alert");
assert.notOk( assert.false(
validateUploadedFiles(files, { validateUploadedFiles(files, {
skipValidation: false, skipValidation: false,
siteSettings: this.siteSettings, siteSettings: this.siteSettings,
@ -149,7 +149,7 @@ module("Unit | Utility | uploads", function (hooks) {
this.siteSettings.authorized_extensions_for_staff = ""; this.siteSettings.authorized_extensions_for_staff = "";
sinon.stub(dialog, "alert"); sinon.stub(dialog, "alert");
assert.notOk( assert.false(
validateUploadedFiles([{ name: "test.jpg" }], { validateUploadedFiles([{ name: "test.jpg" }], {
user: this.store.createRecord("user"), user: this.store.createRecord("user"),
siteSettings: this.siteSettings, siteSettings: this.siteSettings,
@ -165,7 +165,7 @@ module("Unit | Utility | uploads", function (hooks) {
this.siteSettings.authorized_extensions_for_staff = ""; this.siteSettings.authorized_extensions_for_staff = "";
sinon.stub(dialog, "alert"); sinon.stub(dialog, "alert");
assert.notOk( assert.false(
validateUploadedFiles([{ name: "test.jpg" }], { validateUploadedFiles([{ name: "test.jpg" }], {
user: this.store.createRecord("user", { staff: true }), user: this.store.createRecord("user", { staff: true }),
siteSettings: this.siteSettings, siteSettings: this.siteSettings,
@ -182,7 +182,7 @@ module("Unit | Utility | uploads", function (hooks) {
sinon.stub(dialog, "alert"); sinon.stub(dialog, "alert");
let user = this.store.createRecord("user", { moderator: true }); let user = this.store.createRecord("user", { moderator: true });
assert.notOk( assert.false(
validateUploadedFiles(files, { user, siteSettings: this.siteSettings }) validateUploadedFiles(files, { user, siteSettings: this.siteSettings })
); );
assert.ok( assert.ok(
@ -231,7 +231,7 @@ module("Unit | Utility | uploads", function (hooks) {
}) })
); );
assert.notOk(dialog.alert.calledOnce); assert.false(dialog.alert.calledOnce);
}); });
test("isImage", function (assert) { test("isImage", function (assert) {
@ -245,9 +245,9 @@ module("Unit | Utility | uploads", function (hooks) {
); );
} }
); );
assert.notOk(isImage("file.txt")); assert.false(isImage("file.txt"));
assert.notOk(isImage("http://foo.bar/path/to/file.txt")); assert.false(isImage("http://foo.bar/path/to/file.txt"));
assert.notOk(isImage("")); assert.false(isImage(""));
}); });
test("allowsImages", function (assert) { test("allowsImages", function (assert) {
@ -275,7 +275,7 @@ module("Unit | Utility | uploads", function (hooks) {
test("allowsAttachments", function (assert) { test("allowsAttachments", function (assert) {
this.siteSettings.authorized_extensions = "jpg|jpeg|gif"; this.siteSettings.authorized_extensions = "jpg|jpeg|gif";
assert.notOk( assert.false(
allowsAttachments(false, this.siteSettings), allowsAttachments(false, this.siteSettings),
"no attachments allowed by default" "no attachments allowed by default"
); );

View File

@ -22,7 +22,7 @@ module("Unit | Model | tag", function (hooks) {
test("pmOnly", function (assert) { test("pmOnly", function (assert) {
const tag = this.store.createRecord("tag", { pm_only: false }); const tag = this.store.createRecord("tag", { pm_only: false });
assert.notOk(tag.pmOnly); assert.false(tag.pmOnly);
tag.set("pm_only", true); tag.set("pm_only", true);

View File

@ -25,7 +25,7 @@ module("Unit | Model | topic", function (hooks) {
last_read_post_number: 1, last_read_post_number: 1,
}); });
assert.notOk(topic.visited, "not visited unless we've read all the posts"); assert.false(topic.visited, "not visited unless we've read all the posts");
topic.set("last_read_post_number", 2); topic.set("last_read_post_number", 2);
assert.ok(topic.visited, "is visited once we've read all the posts"); assert.ok(topic.visited, "is visited once we've read all the posts");

View File

@ -368,7 +368,7 @@ module("Unit | Model | topic-tracking-state", function (hooks) {
trackingState.sync(list, "unread"); trackingState.sync(list, "unread");
assert.notOk( assert.false(
trackingState.states.has("t111"), trackingState.states.has("t111"),
"expect state for topic 111 to be deleted" "expect state for topic 111 to be deleted"
); );

View File

@ -67,7 +67,7 @@ module("Unit | Model | user-badge", function (hooks) {
test("favorite", async function (assert) { test("favorite", async function (assert) {
const store = getOwner(this).lookup("service:store"); const store = getOwner(this).lookup("service:store");
const userBadge = store.createRecord("user-badge", { id: 1 }); const userBadge = store.createRecord("user-badge", { id: 1 });
assert.notOk(userBadge.is_favorite); assert.strictEqual(userBadge.is_favorite, undefined);
await userBadge.favorite(); await userBadge.favorite();
assert.ok(userBadge.is_favorite); assert.ok(userBadge.is_favorite);

View File

@ -185,11 +185,11 @@ module("Unit | Model | user", function (hooks) {
_clearStatusTimerId: 100, _clearStatusTimerId: 100,
}); });
assert.notOk( assert.false(
user.hasOwnProperty("_subscribersCount"), user.hasOwnProperty("_subscribersCount"),
"_subscribersCount wasn't set" "_subscribersCount wasn't set"
); );
assert.notOk( assert.false(
user.hasOwnProperty("_clearStatusTimerId"), user.hasOwnProperty("_clearStatusTimerId"),
"_clearStatusTimerId wasn't set" "_clearStatusTimerId wasn't set"
); );

View File

@ -17,6 +17,6 @@ module("Unit | Service | header", function (hooks) {
test("it does not register invalid buttons for hiders", function (assert) { test("it does not register invalid buttons for hiders", function (assert) {
this.header.registerHider(this, ["search", "blahblah"]); this.header.registerHider(this, ["search", "blahblah"]);
assert.notOk(this.header.headerButtonsHidden.includes("blah")); assert.false(this.header.headerButtonsHidden.includes("blah"));
}); });
}); });

View File

@ -1,10 +1,6 @@
import { click, visit } from "@ember/test-helpers"; import { click, visit } from "@ember/test-helpers";
import { skip } from "qunit"; import { skip } from "qunit";
import { import { acceptance, visible } from "discourse/tests/helpers/qunit-helpers";
acceptance,
exists,
visible,
} from "discourse/tests/helpers/qunit-helpers";
acceptance("Discourse Chat - Chat live pane collapse", function (needs) { acceptance("Discourse Chat - Chat live pane collapse", function (needs) {
needs.user({ needs.user({
@ -118,19 +114,19 @@ acceptance("Discourse Chat - Chat live pane collapse", function (needs) {
assert.ok(visible(videoContainer)); assert.ok(visible(videoContainer));
assert.ok(visible(collapseImage), "the open arrow is shown"); assert.ok(visible(collapseImage), "the open arrow is shown");
assert.notOk(exists(expandImage), "the close arrow is hidden"); assert.dom(expandImage).doesNotExist("the close arrow is hidden");
await click(collapseImage); await click(collapseImage);
assert.notOk(visible(videoContainer)); assert.dom(videoContainer).isNotVisible();
assert.ok(visible(expandImage), "the close arrow is shown"); assert.ok(visible(expandImage), "the close arrow is shown");
assert.notOk(exists(collapseImage), "the open arrow is hidden"); assert.dom(collapseImage).doesNotExist("the open arrow is hidden");
await click(expandImage); await click(expandImage);
assert.ok(visible(videoContainer)); assert.ok(visible(videoContainer));
assert.ok(visible(collapseImage), "the open arrow is shown again"); assert.ok(visible(collapseImage), "the open arrow is shown again");
assert.notOk(exists(expandImage), "the close arrow is hidden again"); assert.dom(expandImage).doesNotExist("the close arrow is hidden again");
}); });
skip("lightbox shows up before and after expand and collapse", async function (assert) { skip("lightbox shows up before and after expand and collapse", async function (assert) {

View File

@ -102,8 +102,8 @@ module(
await settled(); await settled();
assert.notOk(this.manager.picker); assert.strictEqual(this.manager.picker, null);
assert.notOk(this.manager.closing); assert.false(this.manager.closing);
assert.deepEqual( assert.deepEqual(
this.manager.visibleSections, this.manager.visibleSections,
["favorites", "smileys_&_emotion"], ["favorites", "smileys_&_emotion"],

View File

@ -25,29 +25,29 @@ acceptance("Discourse Chat | Unit | Service | chat-guardian", function (needs) {
set(this.currentUser, "admin", false); set(this.currentUser, "admin", false);
set(this.currentUser, "moderator", false); set(this.currentUser, "moderator", false);
this.siteSettings.chat_enabled = false; this.siteSettings.chat_enabled = false;
assert.notOk(this.chatGuardian.canEditChatChannel()); assert.false(this.chatGuardian.canEditChatChannel());
set(this.currentUser, "has_chat_enabled", true); set(this.currentUser, "has_chat_enabled", true);
set(this.currentUser, "admin", true); set(this.currentUser, "admin", true);
this.siteSettings.chat_enabled = false; this.siteSettings.chat_enabled = false;
assert.notOk(this.chatGuardian.canEditChatChannel()); assert.false(this.chatGuardian.canEditChatChannel());
set(this.currentUser, "has_chat_enabled", false); set(this.currentUser, "has_chat_enabled", false);
set(this.currentUser, "admin", false); set(this.currentUser, "admin", false);
set(this.currentUser, "moderator", false); set(this.currentUser, "moderator", false);
this.siteSettings.chat_enabled = true; this.siteSettings.chat_enabled = true;
assert.notOk(this.chatGuardian.canEditChatChannel()); assert.false(this.chatGuardian.canEditChatChannel());
set(this.currentUser, "has_chat_enabled", false); set(this.currentUser, "has_chat_enabled", false);
set(this.currentUser, "admin", true); set(this.currentUser, "admin", true);
this.siteSettings.chat_enabled = true; this.siteSettings.chat_enabled = true;
assert.notOk(this.chatGuardian.canEditChatChannel()); assert.false(this.chatGuardian.canEditChatChannel());
set(this.currentUser, "has_chat_enabled", true); set(this.currentUser, "has_chat_enabled", true);
set(this.currentUser, "admin", false); set(this.currentUser, "admin", false);
set(this.currentUser, "moderator", false); set(this.currentUser, "moderator", false);
this.siteSettings.chat_enabled = true; this.siteSettings.chat_enabled = true;
assert.notOk(this.chatGuardian.canEditChatChannel()); assert.false(this.chatGuardian.canEditChatChannel());
set(this.currentUser, "has_chat_enabled", true); set(this.currentUser, "has_chat_enabled", true);
set(this.currentUser, "admin", true); set(this.currentUser, "admin", true);
@ -58,11 +58,11 @@ acceptance("Discourse Chat | Unit | Service | chat-guardian", function (needs) {
test("#canUseChat", async function (assert) { test("#canUseChat", async function (assert) {
set(this.currentUser, "has_chat_enabled", false); set(this.currentUser, "has_chat_enabled", false);
this.siteSettings.chat_enabled = true; this.siteSettings.chat_enabled = true;
assert.notOk(this.chatGuardian.canUseChat()); assert.false(this.chatGuardian.canUseChat());
set(this.currentUser, "has_chat_enabled", true); set(this.currentUser, "has_chat_enabled", true);
this.siteSettings.chat_enabled = false; this.siteSettings.chat_enabled = false;
assert.notOk(this.chatGuardian.canUseChat()); assert.false(this.chatGuardian.canUseChat());
set(this.currentUser, "has_chat_enabled", true); set(this.currentUser, "has_chat_enabled", true);
this.siteSettings.chat_enabled = true; this.siteSettings.chat_enabled = true;
@ -80,16 +80,16 @@ acceptance("Discourse Chat | Unit | Service | chat-guardian", function (needs) {
set(this.currentUser, "admin", false); set(this.currentUser, "admin", false);
set(this.currentUser, "moderator", false); set(this.currentUser, "moderator", false);
assert.notOk(this.chatGuardian.canArchiveChannel(channel)); assert.false(this.chatGuardian.canArchiveChannel(channel));
set(this.currentUser, "admin", true); set(this.currentUser, "admin", true);
set(this.currentUser, "moderator", true); set(this.currentUser, "moderator", true);
channel.status = "read_only"; channel.status = "read_only";
assert.notOk(this.chatGuardian.canArchiveChannel(channel)); assert.false(this.chatGuardian.canArchiveChannel(channel));
channel.status = "open"; channel.status = "open";
channel.status = "archived"; channel.status = "archived";
assert.notOk(this.chatGuardian.canArchiveChannel(channel)); assert.false(this.chatGuardian.canArchiveChannel(channel));
channel.status = "open"; channel.status = "open";
}); });
}); });

View File

@ -22,7 +22,7 @@ module(
}); });
test("isFullPagePreferred", function (assert) { test("isFullPagePreferred", function (assert) {
assert.notOk(this.subject.isFullPagePreferred); assert.false(this.subject.isFullPagePreferred);
this.subject.prefersFullPage(); this.subject.prefersFullPage();
@ -30,7 +30,7 @@ module(
this.subject.prefersDrawer(); this.subject.prefersDrawer();
assert.notOk(this.subject.isFullPagePreferred); assert.false(this.subject.isFullPagePreferred);
this.subject.prefersDrawer(); this.subject.prefersDrawer();
Site.currentProp("mobileView", true); Site.currentProp("mobileView", true);
@ -43,7 +43,7 @@ module(
this.subject.prefersFullPage(); this.subject.prefersFullPage();
assert.notOk(this.subject.isDrawerPreferred); assert.false(this.subject.isDrawerPreferred);
this.subject.prefersDrawer(); this.subject.prefersDrawer();
@ -73,7 +73,7 @@ module(
test("isFullPageActive", function (assert) { test("isFullPageActive", function (assert) {
sinon.stub(this.subject.router, "currentRouteName").value("foo"); sinon.stub(this.subject.router, "currentRouteName").value("foo");
assert.notOk(this.subject.isFullPageActive); assert.false(this.subject.isFullPageActive);
sinon.stub(this.subject.router, "currentRouteName").value("chat"); sinon.stub(this.subject.router, "currentRouteName").value("chat");
assert.ok(this.subject.isFullPageActive); assert.ok(this.subject.isFullPageActive);

View File

@ -68,7 +68,7 @@ module("Chat | Unit | Utility | plugin-api", function (hooks) {
updatedSecondaryActions.length < secondaryActions.length, updatedSecondaryActions.length < secondaryActions.length,
"the updated secondary actions must contain less items than the original" "the updated secondary actions must contain less items than the original"
); );
assert.notOk( assert.false(
updatedSecondaryActions updatedSecondaryActions
.map((v) => v.id) .map((v) => v.id)
.includes(secondaryActions[0]), .includes(secondaryActions[0]),

View File

@ -108,9 +108,9 @@ module("lib:date-with-zone-helper", function () {
timezone: PARIS, timezone: PARIS,
}); });
assert.notOk(date.isDST()); assert.false(date.isDST());
futureLocalDate = date.add(8, "months"); futureLocalDate = date.add(8, "months");
assert.notOk(futureLocalDate.isDST()); assert.false(futureLocalDate.isDST());
assert.strictEqual( assert.strictEqual(
futureLocalDate.format(), futureLocalDate.format(),
"2020-11-19T15:36:00.000+01:00", "2020-11-19T15:36:00.000+01:00",
@ -140,7 +140,7 @@ module("lib:date-with-zone-helper", function () {
minute: 36, minute: 36,
timezone: PARIS, timezone: PARIS,
}); });
assert.notOk(date.isDST()); assert.false(date.isDST());
futureLocalDate = date.add(1, "week"); futureLocalDate = date.add(1, "week");
assert.ok(futureLocalDate.isDST()); assert.ok(futureLocalDate.isDST());
assert.strictEqual( assert.strictEqual(
@ -159,7 +159,7 @@ module("lib:date-with-zone-helper", function () {
assert.ok(date.isDST()); assert.ok(date.isDST());
futureLocalDate = date.add(8, "months"); futureLocalDate = date.add(8, "months");
assert.notOk(futureLocalDate.isDST()); assert.false(futureLocalDate.isDST());
assert.strictEqual( assert.strictEqual(
futureLocalDate.format(), futureLocalDate.format(),
"2020-12-01T15:36:00.000+01:00", "2020-12-01T15:36:00.000+01:00",