DEV: Use qunit-dom's `hasValue` wherever possible
This commit is contained in:
parent
41e025f050
commit
acc8c2a161
|
@ -1,6 +1,6 @@
|
|||
import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
acceptance("Admin - Themes - Install modal", function (needs) {
|
||||
|
@ -20,11 +20,7 @@ acceptance("Admin - Themes - Install modal", function (needs) {
|
|||
await click(".install-theme-content .inputs .advanced-repo");
|
||||
await fillIn(branchInput, "tests-passed");
|
||||
assert.dom(urlInput).hasValue(themeUrl, "url input is filled");
|
||||
assert.strictEqual(
|
||||
query(branchInput).value,
|
||||
"tests-passed",
|
||||
"branch input is filled"
|
||||
);
|
||||
assert.dom(branchInput).hasValue("tests-passed", "branch input is filled");
|
||||
assert.dom(publicKey).exists("shows public key");
|
||||
|
||||
await click(".d-modal__footer .d-modal-cancel");
|
||||
|
|
|
@ -4,7 +4,6 @@ import {
|
|||
acceptance,
|
||||
fakeTime,
|
||||
loggedInUser,
|
||||
query,
|
||||
queryAll,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
@ -56,10 +55,7 @@ acceptance("Admin - Suspend User", function (needs) {
|
|||
|
||||
await click(".dialog-footer .btn-default");
|
||||
assert.dom(".suspend-user-modal").exists();
|
||||
assert.strictEqual(
|
||||
query(".suspend-message").value,
|
||||
"this is an email reason why"
|
||||
);
|
||||
assert.dom(".suspend-message").hasValue("this is an email reason why");
|
||||
|
||||
await click(".d-modal-cancel");
|
||||
assert.dom(".dialog-body").exists();
|
||||
|
|
|
@ -67,30 +67,22 @@ acceptance("Composer - editor mentions", function (needs) {
|
|||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
||||
const editor = query(".d-editor-input");
|
||||
await simulateKeys(query(".d-editor-input"), "abc @u\r");
|
||||
|
||||
await simulateKeys(editor, "abc @u\r");
|
||||
|
||||
assert.strictEqual(
|
||||
editor.value,
|
||||
"abc @user ",
|
||||
"should replace mention correctly"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue("abc @user ", "replaces mention correctly");
|
||||
});
|
||||
|
||||
test("selecting user mentions after deleting characters", async function (assert) {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
|
||||
const editor = query(".d-editor-input");
|
||||
await simulateKeys(query(".d-editor-input"), "abc @user a\b\b\r");
|
||||
|
||||
await simulateKeys(editor, "abc @user a\b\b\r");
|
||||
|
||||
assert.strictEqual(
|
||||
editor.value,
|
||||
"abc @user ",
|
||||
"should replace mention correctly"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue("abc @user ", "replaces mention correctly");
|
||||
});
|
||||
|
||||
test("selecting user mentions after deleting characters mid sentence", async function (assert) {
|
||||
|
@ -103,11 +95,9 @@ acceptance("Composer - editor mentions", function (needs) {
|
|||
await setCaretPosition(editor, 9);
|
||||
await simulateKeys(editor, "\b\b\r");
|
||||
|
||||
assert.strictEqual(
|
||||
editor.value,
|
||||
"abc @user 123",
|
||||
"should replace mention correctly"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue("abc @user 123", "replaces mention correctly");
|
||||
});
|
||||
|
||||
test("shows status on search results when mentioning a user", async function (assert) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Composer - Image Grid", function (needs) {
|
||||
needs.user();
|
||||
|
@ -30,21 +30,20 @@ acceptance("Composer - Image Grid", function (needs) {
|
|||
".button-wrapper[data-image-index='0'] .wrap-image-grid-button"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`[grid]\n${uploads.join("\n")}\n[/grid]`,
|
||||
"Image grid toggles on"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`[grid]\n${uploads.join("\n")}\n[/grid]`,
|
||||
"Image grid toggles on"
|
||||
);
|
||||
|
||||
await click(
|
||||
".button-wrapper[data-image-index='0'] .wrap-image-grid-button"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
uploads.join("\n"),
|
||||
"Image grid toggles off"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(uploads.join("\n"), "Image grid toggles off");
|
||||
|
||||
const multipleImages = `![zorro|10x10](upload://zorro.png) ![z2|20x20](upload://zorrito.png)\nand a second group of images\n\n${uploads.join(
|
||||
"\n"
|
||||
|
@ -53,8 +52,7 @@ acceptance("Composer - Image Grid", function (needs) {
|
|||
|
||||
await click(".image-wrapper:first-child .wrap-image-grid-button");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
assert.dom(".d-editor-input").hasValue(
|
||||
`[grid]![zorro|10x10](upload://zorro.png) ![z2|20x20](upload://zorrito.png)[/grid]
|
||||
and a second group of images
|
||||
|
||||
|
@ -66,11 +64,9 @@ and a second group of images
|
|||
|
||||
await click(".image-wrapper:nth-of-type(1) .wrap-image-grid-button");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
multipleImages,
|
||||
"First image grid toggles off"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(multipleImages, "First image grid toggles off");
|
||||
|
||||
// Second group of images is in paragraph 2
|
||||
assert
|
||||
|
@ -83,8 +79,7 @@ and a second group of images
|
|||
|
||||
await click(".d-editor-preview p:nth-child(2) .wrap-image-grid-button");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
assert.dom(".d-editor-input").hasValue(
|
||||
`![zorro|10x10](upload://zorro.png) ![z2|20x20](upload://zorrito.png)
|
||||
and a second group of images
|
||||
|
||||
|
|
|
@ -26,11 +26,9 @@ acceptance("Composer - Image Preview", function (needs) {
|
|||
});
|
||||
|
||||
const assertImageResized = (assert, uploads) => {
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
uploads.join("\n"),
|
||||
"it resizes uploaded image"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(uploads.join("\n"), "resizes uploaded image");
|
||||
};
|
||||
|
||||
test("Image resizing buttons", async function (assert) {
|
||||
|
@ -337,11 +335,9 @@ acceptance("Composer - Image Preview", function (needs) {
|
|||
//click on the remove button of the first image
|
||||
await click(".button-wrapper[data-image-index='0'] .delete-image-button");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
uploads.join("\n"),
|
||||
"Image should be removed from the editor"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(uploads.join("\n"), "Image should be removed from the editor");
|
||||
|
||||
assert.false(
|
||||
query(".d-editor-input").value.includes("image_example_0"),
|
||||
|
@ -395,10 +391,11 @@ acceptance("Composer - Image Preview - Plugin API", function (needs) {
|
|||
|
||||
await click(".custom-button-class");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"custom button change",
|
||||
"The custom button changes the editor input"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"custom button change",
|
||||
"The custom button changes the editor input"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -212,11 +212,12 @@ acceptance("Composer", function (needs) {
|
|||
await triggerKeyEvent(textarea, "keydown", "B", metaModifier);
|
||||
|
||||
const example = i18n(`composer.bold_text`);
|
||||
assert.strictEqual(
|
||||
query("#reply-control .d-editor-input").value.trim(),
|
||||
`this is the *content* of a post**${example}**`,
|
||||
"supports keyboard shortcuts"
|
||||
);
|
||||
assert
|
||||
.dom("#reply-control .d-editor-input")
|
||||
.hasValue(
|
||||
`this is the *content* of a post**${example}**`,
|
||||
"supports keyboard shortcuts"
|
||||
);
|
||||
|
||||
await click("#reply-control a.cancel");
|
||||
assert.dom(".d-modal").exists("pops up a confirmation dialog");
|
||||
|
@ -349,22 +350,24 @@ acceptance("Composer", function (needs) {
|
|||
|
||||
await click(".d-modal__footer button.keep-editing");
|
||||
assert.dom(".discard-draft-modal.modal").doesNotExist();
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"this is the content of my reply",
|
||||
"composer does not switch when using Keep Editing button"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"this is the content of my reply",
|
||||
"composer does not switch when using Keep Editing button"
|
||||
);
|
||||
|
||||
await click(".topic-post:nth-of-type(1) button.edit");
|
||||
assert.dom(".d-modal__footer button.save-draft").doesNotExist();
|
||||
await click(".d-modal__footer button.discard-draft");
|
||||
assert.dom(".discard-draft-modal.modal").doesNotExist();
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
query(".topic-post:nth-of-type(1) .cooked > p").innerText,
|
||||
"composer has contents of post to be edited"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
query(".topic-post:nth-of-type(1) .cooked > p").innerText,
|
||||
"composer has contents of post to be edited"
|
||||
);
|
||||
});
|
||||
|
||||
test("Can Keep Editing when replying on a different topic", async function (assert) {
|
||||
|
@ -380,11 +383,12 @@ acceptance("Composer", function (needs) {
|
|||
await click(".d-modal__footer button.keep-editing");
|
||||
assert.dom(".discard-draft-modal.modal").doesNotExist();
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"this is the content of my reply",
|
||||
"composer does not switch when using Keep Editing button"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"this is the content of my reply",
|
||||
"composer does not switch when using Keep Editing button"
|
||||
);
|
||||
});
|
||||
|
||||
test("Posting on a different topic", async function (assert) {
|
||||
|
@ -434,11 +438,9 @@ acceptance("Composer", function (needs) {
|
|||
|
||||
await click(".d-modal__footer button.discard-draft");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"",
|
||||
"discards draft and reset composer textarea"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasNoValue("discards draft and reset composer textarea");
|
||||
});
|
||||
|
||||
test("Create an enqueued Reply", async function (assert) {
|
||||
|
@ -486,10 +488,12 @@ 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.true(
|
||||
query(".d-editor-input").value.startsWith("Any plans to support"),
|
||||
"populates the input with the post text"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
/^Any plans to support/,
|
||||
"populates the input with the post text"
|
||||
);
|
||||
|
||||
await fillIn(".d-editor-input", "This is the new text for the post");
|
||||
await fillIn("#reply-title", "This is the new text for the title");
|
||||
|
@ -538,15 +542,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.true(
|
||||
query(".d-editor-input").value.startsWith("This is the first post."),
|
||||
"populates the input with the post text"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
/^This is the first post\./,
|
||||
"populates the input with the post text"
|
||||
);
|
||||
await click(".topic-post:nth-of-type(2) button.edit");
|
||||
assert.true(
|
||||
query(".d-editor-input").value.startsWith("This is the second post."),
|
||||
"populates the input with the post text"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
/^This is the second post\./,
|
||||
"populates the input with the post text"
|
||||
);
|
||||
});
|
||||
|
||||
test("Composer with dirty edit can toggle to another edit", async function (assert) {
|
||||
|
@ -560,27 +568,33 @@ acceptance("Composer", function (needs) {
|
|||
.exists("pops up a confirmation dialog");
|
||||
|
||||
await click(".d-modal__footer button.discard-draft");
|
||||
assert.true(
|
||||
query(".d-editor-input").value.startsWith("This is the second post."),
|
||||
"populates the input with the post text"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
/^This is the second post\./,
|
||||
"populates the input with the post text"
|
||||
);
|
||||
});
|
||||
|
||||
test("Composer can toggle between edit and reply", async function (assert) {
|
||||
await visit("/t/this-is-a-test-topic/9");
|
||||
|
||||
await click(".topic-post:nth-of-type(1) button.edit");
|
||||
assert.true(
|
||||
query(".d-editor-input").value.startsWith("This is the first post."),
|
||||
"populates the input with the post text"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
/^This is the first post\./,
|
||||
"populates the input with the post text"
|
||||
);
|
||||
await click(".topic-post:nth-of-type(1) button.reply");
|
||||
assert.strictEqual(query(".d-editor-input").value, "", "clears the input");
|
||||
assert.dom(".d-editor-input").hasNoValue("clears the input");
|
||||
await click(".topic-post:nth-of-type(1) button.edit");
|
||||
assert.true(
|
||||
query(".d-editor-input").value.startsWith("This is the first post."),
|
||||
"populates the input with the post text"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
/^This is the first post\./,
|
||||
"populates the input with the post text"
|
||||
);
|
||||
});
|
||||
|
||||
test("Composer can toggle whispers when whisperer user", async function (assert) {
|
||||
|
@ -756,10 +770,12 @@ acceptance("Composer", function (needs) {
|
|||
"has keep editing button"
|
||||
);
|
||||
await click(".d-modal__footer button.discard-draft");
|
||||
assert.true(
|
||||
query(".d-editor-input").value.startsWith("This is the second post."),
|
||||
"populates the input with the post text"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
/^This is the second post\./,
|
||||
"populates the input with the post text"
|
||||
);
|
||||
});
|
||||
|
||||
test("Composer draft can switch to draft in new context without destroying current draft", async function (assert) {
|
||||
|
@ -787,11 +803,7 @@ acceptance("Composer", function (needs) {
|
|||
"has keep editing button"
|
||||
);
|
||||
await click(".d-modal__footer button.save-draft");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"",
|
||||
"clears the composer input"
|
||||
);
|
||||
assert.dom(".d-editor-input").hasNoValue("clears the composer input");
|
||||
});
|
||||
|
||||
test("Checks for existing draft", async function (assert) {
|
||||
|
@ -1129,10 +1141,7 @@ acceptance("Composer - Focus Open and Closed", function (needs) {
|
|||
|
||||
await settled();
|
||||
assert.dom(".d-editor-input").isFocused("composer is open and focused");
|
||||
assert.strictEqual(
|
||||
query("textarea.d-editor-input").value.trim(),
|
||||
"this is appended"
|
||||
);
|
||||
assert.dom("textarea.d-editor-input").hasValue("this is appended");
|
||||
});
|
||||
|
||||
test("Focusing a composer which is already open", async function (assert) {
|
||||
|
@ -1155,10 +1164,9 @@ acceptance("Composer - Focus Open and Closed", function (needs) {
|
|||
|
||||
await settled();
|
||||
assert.dom(".d-editor-input").isFocused("composer is open and focused");
|
||||
assert.strictEqual(
|
||||
query("textarea.d-editor-input").value.trim(),
|
||||
"this is some appended text"
|
||||
);
|
||||
assert
|
||||
.dom("textarea.d-editor-input")
|
||||
.hasValue("this is some appended text");
|
||||
});
|
||||
|
||||
test("Focusing a composer which is not open that has a draft", async function (assert) {
|
||||
|
@ -1173,10 +1181,9 @@ acceptance("Composer - Focus Open and Closed", function (needs) {
|
|||
|
||||
await settled();
|
||||
assert.dom(".d-editor-input").isFocused("composer is open and focused");
|
||||
assert.strictEqual(
|
||||
query("textarea.d-editor-input").value.trim(),
|
||||
"This is a dirty reply\n\nthis is some appended text"
|
||||
);
|
||||
assert
|
||||
.dom("textarea.d-editor-input")
|
||||
.hasValue("This is a dirty reply\n\nthis is some appended text");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -1350,7 +1357,9 @@ acceptance("composer buttons API", function (needs) {
|
|||
Object.assign({ altKey: true }, metaModifier)
|
||||
);
|
||||
|
||||
assert.strictEqual(editor.value, "hello **the** world", "adds the bold");
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue("hello **the** world", "adds the bold");
|
||||
|
||||
const dropdown = selectKit(".toolbar-popup-menu-options");
|
||||
await dropdown.expand();
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Composer topic featured links", function (needs) {
|
||||
needs.user();
|
||||
|
@ -20,11 +20,9 @@ acceptance("Composer topic featured links", function (needs) {
|
|||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.good")
|
||||
.exists("the body is now good");
|
||||
assert.strictEqual(
|
||||
query(".title-input input").value,
|
||||
"An interesting article",
|
||||
"title is from the oneboxed article"
|
||||
);
|
||||
assert
|
||||
.dom(".title-input input")
|
||||
.hasValue("An interesting article", "title is from the oneboxed article");
|
||||
});
|
||||
|
||||
test("onebox result doesn't include a title", async function (assert) {
|
||||
|
@ -37,22 +35,21 @@ acceptance("Composer topic featured links", function (needs) {
|
|||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.good")
|
||||
.exists("the body is now good");
|
||||
assert.strictEqual(
|
||||
query(".title-input input").value,
|
||||
"http://www.example.com/no-title.html",
|
||||
"title is unchanged"
|
||||
);
|
||||
assert
|
||||
.dom(".title-input input")
|
||||
.hasValue("http://www.example.com/no-title.html", "title is unchanged");
|
||||
});
|
||||
|
||||
test("YouTube onebox with title", async function (assert) {
|
||||
await visit("/");
|
||||
await click("#create-topic");
|
||||
await fillIn("#reply-title", "https://www.youtube.com/watch?v=dQw4w9WgXcQ");
|
||||
assert.strictEqual(
|
||||
query(".title-input input").value,
|
||||
"Rick Astley - Never Gonna Give You Up (Video)",
|
||||
"title is from the oneboxed article"
|
||||
);
|
||||
assert
|
||||
.dom(".title-input input")
|
||||
.hasValue(
|
||||
"Rick Astley - Never Gonna Give You Up (Video)",
|
||||
"title is from the oneboxed article"
|
||||
);
|
||||
});
|
||||
|
||||
test("no onebox result", async function (assert) {
|
||||
|
@ -65,11 +62,12 @@ acceptance("Composer topic featured links", function (needs) {
|
|||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.good")
|
||||
.exists("link is pasted into body");
|
||||
assert.strictEqual(
|
||||
query(".title-input input").value,
|
||||
"http://www.example.com/nope-onebox.html",
|
||||
"title is unchanged"
|
||||
);
|
||||
assert
|
||||
.dom(".title-input input")
|
||||
.hasValue(
|
||||
"http://www.example.com/nope-onebox.html",
|
||||
"title is unchanged"
|
||||
);
|
||||
});
|
||||
|
||||
test("ignore internal links", async function (assert) {
|
||||
|
@ -80,16 +78,8 @@ acceptance("Composer topic featured links", function (needs) {
|
|||
assert
|
||||
.dom(".d-editor-preview")
|
||||
.doesNotIncludeHtml("onebox", "onebox preview doesn't show");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.length,
|
||||
0,
|
||||
"link isn't put into the post"
|
||||
);
|
||||
assert.strictEqual(
|
||||
query(".title-input input").value,
|
||||
title,
|
||||
"title is unchanged"
|
||||
);
|
||||
assert.dom(".d-editor-input").hasNoValue("link isn't put into the post");
|
||||
assert.dom(".title-input input").hasValue(title, "title is unchanged");
|
||||
});
|
||||
|
||||
test("link is longer than max title length", async function (assert) {
|
||||
|
@ -105,11 +95,9 @@ acceptance("Composer topic featured links", function (needs) {
|
|||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.good")
|
||||
.exists("the body is now good");
|
||||
assert.strictEqual(
|
||||
query(".title-input input").value,
|
||||
"An interesting article",
|
||||
"title is from the oneboxed article"
|
||||
);
|
||||
assert
|
||||
.dom(".title-input input")
|
||||
.hasValue("An interesting article", "title is from the oneboxed article");
|
||||
});
|
||||
|
||||
test("onebox with title but extra words in title field", async function (assert) {
|
||||
|
@ -119,16 +107,13 @@ acceptance("Composer topic featured links", function (needs) {
|
|||
assert
|
||||
.dom(".d-editor-preview")
|
||||
.doesNotIncludeHtml("onebox", "onebox preview doesn't show");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.length,
|
||||
0,
|
||||
"link isn't put into the post"
|
||||
);
|
||||
assert.strictEqual(
|
||||
query(".title-input input").value,
|
||||
"http://www.example.com/has-title.html test",
|
||||
"title is unchanged"
|
||||
);
|
||||
assert.dom(".d-editor-input").hasNoValue("link isn't put into the post");
|
||||
assert
|
||||
.dom(".title-input input")
|
||||
.hasValue(
|
||||
"http://www.example.com/has-title.html test",
|
||||
"title is unchanged"
|
||||
);
|
||||
});
|
||||
|
||||
test("blank title for Twitter link", async function (assert) {
|
||||
|
@ -144,7 +129,7 @@ acceptance("Composer topic featured links", function (needs) {
|
|||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.good")
|
||||
.exists("the body is now good");
|
||||
assert.blank(query(".title-input input").value, "title is blank");
|
||||
assert.dom(".title-input input").hasNoValue("title is blank");
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -175,11 +160,12 @@ acceptance(
|
|||
assert
|
||||
.dom(".d-editor-textarea-wrapper .popup-tip.good")
|
||||
.exists("the body is now good");
|
||||
assert.strictEqual(
|
||||
query(".title-input input").value,
|
||||
"An interesting article",
|
||||
"title is from the oneboxed article"
|
||||
);
|
||||
assert
|
||||
.dom(".title-input input")
|
||||
.hasValue(
|
||||
"An interesting article",
|
||||
"title is from the oneboxed article"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-textarea-wrapper.disabled")
|
||||
.doesNotExist("textarea is enabled");
|
||||
|
|
|
@ -97,18 +97,18 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
|
|||
|
||||
appEvents.on("composer:all-uploads-complete", async () => {
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
appEvents.on("composer:upload-started", () => {
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n[Uploading: avatar.png…]()\n"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue("The image:\n[Uploading: avatar.png…]()\n");
|
||||
});
|
||||
|
||||
const image = createFile("avatar.png");
|
||||
|
@ -128,10 +128,11 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
|
|||
|
||||
appEvents.on("composer:all-uploads-complete", async () => {
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n![avatar2.PNG|690x320](upload://sdfljsdfgjlkwg4328.jpeg)\n"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n![avatar2.PNG|690x320](upload://sdfljsdfgjlkwg4328.jpeg)\n"
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -166,18 +167,18 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
|
|||
|
||||
appEvents.on("composer:all-uploads-complete", async () => {
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
appEvents.on("composer:upload-started", () => {
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n[Uploading: avatar.png…]()\n"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue("The image:\n[Uploading: avatar.png…]()\n");
|
||||
});
|
||||
|
||||
const image = createFile("avatar.png");
|
||||
|
@ -250,19 +251,18 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
|
|||
uploadStarted++;
|
||||
|
||||
if (uploadStarted === 2) {
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n[Uploading: avatar.png…]()\n[Uploading: avatar2.png…]()\n",
|
||||
"it should show the upload placeholders when the upload starts"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"The image:\n[Uploading: avatar.png…]()\n[Uploading: avatar2.png…]()\n",
|
||||
"it should show the upload placeholders when the upload starts"
|
||||
);
|
||||
}
|
||||
});
|
||||
appEvents.on("composer:uploads-cancelled", () => {
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n",
|
||||
"it should clear the cancelled placeholders"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue("The image:\n", "it should clear the cancelled placeholders");
|
||||
});
|
||||
|
||||
await new Promise(function (resolve) {
|
||||
|
@ -282,18 +282,18 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
|
|||
const done = assert.async();
|
||||
|
||||
appEvents.on("composer:upload-started", () => {
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n[Uploading: avatar.png…]()\n"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue("The image:\n[Uploading: avatar.png…]()\n");
|
||||
});
|
||||
|
||||
appEvents.on("composer:all-uploads-complete", async () => {
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -313,18 +313,20 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
|
|||
const done = assert.async();
|
||||
|
||||
appEvents.on("composer:upload-started", () => {
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n[Uploading: avatar.png…]()\n Text after the image."
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"The image:\n[Uploading: avatar.png…]()\n Text after the image."
|
||||
);
|
||||
});
|
||||
|
||||
appEvents.on("composer:all-uploads-complete", async () => {
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n Text after the image."
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n Text after the image."
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -347,18 +349,20 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
|
|||
const done = assert.async();
|
||||
|
||||
appEvents.on("composer:upload-started", () => {
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n[Uploading: avatar.png…]()\n Text after the image."
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"The image:\n[Uploading: avatar.png…]()\n Text after the image."
|
||||
);
|
||||
});
|
||||
|
||||
appEvents.on("composer:all-uploads-complete", async () => {
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n Text after the image."
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n Text after the image."
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -373,18 +377,16 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
|
|||
const done = assert.async();
|
||||
|
||||
appEvents.on("composer:upload-started", () => {
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"[Uploading: avatar.png…]()\n"
|
||||
);
|
||||
assert.dom(".d-editor-input").hasValue("[Uploading: avatar.png…]()\n");
|
||||
});
|
||||
|
||||
appEvents.on("composer:all-uploads-complete", async () => {
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -400,18 +402,18 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
|
|||
const done = assert.async();
|
||||
|
||||
appEvents.on("composer:upload-started", () => {
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n[Uploading: avatar.png…]()\n"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue("The image:\n[Uploading: avatar.png…]()\n");
|
||||
});
|
||||
|
||||
appEvents.on("composer:all-uploads-complete", async () => {
|
||||
await settled();
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"The image:\n![avatar.PNG|690x320](upload://yoj8pf9DdIeHRRULyw7i57GAYdz.jpeg)\n"
|
||||
);
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -464,11 +466,12 @@ acceptance("Uppy Composer Attachment - Upload Placeholder", function (needs) {
|
|||
});
|
||||
await settled();
|
||||
|
||||
assert.strictEqual(
|
||||
inputElement.value,
|
||||
"||a|b|\n|---|---|---|\n|1|2|3|\n",
|
||||
"only the plain text table is pasted"
|
||||
);
|
||||
assert
|
||||
.dom(inputElement)
|
||||
.hasValue(
|
||||
"||a|b|\n|---|---|---|\n|1|2|3|\n",
|
||||
"only the plain text table is pasted"
|
||||
);
|
||||
assert.false(uppyEventFired, "uppy does not start uploading the file");
|
||||
done();
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { click, fillIn, triggerKeyEvent, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("EmojiPicker", function (needs) {
|
||||
needs.user();
|
||||
|
@ -39,11 +39,12 @@ acceptance("EmojiPicker", function (needs) {
|
|||
await click("button.emoji.btn");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
":grinning:",
|
||||
"it adds the emoji code in the editor when selected"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
":grinning:",
|
||||
"adds the emoji code in the editor when selected"
|
||||
);
|
||||
});
|
||||
|
||||
test("emoji picker adds leading whitespace before emoji", async function (assert) {
|
||||
|
@ -54,21 +55,23 @@ 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.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"This is a test input :grinning:",
|
||||
"it adds the emoji code and a leading whitespace when there is text"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"This is a test input :grinning:",
|
||||
"adds the emoji code and a leading whitespace when there is text"
|
||||
);
|
||||
|
||||
// Whitespace should not be added on whitespace
|
||||
await fillIn(".d-editor-input", "This is a test input ");
|
||||
await click(".emoji-picker-emoji-area img.emoji[title='grinning']");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
"This is a test input :grinning:",
|
||||
"it adds the emoji code and no leading whitespace when user already entered whitespace"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
"This is a test input :grinning:",
|
||||
"adds the emoji code and no leading whitespace when user already entered whitespace"
|
||||
);
|
||||
});
|
||||
|
||||
test("emoji picker has a list of recently used emojis", async function (assert) {
|
||||
|
@ -207,11 +210,12 @@ acceptance("EmojiPicker", function (needs) {
|
|||
|
||||
await triggerKeyEvent(document.activeElement, "keydown", "ArrowRight");
|
||||
await triggerKeyEvent(document.activeElement, "keydown", "Enter");
|
||||
assert.strictEqual(
|
||||
document.querySelector(".d-editor-input").value,
|
||||
":smiley:",
|
||||
"Pressing enter inserts the emoji markup in the composer"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
":smiley:",
|
||||
"Pressing enter inserts the emoji markup in the composer"
|
||||
);
|
||||
|
||||
await click("#topic-footer-buttons .btn.create");
|
||||
await click(".emoji.btn");
|
||||
|
|
|
@ -151,16 +151,12 @@ acceptance(
|
|||
);
|
||||
|
||||
await click("#prefill_imap_gmail");
|
||||
assert.strictEqual(
|
||||
query("input[name='imap_server']").value,
|
||||
"imap.gmail.com",
|
||||
"prefills IMAP server settings for gmail"
|
||||
);
|
||||
assert.strictEqual(
|
||||
query("input[name='imap_port']").value,
|
||||
"993",
|
||||
"prefills IMAP port settings for gmail"
|
||||
);
|
||||
assert
|
||||
.dom("input[name='imap_server']")
|
||||
.hasValue("imap.gmail.com", "prefills IMAP server settings for gmail");
|
||||
assert
|
||||
.dom("input[name='imap_port']")
|
||||
.hasValue("993", "prefills IMAP port settings for gmail");
|
||||
assert
|
||||
.dom("#enable_ssl_imap")
|
||||
.isChecked("prefills IMAP ssl settings for gmail");
|
||||
|
@ -292,16 +288,12 @@ acceptance(
|
|||
"SMTP ssl mode is prefilled"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query("[name='imap_server']").value,
|
||||
"imap.gmail.com",
|
||||
"imap server is prefilled"
|
||||
);
|
||||
assert.strictEqual(
|
||||
query("[name='imap_port']").value,
|
||||
"993",
|
||||
"imap port is prefilled"
|
||||
);
|
||||
assert
|
||||
.dom("[name='imap_server']")
|
||||
.hasValue("imap.gmail.com", "imap server is prefilled");
|
||||
assert
|
||||
.dom("[name='imap_port']")
|
||||
.hasValue("993", "imap port is prefilled");
|
||||
assert.strictEqual(
|
||||
selectKit("#imap_mailbox").header().value(),
|
||||
"INBOX",
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
|
@ -186,10 +186,9 @@ acceptance("Group - Authenticated", function (needs) {
|
|||
i18n("groups.membership_request.title", { group_name: "Macdonald" })
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
query(".request-group-membership-form textarea").value,
|
||||
"Please add me"
|
||||
);
|
||||
assert
|
||||
.dom(".request-group-membership-form textarea")
|
||||
.hasValue("Please add me");
|
||||
|
||||
await click(".d-modal__footer .btn-primary");
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
||||
acceptance("New Message - Anonymous", function () {
|
||||
|
@ -22,16 +22,12 @@ acceptance("New Message - Authenticated", function (needs) {
|
|||
);
|
||||
|
||||
assert.dom(".composer-fields").exists("opens the composer");
|
||||
assert.strictEqual(
|
||||
query("#reply-title").value.trim(),
|
||||
"message title",
|
||||
"it pre-fills message title"
|
||||
);
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
"message body",
|
||||
"it pre-fills message body"
|
||||
);
|
||||
assert
|
||||
.dom("#reply-title")
|
||||
.hasValue("message title", "pre-fills message title");
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue("message body", "pre-fills message body");
|
||||
|
||||
const privateMessageUsers = selectKit("#private-message-users");
|
||||
assert.strictEqual(
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { click, fillIn, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("Search - Mobile", function (needs) {
|
||||
needs.mobileView();
|
||||
|
@ -35,10 +35,11 @@ acceptance("Search - Mobile", function (needs) {
|
|||
|
||||
await click("#search-button");
|
||||
|
||||
assert.strictEqual(
|
||||
query("input.full-page-search").value,
|
||||
"discourse",
|
||||
"it does not reset input when hitting search icon again"
|
||||
);
|
||||
assert
|
||||
.dom("input.full-page-search")
|
||||
.hasValue(
|
||||
"discourse",
|
||||
"does not reset input when hitting search icon again"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -83,11 +83,12 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await click(document.activeElement);
|
||||
await click(".show-advanced-search");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".full-page-search").value,
|
||||
"dev",
|
||||
"goes to full search page and preserves the search term"
|
||||
);
|
||||
assert
|
||||
.dom(".full-page-search")
|
||||
.hasValue(
|
||||
"dev",
|
||||
"goes to full search page and preserves the search term"
|
||||
);
|
||||
|
||||
assert
|
||||
.dom(".search-menu .search-menu-panel")
|
||||
|
@ -247,11 +248,12 @@ acceptance("Search - Anonymous", function (needs) {
|
|||
await click(document.activeElement);
|
||||
await click(".show-advanced-search");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".full-page-search").value,
|
||||
"proper topic:280",
|
||||
"goes to full search page and preserves search term + context"
|
||||
);
|
||||
assert
|
||||
.dom(".full-page-search")
|
||||
.hasValue(
|
||||
"proper topic:280",
|
||||
"goes to full search page and preserves search term + context"
|
||||
);
|
||||
|
||||
assert
|
||||
.dom(".search-advanced-options")
|
||||
|
@ -621,10 +623,9 @@ acceptance("Search - Authenticated", function (needs) {
|
|||
await triggerKeyEvent(document.activeElement, "keyup", "ArrowDown");
|
||||
await triggerKeyEvent(document.activeElement, "keydown", 65); // maps to lowercase a
|
||||
|
||||
assert.true(
|
||||
query(".d-editor-input").value.includes("a link"),
|
||||
"still has the original composer content"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(/a link/, "still has the original composer content");
|
||||
|
||||
assert.true(
|
||||
query(".d-editor-input").value.includes(
|
||||
|
@ -1196,10 +1197,7 @@ acceptance("Search - assistant", function (needs) {
|
|||
|
||||
await click(`${firstCategory} .badge-category__name`);
|
||||
|
||||
assert.strictEqual(
|
||||
query("#search-term").value,
|
||||
`sam #${firstCategoryName}`
|
||||
);
|
||||
assert.dom("#search-term").hasValue(`sam #${firstCategoryName}`);
|
||||
});
|
||||
|
||||
test("topic results - soft loads the topic results after closing the search menu", async function (assert) {
|
||||
|
|
|
@ -2,7 +2,6 @@ import { click, currentURL, fillIn, visit } from "@ember/test-helpers";
|
|||
import { test } from "qunit";
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
queryAll,
|
||||
updateCurrentUser,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
|
@ -474,16 +473,15 @@ acceptance("Tag info", function (needs) {
|
|||
assert.dom(".tag-info .tag-name").exists("show tag");
|
||||
|
||||
await click(".edit-tag");
|
||||
assert.strictEqual(
|
||||
query("#edit-name").value,
|
||||
"happy-monkey",
|
||||
"displays original tag name"
|
||||
);
|
||||
assert.strictEqual(
|
||||
query("#edit-description").value,
|
||||
"happy monkey description",
|
||||
"displays original tag description"
|
||||
);
|
||||
assert
|
||||
.dom("#edit-name")
|
||||
.hasValue("happy-monkey", "displays original tag name");
|
||||
assert
|
||||
.dom("#edit-description")
|
||||
.hasValue(
|
||||
"happy monkey description",
|
||||
"displays original tag description"
|
||||
);
|
||||
|
||||
await fillIn("#edit-description", "new description");
|
||||
await click(".submit-edit");
|
||||
|
|
|
@ -56,11 +56,12 @@ acceptance("Topic - Quote button - logged in", function (needs) {
|
|||
await selectText("#post_3 aside.onebox p");
|
||||
await click(".insert-quote");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
'[quote="group_moderator, post:3, topic:2480"]\nhttps://example.com/57350945\n[/quote]',
|
||||
"quote only contains a link"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
'[quote="group_moderator, post:3, topic:2480"]\nhttps://example.com/57350945\n[/quote]\n\n',
|
||||
"quote only contains a link"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -145,9 +146,8 @@ acceptance("Topic - Quote button - keyboard shortcut", function (needs) {
|
|||
await triggerKeyEvent(document, "keypress", "Q");
|
||||
assert.dom(".d-editor-input").exists("the editor is open");
|
||||
|
||||
assert.true(
|
||||
query(".d-editor-input").value.includes("Any plans to support"),
|
||||
"editor includes selected text"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(/Any plans to support/, "editor includes selected text");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -48,11 +48,12 @@ acceptance("Topic", function (needs) {
|
|||
|
||||
assert.dom(".d-editor-input").exists("the composer input is visible");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
`Continuing the discussion from [Internationalization / localization](${window.location.origin}/t/internationalization-localization/280):`,
|
||||
"fills composer with the ring string"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`Continuing the discussion from [Internationalization / localization](${window.location.origin}/t/internationalization-localization/280):`,
|
||||
"fills composer with the ring string"
|
||||
);
|
||||
assert.strictEqual(
|
||||
selectKit(".category-chooser").header().value(),
|
||||
"2",
|
||||
|
@ -67,11 +68,12 @@ acceptance("Topic", function (needs) {
|
|||
|
||||
assert.dom(".d-editor-input").exists("the composer input is visible");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
`Continuing the discussion from [PM for testing](${window.location.origin}/t/pm-for-testing/12):`,
|
||||
"fills composer with the ring string"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`Continuing the discussion from [PM for testing](${window.location.origin}/t/pm-for-testing/12):`,
|
||||
"fills composer with the ring string"
|
||||
);
|
||||
|
||||
const privateMessageUsers = selectKit("#private-message-users");
|
||||
assert.strictEqual(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { click, visit } from "@ember/test-helpers";
|
||||
import { IMAGE_VERSION } from "pretty-text/emoji/version";
|
||||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
acceptance("User Drafts", function (needs) {
|
||||
needs.user();
|
||||
|
@ -30,10 +30,9 @@ acceptance("User Drafts", function (needs) {
|
|||
assert.dom(".user-stream-item").exists("has drafts");
|
||||
|
||||
await click(".user-stream-item .resume-draft");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
"A fun new topic for testing drafts."
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue("A fun new topic for testing drafts.");
|
||||
});
|
||||
|
||||
test("Stream - has excerpt", async function (assert) {
|
||||
|
|
|
@ -34,9 +34,9 @@ module("Integration | Component | date-time-input-range", function (hooks) {
|
|||
hbs`<DateTimeInputRange @from={{this.state.from}} @to={{this.state.to}} @onChange={{fn (mut this.state)}} />`
|
||||
);
|
||||
|
||||
assert.strictEqual(fromDateInput().value, "2019-01-29");
|
||||
assert.dom(fromDateInput()).hasValue("2019-01-29");
|
||||
assert.strictEqual(fromTimeInput().dataset.name, "14:45");
|
||||
assert.strictEqual(toDateInput().value, "");
|
||||
assert.dom(toDateInput()).hasNoValue();
|
||||
assert.strictEqual(toTimeInput().dataset.name, "--:--");
|
||||
|
||||
await fillIn(toDateInput(), "2019-01-29");
|
||||
|
@ -81,9 +81,9 @@ module("Integration | Component | date-time-input-range", function (hooks) {
|
|||
hbs`<DateTimeInputRange @from={{this.state.from}} @to={{this.state.to}} @onChange={{fn (mut this.state)}} @timezone="Europe/Paris" />`
|
||||
);
|
||||
|
||||
assert.strictEqual(fromDateInput().value, "2019-01-29");
|
||||
assert.dom(fromDateInput()).hasValue("2019-01-29");
|
||||
assert.strictEqual(fromTimeInput().dataset.name, "14:45");
|
||||
assert.strictEqual(toDateInput().value, "");
|
||||
assert.dom(toDateInput()).hasNoValue();
|
||||
assert.strictEqual(toTimeInput().dataset.name, "--:--");
|
||||
|
||||
await fillIn(toDateInput(), "2019-01-29");
|
||||
|
|
|
@ -26,7 +26,7 @@ module("Integration | Component | date-time-input", function (hooks) {
|
|||
|
||||
await render(hbs`<DateTimeInput @date={{this.date}} />`);
|
||||
|
||||
assert.strictEqual(dateInput().value, "2019-01-29");
|
||||
assert.dom(dateInput()).hasValue("2019-01-29");
|
||||
assert.strictEqual(timeInput().dataset.name, "14:45");
|
||||
});
|
||||
|
||||
|
|
|
@ -29,21 +29,15 @@ module(
|
|||
".form-template-field__dropdown option:not(.form-template-field__dropdown-placeholder)"
|
||||
);
|
||||
assert.strictEqual(dropdown.length, 3, "it has 3 choices");
|
||||
assert.strictEqual(
|
||||
dropdown[0].value,
|
||||
"Choice 1",
|
||||
"it has the correct name for choice 1"
|
||||
);
|
||||
assert.strictEqual(
|
||||
dropdown[1].value,
|
||||
"Choice 2",
|
||||
"it has the correct name for choice 2"
|
||||
);
|
||||
assert.strictEqual(
|
||||
dropdown[2].value,
|
||||
"Choice 3",
|
||||
"it has the correct name for choice 3"
|
||||
);
|
||||
assert
|
||||
.dom(dropdown[0])
|
||||
.hasValue("Choice 1", "has the correct name for choice 1");
|
||||
assert
|
||||
.dom(dropdown[1])
|
||||
.hasValue("Choice 2", "has the correct name for choice 2");
|
||||
assert
|
||||
.dom(dropdown[2])
|
||||
.hasValue("Choice 3", "has the correct name for choice 3");
|
||||
});
|
||||
|
||||
test("renders a dropdown with choices and attributes", async function (assert) {
|
||||
|
|
|
@ -30,21 +30,15 @@ module(
|
|||
".form-template-field__multi-select option:not(.form-template-field__multi-select-placeholder)"
|
||||
);
|
||||
assert.strictEqual(dropdown.length, 3, "it has 3 choices");
|
||||
assert.strictEqual(
|
||||
dropdown[0].value,
|
||||
"Choice 1",
|
||||
"it has the correct name for choice 1"
|
||||
);
|
||||
assert.strictEqual(
|
||||
dropdown[1].value,
|
||||
"Choice 2",
|
||||
"it has the correct name for choice 2"
|
||||
);
|
||||
assert.strictEqual(
|
||||
dropdown[2].value,
|
||||
"Choice 3",
|
||||
"it has the correct name for choice 3"
|
||||
);
|
||||
assert
|
||||
.dom(dropdown[0])
|
||||
.hasValue("Choice 1", "has the correct name for choice 1");
|
||||
assert
|
||||
.dom(dropdown[1])
|
||||
.hasValue("Choice 2", "has the correct name for choice 2");
|
||||
assert
|
||||
.dom(dropdown[2])
|
||||
.hasValue("Choice 3", "has the correct name for choice 3");
|
||||
});
|
||||
|
||||
test("renders a multi-select with choices and attributes", async function (assert) {
|
||||
|
|
|
@ -4,7 +4,6 @@ import { hbs } from "ember-cli-htmlbars";
|
|||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import pretender, { response } from "discourse/tests/helpers/create-pretender";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
||||
module("Integration | Component | invite-panel", function (hooks) {
|
||||
|
@ -34,9 +33,8 @@ module("Integration | Component | invite-panel", function (hooks) {
|
|||
assert.dom(".send-invite").isEnabled();
|
||||
|
||||
await click(".generate-invite-link");
|
||||
assert.strictEqual(
|
||||
query(".invite-link-input").value,
|
||||
"http://example.com/invites/92c297e886a0ca03089a109ccd6be155"
|
||||
);
|
||||
assert
|
||||
.dom(".invite-link-input")
|
||||
.hasValue("http://example.com/invites/92c297e886a0ca03089a109ccd6be155");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,6 @@ import { blur, click, 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 { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
module("Integration | Component | secret-value-list", function (hooks) {
|
||||
|
@ -108,10 +107,9 @@ module("Integration | Component | secret-value-list", function (hooks) {
|
|||
);
|
||||
await blur(".values .value[data-index='1'] .value-input:first-of-type");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".values .value[data-index='1'] .value-input:first-of-type").value,
|
||||
"changedKey"
|
||||
);
|
||||
assert
|
||||
.dom(".values .value[data-index='1'] .value-input:first-of-type")
|
||||
.hasValue("changedKey");
|
||||
|
||||
await fillIn(
|
||||
".values .value[data-index='1'] .value-input:last-of-type",
|
||||
|
@ -119,10 +117,9 @@ module("Integration | Component | secret-value-list", function (hooks) {
|
|||
);
|
||||
await blur(".values .value[data-index='1'] .value-input:last-of-type");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".values .value[data-index='1'] .value-input:last-of-type").value,
|
||||
"changedValue"
|
||||
);
|
||||
assert
|
||||
.dom(".values .value[data-index='1'] .value-input:last-of-type")
|
||||
.hasValue("changedValue");
|
||||
assert.deepEqual(
|
||||
this.values,
|
||||
"firstKey|FirstValue\nchangedKey|changedValue",
|
||||
|
|
|
@ -8,7 +8,6 @@ import {
|
|||
import { hbs } from "ember-cli-htmlbars";
|
||||
import { module, test } from "qunit";
|
||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||
import { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
|
||||
module("Integration | Component | simple-list", function (hooks) {
|
||||
setupRenderingTest(hooks);
|
||||
|
@ -29,11 +28,9 @@ module("Integration | Component | simple-list", function (hooks) {
|
|||
.dom(".values .value")
|
||||
.exists({ count: 3 }, "adds the value to the list of values");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".values .value[data-index='2'] .value-input").value,
|
||||
"penar",
|
||||
"it sets the correct value for added item"
|
||||
);
|
||||
assert
|
||||
.dom(".values .value[data-index='2'] .value-input")
|
||||
.hasValue("penar", "sets the correct value for added item");
|
||||
|
||||
await fillIn(".add-value-input", "eviltrout");
|
||||
await triggerKeyEvent(".add-value-input", "keydown", "Enter");
|
||||
|
@ -76,10 +73,7 @@ module("Integration | Component | simple-list", function (hooks) {
|
|||
await fillIn(".values .value[data-index='1'] .value-input", "jarek");
|
||||
await blur(".values .value[data-index='1'] .value-input");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".values .value[data-index='1'] .value-input").value,
|
||||
"jarek"
|
||||
);
|
||||
assert.dom(".values .value[data-index='1'] .value-input").hasValue("jarek");
|
||||
});
|
||||
|
||||
test("removing a value", async function (assert) {
|
||||
|
@ -93,11 +87,9 @@ module("Integration | Component | simple-list", function (hooks) {
|
|||
.dom(".values .value")
|
||||
.exists({ count: 1 }, "removes the value from the list of values");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".values .value[data-index='0'] .value-input").value,
|
||||
"osama",
|
||||
"it removes the correct value"
|
||||
);
|
||||
assert
|
||||
.dom(".values .value[data-index='0'] .value-input")
|
||||
.hasValue("osama", "removes the correct value");
|
||||
});
|
||||
|
||||
test("delimiter support", async function (assert) {
|
||||
|
@ -114,10 +106,8 @@ module("Integration | Component | simple-list", function (hooks) {
|
|||
.dom(".values .value")
|
||||
.exists({ count: 3 }, "adds the value to the list of values");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".values .value[data-index='2'] .value-input").value,
|
||||
"eviltrout",
|
||||
"it adds the correct value"
|
||||
);
|
||||
assert
|
||||
.dom(".values .value[data-index='2'] .value-input")
|
||||
.hasValue("eviltrout", "adds the correct value");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -2,7 +2,6 @@ import { blur, click, 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 { query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
|
||||
module("Integration | Component | value-list", function (hooks) {
|
||||
|
@ -36,10 +35,7 @@ module("Integration | Component | value-list", function (hooks) {
|
|||
await fillIn(".values .value[data-index='1'] .value-input", "jarek");
|
||||
await blur(".values .value[data-index='1'] .value-input");
|
||||
|
||||
assert.strictEqual(
|
||||
query(".values .value[data-index='1'] .value-input").value,
|
||||
"jarek"
|
||||
);
|
||||
assert.dom(".values .value[data-index='1'] .value-input").hasValue("jarek");
|
||||
assert.deepEqual(this.values, "vinkas\njarek", "updates the value list");
|
||||
});
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ module("Unit | Utility | autocomplete", function (hooks) {
|
|||
|
||||
await simulateKeys(element, "a :)\r");
|
||||
|
||||
assert.strictEqual(element.value, "a :sad: ");
|
||||
assert.dom(element).hasValue("a :sad: ");
|
||||
assert.strictEqual(element.selectionStart, 8);
|
||||
assert.strictEqual(element.selectionEnd, 8);
|
||||
});
|
||||
|
@ -70,24 +70,24 @@ module("Unit | Utility | autocomplete", function (hooks) {
|
|||
|
||||
await simulateKeys(element, "@\r");
|
||||
|
||||
assert.strictEqual(element.value, "@test1 ");
|
||||
assert.dom(element).hasValue("@test1 ");
|
||||
assert.strictEqual(element.selectionStart, 7);
|
||||
assert.strictEqual(element.selectionEnd, 7);
|
||||
|
||||
await simulateKeys(element, "@2\r");
|
||||
|
||||
assert.strictEqual(element.value, "@test1 @test2 ");
|
||||
assert.dom(element).hasValue("@test1 @test2 ");
|
||||
assert.strictEqual(element.selectionStart, 14);
|
||||
assert.strictEqual(element.selectionEnd, 14);
|
||||
|
||||
await setCaretPosition(element, 6);
|
||||
await simulateKeys(element, "\b\b");
|
||||
|
||||
assert.strictEqual(element.value, "@tes @test2 ");
|
||||
assert.dom(element).hasValue("@tes @test2 ");
|
||||
|
||||
await simulateKey(element, "\r");
|
||||
|
||||
assert.strictEqual(element.value, "@test1 @test2 ");
|
||||
assert.dom(element).hasValue("@test1 @test2 ");
|
||||
assert.strictEqual(element.selectionStart, 7);
|
||||
assert.strictEqual(element.selectionEnd, 7);
|
||||
|
||||
|
@ -133,7 +133,7 @@ module("Unit | Utility | autocomplete", function (hooks) {
|
|||
|
||||
await simulateKeys(element, "@jane d\r");
|
||||
|
||||
assert.strictEqual(element.value, "@jd ");
|
||||
assert.dom(element).hasValue("@jd ");
|
||||
});
|
||||
|
||||
test("Autocomplete can render on @", async function (assert) {
|
||||
|
|
|
@ -3,7 +3,6 @@ import { skip } from "qunit";
|
|||
import {
|
||||
acceptance,
|
||||
publishToMessageBus,
|
||||
query,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import {
|
||||
baseChatPretenders,
|
||||
|
@ -121,11 +120,7 @@ acceptance("Discourse Chat - Composer - unreliable network", function (needs) {
|
|||
assert
|
||||
.dom(".chat-message-container[data-id='175']")
|
||||
.exists("it sends the message");
|
||||
assert.strictEqual(
|
||||
query(".chat-composer__input").value,
|
||||
"",
|
||||
"it clears the input"
|
||||
);
|
||||
assert.dom(".chat-composer__input").hasNoValue("clears the input");
|
||||
});
|
||||
|
||||
skip("Draft with unreliable network", async function (assert) {
|
||||
|
|
|
@ -2,7 +2,7 @@ import { click, fillIn, visit } from "@ember/test-helpers";
|
|||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
acceptance("Details Button", function (needs) {
|
||||
needs.user();
|
||||
|
@ -19,13 +19,14 @@ acceptance("Details Button", function (needs) {
|
|||
await popupMenu.expand();
|
||||
await popupMenu.selectRowByName(i18n("details.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`\n[details="${i18n("composer.details_title")}"]\n${i18n(
|
||||
"composer.details_text"
|
||||
)}\n[/details]\n`,
|
||||
"it should contain the right output"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`\n[details="${i18n("composer.details_title")}"]\n${i18n(
|
||||
"composer.details_text"
|
||||
)}\n[/details]\n`,
|
||||
"contains the right output"
|
||||
);
|
||||
|
||||
await fillIn(".d-editor-input", "This is my title");
|
||||
|
||||
|
@ -36,13 +37,14 @@ acceptance("Details Button", function (needs) {
|
|||
await popupMenu.expand();
|
||||
await popupMenu.selectRowByName(i18n("details.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`\n[details="${i18n(
|
||||
"composer.details_title"
|
||||
)}"]\nThis is my title\n[/details]\n`,
|
||||
"it should contain the right selected output"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`\n[details="${i18n(
|
||||
"composer.details_title"
|
||||
)}"]\nThis is my title\n[/details]\n`,
|
||||
"contains the right selected output"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
textarea.selectionStart,
|
||||
|
@ -63,13 +65,14 @@ acceptance("Details Button", function (needs) {
|
|||
await popupMenu.expand();
|
||||
await popupMenu.selectRowByName(i18n("details.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`Before \n[details="${i18n(
|
||||
"composer.details_title"
|
||||
)}"]\nsome text in between\n[/details]\n After`,
|
||||
"it should contain the right output"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`Before \n[details="${i18n(
|
||||
"composer.details_title"
|
||||
)}"]\nsome text in between\n[/details]\n After`,
|
||||
"contains the right output"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
textarea.selectionStart,
|
||||
|
@ -90,13 +93,14 @@ acceptance("Details Button", function (needs) {
|
|||
await popupMenu.expand();
|
||||
await popupMenu.selectRowByName(i18n("details.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`Before \n\n[details="${i18n(
|
||||
"composer.details_title"
|
||||
)}"]\nsome text in between\n[/details]\n\n After`,
|
||||
"it should contain the right output"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`Before \n\n[details="${i18n(
|
||||
"composer.details_title"
|
||||
)}"]\nsome text in between\n[/details]\n\n After`,
|
||||
"contains the right output"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
textarea.selectionStart,
|
||||
|
@ -128,12 +132,13 @@ acceptance("Details Button", function (needs) {
|
|||
await popupMenu.expand();
|
||||
await popupMenu.selectRowByName(i18n("details.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`\n[details="${i18n(
|
||||
"composer.details_title"
|
||||
)}"]\n${multilineInput}\n[/details]\n`,
|
||||
"it should contain the right output"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`\n[details="${i18n(
|
||||
"composer.details_title"
|
||||
)}"]\n${multilineInput}\n[/details]\n`,
|
||||
"contains the right output"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
import { click, visit } from "@ember/test-helpers";
|
||||
import { test } from "qunit";
|
||||
import topicFixtures from "discourse/tests/fixtures/topic";
|
||||
import {
|
||||
acceptance,
|
||||
query,
|
||||
selectText,
|
||||
} from "discourse/tests/helpers/qunit-helpers";
|
||||
import { acceptance, selectText } from "discourse/tests/helpers/qunit-helpers";
|
||||
import { cloneJSON } from "discourse-common/lib/object";
|
||||
|
||||
acceptance("Local Dates - quoting", function (needs) {
|
||||
|
@ -47,11 +43,10 @@ acceptance("Local Dates - quoting", function (needs) {
|
|||
await visit("/t/internationalization-localization/280");
|
||||
await selectText("#post_1 .select-local-date-test");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
assert.dom(".d-editor-input").hasValue(
|
||||
`[quote=\"uwe_keim, post:1, topic:280\"]
|
||||
This is a test [date=2022-06-17 time=10:00:00 timezone="Australia/Brisbane" displayedTimezone="Australia/Perth"]
|
||||
[/quote]`,
|
||||
[/quote]\n\n`,
|
||||
"converts the date to markdown with all options correctly"
|
||||
);
|
||||
});
|
||||
|
@ -86,11 +81,10 @@ acceptance("Local Dates - quoting range", function (needs) {
|
|||
await visit("/t/internationalization-localization/280");
|
||||
await selectText("#post_1 .select-local-date-test");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
assert.dom(".d-editor-input").hasValue(
|
||||
`[quote=\"uwe_keim, post:1, topic:280\"]
|
||||
Some text [date-range from=2022-06-17T09:30:00 to=2022-06-18T10:30:00 format="LL" timezone="Australia/Brisbane" timezones="Africa/Accra|Australia/Brisbane|Europe/Paris"]
|
||||
[/quote]`,
|
||||
[/quote]\n\n`,
|
||||
"converts the date range to markdown with all options correctly"
|
||||
);
|
||||
});
|
||||
|
@ -128,13 +122,12 @@ acceptance(
|
|||
await visit("/t/internationalization-localization/280");
|
||||
await selectText("#post_1 .select-local-date-test");
|
||||
await click(".insert-quote");
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value.trim(),
|
||||
assert.dom(".d-editor-input").hasValue(
|
||||
`[quote=\"uwe_keim, post:1, topic:280\"]
|
||||
Testing countdown [date=2022-06-21 time=09:30:00 format="LL" timezone="Australia/Brisbane" countdown="true"]
|
||||
|
||||
Testing recurring [date=2022-06-22 timezone="Australia/Brisbane" recurring="2.weeks"]
|
||||
[/quote]`,
|
||||
[/quote]\n\n`,
|
||||
"converts the dates to markdown with all options correctly"
|
||||
);
|
||||
});
|
||||
|
|
|
@ -2,7 +2,7 @@ import { click, fillIn, visit } from "@ember/test-helpers";
|
|||
import { test } from "qunit";
|
||||
import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||
import { i18n } from 'discourse-i18n';
|
||||
import { i18n } from "discourse-i18n";
|
||||
|
||||
acceptance("Spoiler Button", function (needs) {
|
||||
needs.user();
|
||||
|
@ -22,11 +22,12 @@ acceptance("Spoiler Button", function (needs) {
|
|||
await popUpMenu.expand();
|
||||
await popUpMenu.selectRowByName(i18n("spoiler.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`[spoiler]${i18n("composer.spoiler_text")}[/spoiler]`,
|
||||
"it should contain the right output"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`[spoiler]${i18n("composer.spoiler_text")}[/spoiler]`,
|
||||
"contains the right output"
|
||||
);
|
||||
|
||||
let textarea = query(".d-editor-input");
|
||||
assert.strictEqual(
|
||||
|
@ -48,11 +49,12 @@ acceptance("Spoiler Button", function (needs) {
|
|||
await popUpMenu.expand();
|
||||
await popUpMenu.selectRowByName(i18n("spoiler.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`[spoiler]This is hidden[/spoiler]`,
|
||||
"it should contain the right output"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`[spoiler]This is hidden[/spoiler]`,
|
||||
"contains the right output"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
textarea.selectionStart,
|
||||
|
@ -73,11 +75,12 @@ acceptance("Spoiler Button", function (needs) {
|
|||
await popUpMenu.expand();
|
||||
await popUpMenu.selectRowByName(i18n("spoiler.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`Before [spoiler]this is hidden[/spoiler] After`,
|
||||
"it should contain the right output"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`Before [spoiler]this is hidden[/spoiler] After`,
|
||||
"contains the right output"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
textarea.selectionStart,
|
||||
|
@ -98,11 +101,12 @@ acceptance("Spoiler Button", function (needs) {
|
|||
await popUpMenu.expand();
|
||||
await popUpMenu.selectRowByName(i18n("spoiler.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`Before\n[spoiler]this is hidden[/spoiler]\nAfter`,
|
||||
"it should contain the right output"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`Before\n[spoiler]this is hidden[/spoiler]\nAfter`,
|
||||
"contains the right output"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
textarea.selectionStart,
|
||||
|
@ -124,11 +128,12 @@ acceptance("Spoiler Button", function (needs) {
|
|||
await popUpMenu.expand();
|
||||
await popUpMenu.selectRowByName(i18n("spoiler.title"));
|
||||
|
||||
assert.strictEqual(
|
||||
query(".d-editor-input").value,
|
||||
`Before\n[spoiler]\nthis is\n\nhidden\n[/spoiler]\nAfter`,
|
||||
"it should contain the right output"
|
||||
);
|
||||
assert
|
||||
.dom(".d-editor-input")
|
||||
.hasValue(
|
||||
`Before\n[spoiler]\nthis is\n\nhidden\n[/spoiler]\nAfter`,
|
||||
"contains the right output"
|
||||
);
|
||||
|
||||
assert.strictEqual(
|
||||
textarea.selectionStart,
|
||||
|
|
Loading…
Reference in New Issue