Skip to content

Commit

Permalink
DEV: Enable some of the skipped Firefox tests (discourse#22800)
Browse files Browse the repository at this point in the history
  • Loading branch information
CvX authored Jul 27, 2023
1 parent 0369839 commit 83043bd
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 87 deletions.
110 changes: 48 additions & 62 deletions app/assets/javascripts/discourse/tests/acceptance/topic-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
acceptance,
chromeTest,
count,
exists,
publishToMessageBus,
Expand Down Expand Up @@ -376,67 +375,54 @@ acceptance("Topic featured links", function (needs) {
assert.ok(!exists(".gap"), "it hides gap");
});

chromeTest(
"Quoting a quote keeps the original poster name",
async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
await click(".quote-button .insert-quote");

assert.ok(
query(".d-editor-input").value.includes(
'quote="codinghorror said, post:3, topic:280"'
)
);
}
);

chromeTest(
"Quoting a quote of a different topic keeps the original topic title",
async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_9 blockquote");
await click(".quote-button .insert-quote");

assert.ok(
query(".d-editor-input").value.includes(
'quote="A new topic with a link to another topic, post:3, topic:62"'
)
);
}
);

chromeTest(
"Quoting a quote with the Reply button keeps the original poster name",
async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
await click(".reply");

assert.ok(
query(".d-editor-input").value.includes(
'quote="codinghorror said, post:3, topic:280"'
)
);
}
);

// Using J/K on Firefox clean the text selection, so this won't work there
chromeTest(
"Quoting a quote with replyAsNewTopic keeps the original poster name",
async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
await triggerKeyEvent(document, "keypress", "J");
await triggerKeyEvent(document, "keypress", "T");

assert.ok(
query(".d-editor-input").value.includes(
'quote="codinghorror said, post:3, topic:280"'
)
);
}
);
test("Quoting a quote keeps the original poster name", async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
await click(".quote-button .insert-quote");

assert.ok(
query(".d-editor-input").value.includes(
'quote="codinghorror said, post:3, topic:280"'
)
);
});

test("Quoting a quote of a different topic keeps the original topic title", async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_9 blockquote");
await click(".quote-button .insert-quote");

assert.ok(
query(".d-editor-input").value.includes(
'quote="A new topic with a link to another topic, post:3, topic:62"'
)
);
});

test("Quoting a quote with the Reply button keeps the original poster name", async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
await click(".reply");

assert.ok(
query(".d-editor-input").value.includes(
'quote="codinghorror said, post:3, topic:280"'
)
);
});

test("Quoting a quote with replyAsNewTopic keeps the original poster name", async function (assert) {
await visit("/t/internationalization-localization/280");
await selectText("#post_5 blockquote");
await triggerKeyEvent(document, "keypress", "J");
await triggerKeyEvent(document, "keypress", "T");

assert.ok(
query(".d-editor-input").value.includes(
'quote="codinghorror said, post:3, topic:280"'
)
);
});

test("Quoting by selecting text can mark the quote as full", async function (assert) {
await visit("/t/internationalization-localization/280");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { click, fillIn, render, settled } from "@ember/test-helpers";
import {
chromeTest,
exists,
paste,
query,
Expand Down Expand Up @@ -71,7 +70,7 @@ module("Integration | Component | d-editor", function (hooks) {
}

function testCase(title, testFunc) {
chromeTest(title, async function (assert) {
test(title, async function (assert) {
this.set("value", "hello world.");

await render(hbs`<DEditor @value={{this.value}} />`);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,36 +1,32 @@
import { module } from "qunit";
import { module, test } from "qunit";
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
import { render } from "@ember/test-helpers";
import { chromeTest, query } from "discourse/tests/helpers/qunit-helpers";
import { query } from "discourse/tests/helpers/qunit-helpers";
import { hbs } from "ember-cli-htmlbars";

module(
"Integration | Component | consistent input/dropdown/button sizes",
function (hooks) {
setupRenderingTest(hooks);

// these tests fail on Firefox 78 in CI, skipping for now
chromeTest(
"icon only button, icon and text button, text only button",
async function (assert) {
await render(
hbs`<DButton @icon="plus" /> <DButton @icon="plus" @label="topic.create" /> <DButton @label="topic.create" />`
);
test("icon only button, icon and text button, text only button", async function (assert) {
await render(
hbs`<DButton @icon="plus" /> <DButton @icon="plus" @label="topic.create" /> <DButton @label="topic.create" />`
);

assert.strictEqual(
query(".btn:nth-child(1)").offsetHeight,
query(".btn:nth-child(2)").offsetHeight,
"have equal height"
);
assert.strictEqual(
query(".btn:nth-child(1)").offsetHeight,
query(".btn:nth-child(3)").offsetHeight,
"have equal height"
);
}
);
assert.strictEqual(
query(".btn:nth-child(1)").offsetHeight,
query(".btn:nth-child(2)").offsetHeight,
"have equal height"
);
assert.strictEqual(
query(".btn:nth-child(1)").offsetHeight,
query(".btn:nth-child(3)").offsetHeight,
"have equal height"
);
});

chromeTest("button + text input", async function (assert) {
test("button + text input", async function (assert) {
await render(
hbs`<TextField /> <DButton @icon="plus" @label="topic.create" />`
);
Expand All @@ -42,7 +38,7 @@ module(
);
});

chromeTest("combo box + input", async function (assert) {
test("combo box + input", async function (assert) {
await render(
hbs`<ComboBox @options={{hash none="category.none"}} /> <TextField />`
);
Expand Down

0 comments on commit 83043bd

Please sign in to comment.