mirror of
https://github.com/discourse/discourse.git
synced 2024-11-21 16:38:15 -06:00
DEV: Convert more notOk
assertions (#29556)
…to either qunit-dom or `strictEqual`
This commit is contained in:
parent
693a4e691b
commit
9694d2477a
@ -195,26 +195,29 @@ acceptance("Admin Sidebar - Sections - Plugin API", function (needs) {
|
||||
"link is appended to the root section"
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
exists(
|
||||
assert
|
||||
.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\"]"
|
||||
),
|
||||
"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(
|
||||
exists(
|
||||
assert
|
||||
.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\"]"
|
||||
),
|
||||
"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(
|
||||
exists(
|
||||
assert
|
||||
.dom(
|
||||
".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) {
|
||||
@ -225,25 +228,24 @@ acceptance("Admin Sidebar - Sections - Plugin API", function (needs) {
|
||||
"#sidebar-section-content-community .sidebar-section-link[data-link-name='primary']"
|
||||
)
|
||||
);
|
||||
assert.notOk(
|
||||
exists(
|
||||
assert
|
||||
.dom(
|
||||
"#sidebar-section-content-community .sidebar-section-link[data-link-name='secondary']"
|
||||
)
|
||||
);
|
||||
.doesNotExist();
|
||||
|
||||
await click(".sidebar-more-section-links-details-summary");
|
||||
|
||||
assert.notOk(
|
||||
exists(
|
||||
assert
|
||||
.dom(
|
||||
".sidebar-more-section-links-details-content .sidebar-section-link[data-link-name='primary']"
|
||||
)
|
||||
);
|
||||
.doesNotExist();
|
||||
assert.ok(
|
||||
exists(
|
||||
".sidebar-more-section-links-details-content .sidebar-section-link[data-link-name='secondary']"
|
||||
)
|
||||
);
|
||||
assert.ok(true);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -267,7 +267,7 @@ acceptance("Admin - User Index", function (needs) {
|
||||
|
||||
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) {
|
||||
|
@ -29,7 +29,7 @@ acceptance("Category Edit - Security", function (needs) {
|
||||
await visit("/c/bug/edit/security");
|
||||
|
||||
await availableGroups.expand();
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
availableGroups.rowByValue("everyone").exists(),
|
||||
"everyone is already used and is not in the available groups"
|
||||
);
|
||||
|
@ -1104,7 +1104,7 @@ acceptance("Composer - Error Extensibility", function (needs) {
|
||||
await fillIn("#reply-title", "this title triggers an error");
|
||||
await fillIn(".d-editor-input", "this is the *content* of a post");
|
||||
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) {
|
||||
|
@ -149,7 +149,7 @@ acceptance("Dashboard: dashboard_hidden_reports", function (needs) {
|
||||
await visit("/admin");
|
||||
|
||||
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
|
||||
.dom(".admin-report.is-visible.dau-by-mau")
|
||||
.doesNotExist("dau-by-mau report");
|
||||
|
@ -90,12 +90,11 @@ acceptance(
|
||||
".sidebar-section[data-section-name='messages'] .sidebar-section-header"
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
exists(
|
||||
assert
|
||||
.dom(
|
||||
".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) {
|
||||
@ -176,12 +175,13 @@ acceptance(
|
||||
`personal message ${type} link is marked as active`
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
exists(
|
||||
assert
|
||||
.dom(
|
||||
`.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`
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -16,10 +16,9 @@ module(
|
||||
hbs`<FormTemplateField::Wrapper @content={{this.content}} />`
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
exists(".form-template-field"),
|
||||
"A form template field should not exist"
|
||||
);
|
||||
assert
|
||||
.dom(".form-template-field")
|
||||
.doesNotExist("A form template field should not exist");
|
||||
assert.ok(exists(".alert"), "An alert message should exist");
|
||||
});
|
||||
|
||||
|
@ -40,7 +40,7 @@ module(
|
||||
|
||||
await this.subject.expand();
|
||||
|
||||
assert.notOk(this.subject.rowByValue(2).exists());
|
||||
assert.false(this.subject.rowByValue(2).exists());
|
||||
});
|
||||
|
||||
test("with scopedCategoryId", async function (assert) {
|
||||
|
@ -57,10 +57,9 @@ module("Integration | Component | select-kit/combo-box", function (hooks) {
|
||||
|
||||
await click(header.el().querySelector(".btn-clear"));
|
||||
|
||||
assert.notOk(
|
||||
header.el().querySelector(".btn-clear"),
|
||||
"it hides the clear button"
|
||||
);
|
||||
assert
|
||||
.dom(".btn-clear", header.el())
|
||||
.doesNotExist("hides the clear button");
|
||||
assert.strictEqual(header.value(), null);
|
||||
});
|
||||
|
||||
|
@ -49,9 +49,9 @@ module(
|
||||
assert.ok(this.subject.isExpanded());
|
||||
|
||||
await this.subject.selectRowByValue(DEFAULT_VALUE);
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
this.subject.isExpanded(),
|
||||
"it collapses the dropdown on select"
|
||||
"collapses the dropdown on select"
|
||||
);
|
||||
});
|
||||
|
||||
@ -74,10 +74,9 @@ module(
|
||||
/>
|
||||
`);
|
||||
|
||||
assert.notOk(
|
||||
this.subject.header().el().querySelector(".selected-name"),
|
||||
"it hides the text of the selected item"
|
||||
);
|
||||
assert
|
||||
.dom(".selected-name", this.subject.header().el())
|
||||
.doesNotExist("hides the text of the selected item");
|
||||
|
||||
assert.strictEqual(
|
||||
this.subject.header().el().getAttribute("title"),
|
||||
|
@ -108,7 +108,7 @@ module(
|
||||
const options = getOptions();
|
||||
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) {
|
||||
|
@ -74,7 +74,7 @@ module("Integration | Component | select-kit/multi-select", function (hooks) {
|
||||
await this.subject.expand();
|
||||
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.deselectItemByValue(1);
|
||||
|
@ -97,7 +97,7 @@ module("Integration | Component | select-kit/single-select", function (hooks) {
|
||||
|
||||
await tab();
|
||||
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
this.subject.isExpanded(),
|
||||
"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 });
|
||||
|
||||
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) {
|
||||
|
@ -2,12 +2,7 @@ import { fillIn, render } from "@ember/test-helpers";
|
||||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import {
|
||||
count,
|
||||
exists,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { count, query, queryAll } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import I18n from "discourse-i18n";
|
||||
import Theme, { COMPONENTS, THEMES } from "admin/models/theme";
|
||||
@ -137,7 +132,7 @@ module("Integration | Component | themes-list", function (hooks) {
|
||||
"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(
|
||||
count(".themes-list-container__item .info"),
|
||||
5,
|
||||
|
@ -36,9 +36,9 @@ module("Integration | Component | user-info", function (hooks) {
|
||||
assert.ok(exists(`.name-line a[href="/u/${this.currentUser.username}"]`));
|
||||
|
||||
this.set("includeLink", false);
|
||||
assert.notOk(
|
||||
exists(`.name-line a[href="/u/${this.currentUser.username}"]`)
|
||||
);
|
||||
assert
|
||||
.dom(`.name-line a[href="/u/${this.currentUser.username}"]`)
|
||||
.doesNotExist();
|
||||
});
|
||||
|
||||
test("includeAvatar", async function (assert) {
|
||||
|
@ -56,10 +56,11 @@ module(
|
||||
this.currentUser.set("grouped_unread_notifications", {});
|
||||
await settled();
|
||||
|
||||
assert.notOk(
|
||||
exists(".panel-body-bottom .notifications-dismiss"),
|
||||
"dismiss button is not shown if the user no unread bookmark_reminder notifications"
|
||||
);
|
||||
assert
|
||||
.dom(".panel-body-bottom .notifications-dismiss")
|
||||
.doesNotExist(
|
||||
"dismiss button is not shown if the user no unread bookmark_reminder notifications"
|
||||
);
|
||||
});
|
||||
|
||||
test("empty state (aka blank page syndrome)", async function (assert) {
|
||||
|
@ -108,10 +108,11 @@ module(
|
||||
hbs`<MountWidget @widget="post-small-action" @args={{this.args}} />`
|
||||
);
|
||||
|
||||
assert.notOk(
|
||||
exists(".abcde"),
|
||||
"custom CSS class is not added when condition is not met"
|
||||
);
|
||||
assert
|
||||
.dom(".abcde")
|
||||
.doesNotExist(
|
||||
"custom CSS class is not added when condition is not met"
|
||||
);
|
||||
|
||||
this.set("args", { id: 123, canRecover: true });
|
||||
|
||||
|
@ -452,7 +452,7 @@ module("Integration | Component | Widget | base", function (hooks) {
|
||||
|
||||
const parent = elementOneBefore.parentNode;
|
||||
const observer = new MutationObserver(function (mutations) {
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
mutations.some((m) =>
|
||||
Array.from(m.addedNodes).includes(elementOneBefore)
|
||||
)
|
||||
|
@ -55,7 +55,7 @@ module("Unit | Controller | admin-user-badges", function (hooks) {
|
||||
const sortedNames = [badgeFirst.name, badgeMiddle.name, badgeLast.name];
|
||||
const badgeNames = controller.availableBadges.map((badge) => badge.name);
|
||||
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
badgeNames.includes(badgeDisabled),
|
||||
"excludes disabled badges"
|
||||
);
|
||||
|
@ -27,7 +27,7 @@ module("Unit | Lib | DAG", function (hooks) {
|
||||
dag.delete("key2");
|
||||
|
||||
assert.ok(dag.has("key1"));
|
||||
assert.notOk(dag.has("key2"));
|
||||
assert.false(dag.has("key2"));
|
||||
assert.ok(dag.has("key3"));
|
||||
});
|
||||
|
||||
|
@ -68,7 +68,7 @@ module(
|
||||
|
||||
const result = await preloadItemImages(lightboxItem);
|
||||
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
result.canZoom,
|
||||
"canZoom should be false if fullsizeImage width or height is smaller than window inner width or height"
|
||||
);
|
||||
|
@ -237,12 +237,12 @@ module("Unit | Utility | sanitizer", function (hooks) {
|
||||
)
|
||||
.match(/muted/)
|
||||
);
|
||||
assert.notOk(
|
||||
engine
|
||||
.sanitize(
|
||||
assert.false(
|
||||
/muted/.test(
|
||||
engine.sanitize(
|
||||
`<p>Hey</p><video><source src="http://example.com/music.mp4" type="audio/mpeg"></video>`
|
||||
)
|
||||
.match(/muted/)
|
||||
)
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -28,7 +28,7 @@ module(
|
||||
this.clock.restore();
|
||||
this.clock = fakeTime("2100-04-19 18:00:00", timezone, true); // evening
|
||||
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) {
|
||||
@ -45,7 +45,7 @@ module(
|
||||
this.clock.restore();
|
||||
this.clock = fakeTime("2100-04-22 18:00:00", timezone, true); // Thursday
|
||||
result = hideDynamicTimeShortcuts(shortcuts, timezone).mapBy("id");
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
result.includes("later_this_week"),
|
||||
"doesn't show later_this_week on Thursdays"
|
||||
);
|
||||
@ -53,7 +53,7 @@ module(
|
||||
this.clock.restore();
|
||||
this.clock = fakeTime("2100-04-23 18:00:00", timezone, true); // Friday
|
||||
result = hideDynamicTimeShortcuts(shortcuts, timezone).mapBy("id");
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
result.includes("later_this_week"),
|
||||
"doesn't show later_this_week on Fridays"
|
||||
);
|
||||
@ -82,7 +82,7 @@ module(
|
||||
timezone,
|
||||
siteSettings
|
||||
).mapBy("id");
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
result.includes("this_weekend"),
|
||||
"doesn't show this_weekend on Fridays"
|
||||
);
|
||||
@ -94,7 +94,7 @@ module(
|
||||
timezone,
|
||||
siteSettings
|
||||
).mapBy("id");
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
result.includes("this_weekend"),
|
||||
"doesn't show this_weekend on Saturdays"
|
||||
);
|
||||
@ -106,7 +106,7 @@ module(
|
||||
timezone,
|
||||
siteSettings
|
||||
).mapBy("id");
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
result.includes("this_weekend"),
|
||||
"doesn't show this_weekend on Sundays"
|
||||
);
|
||||
@ -123,7 +123,7 @@ module(
|
||||
timezone,
|
||||
siteSettings
|
||||
).mapBy("id");
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
result.includes("this_weekend"),
|
||||
"shows this_weekend on Thursdays"
|
||||
);
|
||||
|
@ -23,15 +23,15 @@ module("Unit | Utility | uploads", function (hooks) {
|
||||
});
|
||||
|
||||
test("validateUploadedFiles", function (assert) {
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
validateUploadedFiles(null, { siteSettings: this.siteSettings }),
|
||||
"no files are invalid"
|
||||
);
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
validateUploadedFiles(undefined, { siteSettings: this.siteSettings }),
|
||||
"undefined files are invalid"
|
||||
);
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
validateUploadedFiles([], { siteSettings: this.siteSettings }),
|
||||
"empty array of files is invalid"
|
||||
);
|
||||
@ -40,7 +40,7 @@ module("Unit | Utility | uploads", function (hooks) {
|
||||
test("uploading one file", function (assert) {
|
||||
sinon.stub(dialog, "alert");
|
||||
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
validateUploadedFiles([1, 2], { siteSettings: this.siteSettings })
|
||||
);
|
||||
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;
|
||||
sinon.stub(dialog, "alert");
|
||||
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
validateUploadedFiles([{ name: "image.png" }], {
|
||||
user: this.store.createRecord("user"),
|
||||
siteSettings: this.siteSettings,
|
||||
@ -94,7 +94,7 @@ module("Unit | Utility | uploads", function (hooks) {
|
||||
this.siteSettings.newuser_max_attachments = 0;
|
||||
sinon.stub(dialog, "alert");
|
||||
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
validateUploadedFiles([{ name: "roman.txt" }], {
|
||||
user: this.store.createRecord("user"),
|
||||
siteSettings: this.siteSettings,
|
||||
@ -109,7 +109,7 @@ module("Unit | Utility | uploads", function (hooks) {
|
||||
|
||||
test("ensures an authorized upload", function (assert) {
|
||||
sinon.stub(dialog, "alert");
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
validateUploadedFiles([{ name: "unauthorized.html" }], {
|
||||
siteSettings: this.siteSettings,
|
||||
})
|
||||
@ -130,7 +130,7 @@ module("Unit | Utility | uploads", function (hooks) {
|
||||
const files = [{ name: "backup.tar.gz" }];
|
||||
sinon.stub(dialog, "alert");
|
||||
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
validateUploadedFiles(files, {
|
||||
skipValidation: false,
|
||||
siteSettings: this.siteSettings,
|
||||
@ -149,7 +149,7 @@ module("Unit | Utility | uploads", function (hooks) {
|
||||
this.siteSettings.authorized_extensions_for_staff = "";
|
||||
|
||||
sinon.stub(dialog, "alert");
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
validateUploadedFiles([{ name: "test.jpg" }], {
|
||||
user: this.store.createRecord("user"),
|
||||
siteSettings: this.siteSettings,
|
||||
@ -165,7 +165,7 @@ module("Unit | Utility | uploads", function (hooks) {
|
||||
this.siteSettings.authorized_extensions_for_staff = "";
|
||||
|
||||
sinon.stub(dialog, "alert");
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
validateUploadedFiles([{ name: "test.jpg" }], {
|
||||
user: this.store.createRecord("user", { staff: true }),
|
||||
siteSettings: this.siteSettings,
|
||||
@ -182,7 +182,7 @@ module("Unit | Utility | uploads", function (hooks) {
|
||||
sinon.stub(dialog, "alert");
|
||||
|
||||
let user = this.store.createRecord("user", { moderator: true });
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
validateUploadedFiles(files, { user, siteSettings: this.siteSettings })
|
||||
);
|
||||
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) {
|
||||
@ -245,9 +245,9 @@ module("Unit | Utility | uploads", function (hooks) {
|
||||
);
|
||||
}
|
||||
);
|
||||
assert.notOk(isImage("file.txt"));
|
||||
assert.notOk(isImage("http://foo.bar/path/to/file.txt"));
|
||||
assert.notOk(isImage(""));
|
||||
assert.false(isImage("file.txt"));
|
||||
assert.false(isImage("http://foo.bar/path/to/file.txt"));
|
||||
assert.false(isImage(""));
|
||||
});
|
||||
|
||||
test("allowsImages", function (assert) {
|
||||
@ -275,7 +275,7 @@ module("Unit | Utility | uploads", function (hooks) {
|
||||
|
||||
test("allowsAttachments", function (assert) {
|
||||
this.siteSettings.authorized_extensions = "jpg|jpeg|gif";
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
allowsAttachments(false, this.siteSettings),
|
||||
"no attachments allowed by default"
|
||||
);
|
||||
|
@ -22,7 +22,7 @@ module("Unit | Model | tag", function (hooks) {
|
||||
test("pmOnly", function (assert) {
|
||||
const tag = this.store.createRecord("tag", { pm_only: false });
|
||||
|
||||
assert.notOk(tag.pmOnly);
|
||||
assert.false(tag.pmOnly);
|
||||
|
||||
tag.set("pm_only", true);
|
||||
|
||||
|
@ -25,7 +25,7 @@ module("Unit | Model | topic", function (hooks) {
|
||||
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);
|
||||
assert.ok(topic.visited, "is visited once we've read all the posts");
|
||||
|
@ -368,7 +368,7 @@ module("Unit | Model | topic-tracking-state", function (hooks) {
|
||||
|
||||
trackingState.sync(list, "unread");
|
||||
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
trackingState.states.has("t111"),
|
||||
"expect state for topic 111 to be deleted"
|
||||
);
|
||||
|
@ -67,7 +67,7 @@ module("Unit | Model | user-badge", function (hooks) {
|
||||
test("favorite", async function (assert) {
|
||||
const store = getOwner(this).lookup("service:store");
|
||||
const userBadge = store.createRecord("user-badge", { id: 1 });
|
||||
assert.notOk(userBadge.is_favorite);
|
||||
assert.strictEqual(userBadge.is_favorite, undefined);
|
||||
|
||||
await userBadge.favorite();
|
||||
assert.ok(userBadge.is_favorite);
|
||||
|
@ -185,11 +185,11 @@ module("Unit | Model | user", function (hooks) {
|
||||
_clearStatusTimerId: 100,
|
||||
});
|
||||
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
user.hasOwnProperty("_subscribersCount"),
|
||||
"_subscribersCount wasn't set"
|
||||
);
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
user.hasOwnProperty("_clearStatusTimerId"),
|
||||
"_clearStatusTimerId wasn't set"
|
||||
);
|
||||
|
@ -17,6 +17,6 @@ module("Unit | Service | header", function (hooks) {
|
||||
|
||||
test("it does not register invalid buttons for hiders", function (assert) {
|
||||
this.header.registerHider(this, ["search", "blahblah"]);
|
||||
assert.notOk(this.header.headerButtonsHidden.includes("blah"));
|
||||
assert.false(this.header.headerButtonsHidden.includes("blah"));
|
||||
});
|
||||
});
|
||||
|
@ -1,10 +1,6 @@
|
||||
import { click, visit } from "@ember/test-helpers";
|
||||
import { skip } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
exists,
|
||||
visible,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, visible } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Discourse Chat - Chat live pane collapse", function (needs) {
|
||||
needs.user({
|
||||
@ -118,19 +114,19 @@ acceptance("Discourse Chat - Chat live pane collapse", function (needs) {
|
||||
|
||||
assert.ok(visible(videoContainer));
|
||||
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);
|
||||
|
||||
assert.notOk(visible(videoContainer));
|
||||
assert.dom(videoContainer).isNotVisible();
|
||||
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);
|
||||
|
||||
assert.ok(visible(videoContainer));
|
||||
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) {
|
||||
|
@ -102,8 +102,8 @@ module(
|
||||
|
||||
await settled();
|
||||
|
||||
assert.notOk(this.manager.picker);
|
||||
assert.notOk(this.manager.closing);
|
||||
assert.strictEqual(this.manager.picker, null);
|
||||
assert.false(this.manager.closing);
|
||||
assert.deepEqual(
|
||||
this.manager.visibleSections,
|
||||
["favorites", "smileys_&_emotion"],
|
||||
|
@ -25,29 +25,29 @@ acceptance("Discourse Chat | Unit | Service | chat-guardian", function (needs) {
|
||||
set(this.currentUser, "admin", false);
|
||||
set(this.currentUser, "moderator", 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, "admin", true);
|
||||
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, "admin", false);
|
||||
set(this.currentUser, "moderator", false);
|
||||
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, "admin", 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, "admin", false);
|
||||
set(this.currentUser, "moderator", false);
|
||||
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, "admin", true);
|
||||
@ -58,11 +58,11 @@ acceptance("Discourse Chat | Unit | Service | chat-guardian", function (needs) {
|
||||
test("#canUseChat", async function (assert) {
|
||||
set(this.currentUser, "has_chat_enabled", false);
|
||||
this.siteSettings.chat_enabled = true;
|
||||
assert.notOk(this.chatGuardian.canUseChat());
|
||||
assert.false(this.chatGuardian.canUseChat());
|
||||
|
||||
set(this.currentUser, "has_chat_enabled", true);
|
||||
this.siteSettings.chat_enabled = false;
|
||||
assert.notOk(this.chatGuardian.canUseChat());
|
||||
assert.false(this.chatGuardian.canUseChat());
|
||||
|
||||
set(this.currentUser, "has_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, "moderator", false);
|
||||
assert.notOk(this.chatGuardian.canArchiveChannel(channel));
|
||||
assert.false(this.chatGuardian.canArchiveChannel(channel));
|
||||
set(this.currentUser, "admin", true);
|
||||
set(this.currentUser, "moderator", true);
|
||||
|
||||
channel.status = "read_only";
|
||||
assert.notOk(this.chatGuardian.canArchiveChannel(channel));
|
||||
assert.false(this.chatGuardian.canArchiveChannel(channel));
|
||||
channel.status = "open";
|
||||
|
||||
channel.status = "archived";
|
||||
assert.notOk(this.chatGuardian.canArchiveChannel(channel));
|
||||
assert.false(this.chatGuardian.canArchiveChannel(channel));
|
||||
channel.status = "open";
|
||||
});
|
||||
});
|
||||
|
@ -22,7 +22,7 @@ module(
|
||||
});
|
||||
|
||||
test("isFullPagePreferred", function (assert) {
|
||||
assert.notOk(this.subject.isFullPagePreferred);
|
||||
assert.false(this.subject.isFullPagePreferred);
|
||||
|
||||
this.subject.prefersFullPage();
|
||||
|
||||
@ -30,7 +30,7 @@ module(
|
||||
|
||||
this.subject.prefersDrawer();
|
||||
|
||||
assert.notOk(this.subject.isFullPagePreferred);
|
||||
assert.false(this.subject.isFullPagePreferred);
|
||||
|
||||
this.subject.prefersDrawer();
|
||||
Site.currentProp("mobileView", true);
|
||||
@ -43,7 +43,7 @@ module(
|
||||
|
||||
this.subject.prefersFullPage();
|
||||
|
||||
assert.notOk(this.subject.isDrawerPreferred);
|
||||
assert.false(this.subject.isDrawerPreferred);
|
||||
|
||||
this.subject.prefersDrawer();
|
||||
|
||||
@ -73,7 +73,7 @@ module(
|
||||
|
||||
test("isFullPageActive", function (assert) {
|
||||
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");
|
||||
assert.ok(this.subject.isFullPageActive);
|
||||
|
@ -68,7 +68,7 @@ module("Chat | Unit | Utility | plugin-api", function (hooks) {
|
||||
updatedSecondaryActions.length < secondaryActions.length,
|
||||
"the updated secondary actions must contain less items than the original"
|
||||
);
|
||||
assert.notOk(
|
||||
assert.false(
|
||||
updatedSecondaryActions
|
||||
.map((v) => v.id)
|
||||
.includes(secondaryActions[0]),
|
||||
|
@ -108,9 +108,9 @@ module("lib:date-with-zone-helper", function () {
|
||||
timezone: PARIS,
|
||||
});
|
||||
|
||||
assert.notOk(date.isDST());
|
||||
assert.false(date.isDST());
|
||||
futureLocalDate = date.add(8, "months");
|
||||
assert.notOk(futureLocalDate.isDST());
|
||||
assert.false(futureLocalDate.isDST());
|
||||
assert.strictEqual(
|
||||
futureLocalDate.format(),
|
||||
"2020-11-19T15:36:00.000+01:00",
|
||||
@ -140,7 +140,7 @@ module("lib:date-with-zone-helper", function () {
|
||||
minute: 36,
|
||||
timezone: PARIS,
|
||||
});
|
||||
assert.notOk(date.isDST());
|
||||
assert.false(date.isDST());
|
||||
futureLocalDate = date.add(1, "week");
|
||||
assert.ok(futureLocalDate.isDST());
|
||||
assert.strictEqual(
|
||||
@ -159,7 +159,7 @@ module("lib:date-with-zone-helper", function () {
|
||||
|
||||
assert.ok(date.isDST());
|
||||
futureLocalDate = date.add(8, "months");
|
||||
assert.notOk(futureLocalDate.isDST());
|
||||
assert.false(futureLocalDate.isDST());
|
||||
assert.strictEqual(
|
||||
futureLocalDate.format(),
|
||||
"2020-12-01T15:36:00.000+01:00",
|
||||
|
Loading…
Reference in New Issue
Block a user