mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 22:43:33 +08:00
DEV: Fix no-loose-assertions lint (#29965)
and enable some of qunit lints
This commit is contained in:
@ -1,10 +1,6 @@
|
||||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
||||
acceptance("Local Dates - composer", function (needs) {
|
||||
@ -85,10 +81,9 @@ acceptance("Local Dates - composer", function (needs) {
|
||||
await timezoneChooser.expand();
|
||||
await timezoneChooser.selectRowByValue("Asia/Macau");
|
||||
|
||||
assert.ok(
|
||||
query(".preview .discourse-local-date").textContent.includes("Macau"),
|
||||
"it outputs a preview date in selected timezone"
|
||||
);
|
||||
assert
|
||||
.dom(".preview .discourse-local-date")
|
||||
.includesText("Macau", "outputs a preview date in selected timezone");
|
||||
});
|
||||
|
||||
test("date modal - controls", async function (assert) {
|
||||
@ -101,38 +96,31 @@ acceptance("Local Dates - composer", function (needs) {
|
||||
|
||||
await click('.pika-table td[data-day="5"] > .pika-button');
|
||||
|
||||
assert.ok(
|
||||
query("#from-date-time").textContent.includes("5,"),
|
||||
"selected FROM date works"
|
||||
);
|
||||
assert
|
||||
.dom("#from-date-time")
|
||||
.includesText("5,", "selected FROM date works");
|
||||
|
||||
await click(".date-time-control.to .date-time");
|
||||
|
||||
assert.strictEqual(
|
||||
queryAll(".pika-table .is-disabled").length,
|
||||
4,
|
||||
"date just before selected FROM date is disabled"
|
||||
);
|
||||
assert
|
||||
.dom(".pika-table .is-disabled")
|
||||
.exists({ count: 4 }, "date just before selected FROM date is disabled");
|
||||
|
||||
await click('.pika-table td[data-day="10"] > .pika-button');
|
||||
|
||||
assert.ok(
|
||||
query(".date-time-control.to button").textContent.includes("10,"),
|
||||
"selected TO date works"
|
||||
);
|
||||
assert
|
||||
.dom(".date-time-control.to button")
|
||||
.includesText("10,", "selected TO date works");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".pika-table .is-selected").textContent,
|
||||
"10",
|
||||
"selected date is the 10th"
|
||||
);
|
||||
assert
|
||||
.dom(".pika-table .is-selected")
|
||||
.hasText("10", "selected date is the 10th");
|
||||
|
||||
await click(".delete-to-date");
|
||||
|
||||
assert.notOk(
|
||||
query(".date-time-control.to.is-selected"),
|
||||
"deleting selected TO date works"
|
||||
);
|
||||
assert
|
||||
.dom(".date-time-control.to.is-selected")
|
||||
.doesNotExist("deleting selected TO date works");
|
||||
|
||||
await click(".advanced-mode-btn");
|
||||
|
||||
|
@ -124,9 +124,9 @@ module("lib:date-with-zone-helper", function () {
|
||||
minute: 36,
|
||||
timezone: PARIS,
|
||||
});
|
||||
assert.ok(date.isDST());
|
||||
assert.true(date.isDST());
|
||||
futureLocalDate = date.add(1, "year");
|
||||
assert.ok(futureLocalDate.isDST());
|
||||
assert.true(futureLocalDate.isDST());
|
||||
assert.strictEqual(
|
||||
futureLocalDate.format(),
|
||||
"2021-04-25T15:36:00.000+02:00",
|
||||
@ -142,7 +142,7 @@ module("lib:date-with-zone-helper", function () {
|
||||
});
|
||||
assert.false(date.isDST());
|
||||
futureLocalDate = date.add(1, "week");
|
||||
assert.ok(futureLocalDate.isDST());
|
||||
assert.true(futureLocalDate.isDST());
|
||||
assert.strictEqual(
|
||||
futureLocalDate.format(),
|
||||
"2020-04-01T15:36:00.000+02:00",
|
||||
@ -157,7 +157,7 @@ module("lib:date-with-zone-helper", function () {
|
||||
timezone: PARIS,
|
||||
});
|
||||
|
||||
assert.ok(date.isDST());
|
||||
assert.true(date.isDST());
|
||||
futureLocalDate = date.add(8, "months");
|
||||
assert.false(futureLocalDate.isDST());
|
||||
assert.strictEqual(
|
||||
|
Reference in New Issue
Block a user