DEV: apply new coding standards (#10592)
This commit is contained in:
@@ -10,10 +10,10 @@ acceptance("Topic", {
|
||||
server.put("/posts/398/wiki", () => {
|
||||
return helper.response({});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Reply as new topic", async assert => {
|
||||
QUnit.test("Reply as new topic", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("button.share:eq(0)");
|
||||
await click(".reply-as-new-topic a");
|
||||
@@ -21,22 +21,18 @@ QUnit.test("Reply as new topic", async assert => {
|
||||
assert.ok(exists(".d-editor-input"), "the composer input is visible");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.trim(),
|
||||
find(".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(
|
||||
selectKit(".category-chooser")
|
||||
.header()
|
||||
.value(),
|
||||
selectKit(".category-chooser").header().value(),
|
||||
"2",
|
||||
"it fills category selector with the right category"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Reply as new message", async assert => {
|
||||
QUnit.test("Reply as new message", async (assert) => {
|
||||
await visit("/t/pm-for-testing/12");
|
||||
await click("button.share:eq(0)");
|
||||
await click(".reply-as-new-topic a");
|
||||
@@ -44,9 +40,7 @@ QUnit.test("Reply as new message", async assert => {
|
||||
assert.ok(exists(".d-editor-input"), "the composer input is visible");
|
||||
|
||||
assert.equal(
|
||||
find(".d-editor-input")
|
||||
.val()
|
||||
.trim(),
|
||||
find(".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"
|
||||
);
|
||||
@@ -72,14 +66,14 @@ QUnit.test("Reply as new message", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Share Modal", async assert => {
|
||||
QUnit.test("Share Modal", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:first-child button.share");
|
||||
|
||||
assert.ok(exists("#share-link"), "it shows the share modal");
|
||||
});
|
||||
|
||||
QUnit.test("Showing and hiding the edit controls", async assert => {
|
||||
QUnit.test("Showing and hiding the edit controls", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
await click("#topic-title .d-icon-pencil-alt");
|
||||
@@ -95,7 +89,7 @@ QUnit.test("Showing and hiding the edit controls", async assert => {
|
||||
assert.ok(!exists("#edit-title"), "it hides the editing controls");
|
||||
});
|
||||
|
||||
QUnit.test("Updating the topic title and category", async assert => {
|
||||
QUnit.test("Updating the topic title and category", async (assert) => {
|
||||
const categoryChooser = selectKit(".title-wrapper .category-chooser");
|
||||
|
||||
await visit("/t/internationalization-localization/280");
|
||||
@@ -112,15 +106,13 @@ QUnit.test("Updating the topic title and category", async assert => {
|
||||
"it displays the new category"
|
||||
);
|
||||
assert.equal(
|
||||
find(".fancy-title")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".fancy-title").text().trim(),
|
||||
"this is the new title",
|
||||
"it displays the new title"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Marking a topic as wiki", async assert => {
|
||||
QUnit.test("Marking a topic as wiki", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(find("a.wiki").length === 0, "it does not show the wiki icon");
|
||||
@@ -132,13 +124,11 @@ QUnit.test("Marking a topic as wiki", async assert => {
|
||||
assert.ok(find("a.wiki").length === 1, "it shows the wiki icon");
|
||||
});
|
||||
|
||||
QUnit.test("Visit topic routes", async assert => {
|
||||
QUnit.test("Visit topic routes", async (assert) => {
|
||||
await visit("/t/12");
|
||||
|
||||
assert.equal(
|
||||
find(".fancy-title")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".fancy-title").text().trim(),
|
||||
"PM for testing",
|
||||
"it routes to the right topic"
|
||||
);
|
||||
@@ -146,15 +136,13 @@ QUnit.test("Visit topic routes", async assert => {
|
||||
await visit("/t/280/20");
|
||||
|
||||
assert.equal(
|
||||
find(".fancy-title")
|
||||
.text()
|
||||
.trim(),
|
||||
find(".fancy-title").text().trim(),
|
||||
"Internationalization / localization",
|
||||
"it routes to the right topic"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Updating the topic title with emojis", async assert => {
|
||||
QUnit.test("Updating the topic title with emojis", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-title .d-icon-pencil-alt");
|
||||
|
||||
@@ -163,15 +151,13 @@ QUnit.test("Updating the topic title with emojis", async assert => {
|
||||
await click("#topic-title .submit-edit");
|
||||
|
||||
assert.equal(
|
||||
find(".fancy-title")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".fancy-title").html().trim(),
|
||||
`emojis title <img src="/images/emoji/emoji_one/bike.png?v=${v}" title="bike" alt="bike" class="emoji"> <img src="/images/emoji/emoji_one/blonde_woman/6.png?v=${v}" title="blonde_woman:t6" alt="blonde_woman:t6" class="emoji">`,
|
||||
"it displays the new title with emojis"
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("Updating the topic title with unicode emojis", async assert => {
|
||||
QUnit.test("Updating the topic title with unicode emojis", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-title .d-icon-pencil-alt");
|
||||
|
||||
@@ -180,9 +166,7 @@ QUnit.test("Updating the topic title with unicode emojis", async assert => {
|
||||
await click("#topic-title .submit-edit");
|
||||
|
||||
assert.equal(
|
||||
find(".fancy-title")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".fancy-title").html().trim(),
|
||||
`emojis title <img src="/images/emoji/emoji_one/man_farmer.png?v=${v}" title="man_farmer" alt="man_farmer" class="emoji"><img src="/images/emoji/emoji_one/pray.png?v=${v}" title="pray" alt="pray" class="emoji">`,
|
||||
"it displays the new title with escaped unicode emojis"
|
||||
);
|
||||
@@ -190,7 +174,7 @@ QUnit.test("Updating the topic title with unicode emojis", async assert => {
|
||||
|
||||
QUnit.test(
|
||||
"Updating the topic title with unicode emojis without whitespaces",
|
||||
async function(assert) {
|
||||
async function (assert) {
|
||||
this.siteSettings.enable_inline_emoji_translation = true;
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click("#topic-title .d-icon-pencil-alt");
|
||||
@@ -200,27 +184,23 @@ QUnit.test(
|
||||
await click("#topic-title .submit-edit");
|
||||
|
||||
assert.equal(
|
||||
find(".fancy-title")
|
||||
.html()
|
||||
.trim(),
|
||||
find(".fancy-title").html().trim(),
|
||||
`Test<img src="/images/emoji/emoji_one/slightly_smiling_face.png?v=${v}" title="slightly_smiling_face" alt="slightly_smiling_face" class="emoji">Title`,
|
||||
"it displays the new title with escaped unicode emojis"
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
QUnit.test("Suggested topics", async assert => {
|
||||
QUnit.test("Suggested topics", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.equal(
|
||||
find("#suggested-topics .suggested-topics-title")
|
||||
.text()
|
||||
.trim(),
|
||||
find("#suggested-topics .suggested-topics-title").text().trim(),
|
||||
I18n.t("suggested_topics.title")
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.skip("Deleting a topic", async assert => {
|
||||
QUnit.skip("Deleting a topic", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".topic-post:eq(0) button.show-more-actions");
|
||||
await click(".widget-button.delete");
|
||||
@@ -228,7 +208,7 @@ QUnit.skip("Deleting a topic", async assert => {
|
||||
assert.ok(exists(".widget-button.recover"), "it shows the recover button");
|
||||
});
|
||||
|
||||
QUnit.test("Group category moderator posts", async assert => {
|
||||
QUnit.test("Group category moderator posts", async (assert) => {
|
||||
await visit("/t/topic-for-group-moderators/2480");
|
||||
|
||||
assert.ok(exists(".category-moderator"), "it has a class applied");
|
||||
@@ -239,11 +219,11 @@ acceptance("Topic featured links", {
|
||||
loggedIn: true,
|
||||
settings: {
|
||||
topic_featured_link_enabled: true,
|
||||
max_topic_title_length: 80
|
||||
}
|
||||
max_topic_title_length: 80,
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.skip("remove featured link", async assert => {
|
||||
QUnit.skip("remove featured link", async (assert) => {
|
||||
await visit("/t/-/299/1");
|
||||
assert.ok(
|
||||
exists(".title-wrapper .topic-featured-link"),
|
||||
@@ -261,7 +241,7 @@ QUnit.skip("remove featured link", async assert => {
|
||||
assert.ok(!exists(".title-wrapper .topic-featured-link"), "link is gone");
|
||||
});
|
||||
|
||||
QUnit.test("Converting to a public topic", async assert => {
|
||||
QUnit.test("Converting to a public topic", async (assert) => {
|
||||
await visit("/t/test-pm/34");
|
||||
assert.ok(exists(".private_message"));
|
||||
await click(".toggle-admin-menu");
|
||||
@@ -275,7 +255,7 @@ QUnit.test("Converting to a public topic", async assert => {
|
||||
assert.ok(!exists(".private_message"));
|
||||
});
|
||||
|
||||
QUnit.test("Unpinning unlisted topic", async assert => {
|
||||
QUnit.test("Unpinning unlisted topic", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
await click(".toggle-admin-menu");
|
||||
@@ -289,7 +269,7 @@ QUnit.test("Unpinning unlisted topic", async assert => {
|
||||
assert.ok(exists(".topic-admin-pin"), "it should show the multi select menu");
|
||||
});
|
||||
|
||||
QUnit.test("selecting posts", async assert => {
|
||||
QUnit.test("selecting posts", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".toggle-admin-menu");
|
||||
await click(".topic-admin-multi-select .btn");
|
||||
@@ -305,7 +285,7 @@ QUnit.test("selecting posts", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("select below", async assert => {
|
||||
QUnit.test("select below", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".toggle-admin-menu");
|
||||
await click(".topic-admin-multi-select .btn");
|
||||
@@ -328,7 +308,7 @@ QUnit.test("select below", async assert => {
|
||||
);
|
||||
});
|
||||
|
||||
QUnit.test("View Hidden Replies", async assert => {
|
||||
QUnit.test("View Hidden Replies", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
await click(".gap");
|
||||
|
||||
@@ -345,7 +325,7 @@ function selectText(selector) {
|
||||
selection.addRange(range);
|
||||
}
|
||||
|
||||
QUnit.test("Quoting a quote keeps the original poster name", async assert => {
|
||||
QUnit.test("Quoting a quote keeps the original poster name", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
selectText("#post_5 blockquote");
|
||||
await click(".quote-button .insert-quote");
|
||||
@@ -359,7 +339,7 @@ QUnit.test("Quoting a quote keeps the original poster name", async assert => {
|
||||
|
||||
QUnit.test(
|
||||
"Quoting a quote with the Reply button keeps the original poster name",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
selectText("#post_5 blockquote");
|
||||
await click(".reply");
|
||||
@@ -374,7 +354,7 @@ QUnit.test(
|
||||
|
||||
QUnit.test(
|
||||
"Quoting a quote with replyAsNewTopic keeps the original poster name",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
selectText("#post_5 blockquote");
|
||||
await keyEvent(document, "keypress", "j".charCodeAt(0));
|
||||
@@ -390,7 +370,7 @@ QUnit.test(
|
||||
|
||||
QUnit.test(
|
||||
"Quoting by selecting text can mark the quote as full",
|
||||
async assert => {
|
||||
async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
selectText("#post_5 .cooked");
|
||||
await click(".quote-button .insert-quote");
|
||||
@@ -406,15 +386,15 @@ QUnit.test(
|
||||
acceptance("Topic with title decorated", {
|
||||
loggedIn: true,
|
||||
beforeEach() {
|
||||
withPluginApi("0.8.40", api => {
|
||||
withPluginApi("0.8.40", (api) => {
|
||||
api.decorateTopicTitle((topic, node, topicTitleType) => {
|
||||
node.innerText = `${node.innerText}-${topic.id}-${topicTitleType}`;
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
QUnit.test("Decorate topic title", async assert => {
|
||||
QUnit.test("Decorate topic title", async (assert) => {
|
||||
await visit("/t/internationalization-localization/280");
|
||||
|
||||
assert.ok(
|
||||
|
||||
Reference in New Issue
Block a user