DEV: Fix flaky d-editor test (#13005)

This commit is contained in:
Penar Musaraj 2021-05-10 13:00:18 -04:00 committed by GitHub
parent c473cde997
commit 81616fbdc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -438,7 +438,7 @@ export default Component.extend({
}
schedule("afterRender", () => {
if (this._state !== "inDOM") {
if (this._state !== "inDOM" || !this.element) {
return;
}
const $preview = $(this.element.querySelector(".d-editor-preview"));
@ -653,6 +653,10 @@ export default Component.extend({
_selectText(from, length, opts = { scroll: true }) {
next(() => {
if (!this.element) {
return;
}
const textarea = this.element.querySelector("textarea.d-editor-input");
const $textarea = $(textarea);
textarea.selectionStart = from;