mirror of
https://github.com/fastmail/Squire.git
synced 2024-12-22 07:13:08 -05:00
Fix variable shadowing in spec
This commit is contained in:
parent
3dcd940a20
commit
39b759de1c
1 changed files with 12 additions and 14 deletions
|
@ -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(() => {
|
||||||
|
|
Loading…
Reference in a new issue