0
Fork 0
mirror of https://github.com/fastmail/Squire.git synced 2024-12-22 15:23:29 -05:00

Fix variable shadowing in spec

This commit is contained in:
Callum Skeet 2023-07-31 11:38:44 +10:00
parent 3dcd940a20
commit 39b759de1c

View file

@ -5,11 +5,20 @@
import { afterEach, beforeEach, describe, expect, it } from '@jest/globals'; import { afterEach, beforeEach, describe, expect, it } from '@jest/globals';
import { Squire } from '../source/Editor'; import { Squire } from '../source/Editor';
document.body.innerHTML = `<div id="squire">`; function selectAll(editor: Squire) {
document.getSelection()!.removeAllRanges();
let editor: Squire; const range = document.createRange();
range.setStart(editor._root.childNodes.item(0), 0);
range.setEnd(
editor._root.childNodes.item(0),
editor._root.childNodes.item(0).childNodes.length,
);
editor.setSelection(range);
}
describe('Squire RTE', () => { describe('Squire RTE', () => {
document.body.innerHTML = `<div id="squire">`;
let editor: Squire;
beforeEach(() => { beforeEach(() => {
const squireContainer = document.getElementById('squire')!; const squireContainer = document.getElementById('squire')!;
editor = new Squire(squireContainer, { editor = new Squire(squireContainer, {
@ -25,17 +34,6 @@ describe('Squire RTE', () => {
}); });
}); });
function selectAll(editor: Squire) {
document.getSelection()!.removeAllRanges();
const range = document.createRange();
range.setStart(editor._root.childNodes.item(0), 0);
range.setEnd(
editor._root.childNodes.item(0),
editor._root.childNodes.item(0).childNodes.length,
);
editor.setSelection(range);
}
describe('hasFormat', () => { describe('hasFormat', () => {
let startHTML; let startHTML;
beforeEach(() => { beforeEach(() => {