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
1 changed files with 5 additions and 1 deletions

View File

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