mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Disable smart lists for now on Firefox (#27677)
Firefox is having a lot of inconsistent issues with this
feature introduced in 30fdd7738e,
disabling it there for now until further investigation can
be done.
This commit is contained in:
@@ -515,6 +515,15 @@ export default Mixin.create({
|
|||||||
|
|
||||||
@bind
|
@bind
|
||||||
maybeContinueList() {
|
maybeContinueList() {
|
||||||
|
// TODO (martin) Very inconsistent on Firefox at the moment, we end up with
|
||||||
|
// things like this. Something about newlines maybe?
|
||||||
|
//
|
||||||
|
// 1. a
|
||||||
|
// 2. test? 2. 2. 2. 2. 2.
|
||||||
|
if (this.capabilities.isFirefox) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const offset = caretPosition(this._textarea);
|
const offset = caretPosition(this._textarea);
|
||||||
const text = this._textarea.value;
|
const text = this._textarea.value;
|
||||||
const lines = text.substring(0, offset).split("\n");
|
const lines = text.substring(0, offset).split("\n");
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { setCaretPosition } from "discourse/lib/utilities";
|
|||||||
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
import { setupRenderingTest } from "discourse/tests/helpers/component-test";
|
||||||
import formatTextWithSelection from "discourse/tests/helpers/d-editor-helper";
|
import formatTextWithSelection from "discourse/tests/helpers/d-editor-helper";
|
||||||
import {
|
import {
|
||||||
|
chromeTest,
|
||||||
exists,
|
exists,
|
||||||
paste,
|
paste,
|
||||||
query,
|
query,
|
||||||
@@ -77,8 +78,13 @@ module("Integration | Component | d-editor", function (hooks) {
|
|||||||
return textarea;
|
return textarea;
|
||||||
}
|
}
|
||||||
|
|
||||||
function testCase(title, testFunc) {
|
function testCase(title, testFunc, opts = {}) {
|
||||||
test(title, async function (assert) {
|
let testFn = test;
|
||||||
|
if (opts.chrome) {
|
||||||
|
testFn = chromeTest;
|
||||||
|
}
|
||||||
|
|
||||||
|
testFn(title, async function (assert) {
|
||||||
this.set("value", "hello world.");
|
this.set("value", "hello world.");
|
||||||
|
|
||||||
await render(hbs`<DEditor @value={{this.value}} />`);
|
await render(hbs`<DEditor @value={{this.value}} />`);
|
||||||
@@ -991,7 +997,8 @@ third line`
|
|||||||
setCaretPosition(textarea, initialValue.length);
|
setCaretPosition(textarea, initialValue.length);
|
||||||
await triggerKeyEvent(textarea, "keydown", "Enter");
|
await triggerKeyEvent(textarea, "keydown", "Enter");
|
||||||
assert.strictEqual(this.value, initialValue + "* ");
|
assert.strictEqual(this.value, initialValue + "* ");
|
||||||
}
|
},
|
||||||
|
{ chrome: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
testCase(
|
testCase(
|
||||||
@@ -1002,7 +1009,8 @@ third line`
|
|||||||
setCaretPosition(textarea, initialValue.length);
|
setCaretPosition(textarea, initialValue.length);
|
||||||
await triggerKeyEvent(textarea, "keydown", "Enter");
|
await triggerKeyEvent(textarea, "keydown", "Enter");
|
||||||
assert.strictEqual(this.value, initialValue + "- ");
|
assert.strictEqual(this.value, initialValue + "- ");
|
||||||
}
|
},
|
||||||
|
{ chrome: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
testCase(
|
testCase(
|
||||||
@@ -1013,7 +1021,8 @@ third line`
|
|||||||
setCaretPosition(textarea, initialValue.length);
|
setCaretPosition(textarea, initialValue.length);
|
||||||
await triggerKeyEvent(textarea, "keydown", "Enter");
|
await triggerKeyEvent(textarea, "keydown", "Enter");
|
||||||
assert.strictEqual(this.value, initialValue + "2. ");
|
assert.strictEqual(this.value, initialValue + "2. ");
|
||||||
}
|
},
|
||||||
|
{ chrome: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
testCase(
|
testCase(
|
||||||
@@ -1027,7 +1036,8 @@ third line`
|
|||||||
this.value,
|
this.value,
|
||||||
"* first item in list\n* \n* second item in list"
|
"* first item in list\n* \n* second item in list"
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
{ chrome: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
testCase(
|
testCase(
|
||||||
@@ -1041,7 +1051,8 @@ third line`
|
|||||||
this.value,
|
this.value,
|
||||||
"1. first item in list\n2. \n3. second item in list"
|
"1. first item in list\n2. \n3. second item in list"
|
||||||
);
|
);
|
||||||
}
|
},
|
||||||
|
{ chrome: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
testCase(
|
testCase(
|
||||||
@@ -1052,7 +1063,8 @@ third line`
|
|||||||
setCaretPosition(textarea, initialValue.length);
|
setCaretPosition(textarea, initialValue.length);
|
||||||
await triggerKeyEvent(textarea, "keydown", "Enter");
|
await triggerKeyEvent(textarea, "keydown", "Enter");
|
||||||
assert.strictEqual(this.value, "* first item in list with empty line\n");
|
assert.strictEqual(this.value, "* first item in list with empty line\n");
|
||||||
}
|
},
|
||||||
|
{ chrome: true }
|
||||||
);
|
);
|
||||||
|
|
||||||
(() => {
|
(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user