Skip to content

Commit

Permalink
ci: add test and lint jobs to ci
Browse files Browse the repository at this point in the history
  • Loading branch information
SethFalco committed Mar 20, 2023
1 parent e58ecbc commit 436333e
Show file tree
Hide file tree
Showing 10 changed files with 48 additions and 28 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 4

[*.{yml,yaml}]
indent_size = 2
17 changes: 16 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
before_script:
- npm ci --ignore-scripts --force

build:
stage: build
script: npm run build
only:
- merge_requests

lint:
stage: test
script: npm run lint
only:
- merge_requests

test:
stage: test
script: npm ci --ignore-scripts --force && npm run test
script: npm run test
only:
- merge_requests
12 changes: 7 additions & 5 deletions dist/squire-raw.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,11 +338,13 @@
if (!child || isLeaf(child)) {
if (startOffset) {
child = startContainer.childNodes[startOffset - 1];
let prev = child.previousSibling;
while (child instanceof Text && !child.length && prev && prev instanceof Text) {
child.remove();
child = prev;
continue;
const prev = child.previousSibling;
if (prev && prev instanceof Text) {
while (child instanceof Text && !child.length) {
child.remove();
child = prev;
continue;
}
}
if (child instanceof Text) {
startContainer = child;
Expand Down
12 changes: 7 additions & 5 deletions dist/squire-raw.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,13 @@ var moveRangeBoundariesDownTree = (range) => {
if (!child || isLeaf(child)) {
if (startOffset) {
child = startContainer.childNodes[startOffset - 1];
let prev = child.previousSibling;
while (child instanceof Text && !child.length && prev && prev instanceof Text) {
child.remove();
child = prev;
continue;
const prev = child.previousSibling;
if (prev && prev instanceof Text) {
while (child instanceof Text && !child.length) {
child.remove();
child = prev;
continue;
}
}
if (child instanceof Text) {
startContainer = child;
Expand Down
2 changes: 1 addition & 1 deletion dist/squire.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/squire.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/squire.mjs

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/squire.mjs.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion source/node/MergeSplit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const fixContainer = (
root: Element | DocumentFragment,
): Node => {
let wrapper: HTMLElement | null = null;
[...container.childNodes].forEach(child => {
[...container.childNodes].forEach((child) => {
const isBR = child.nodeName === 'BR';
if (!isBR && isInline(child)) {
if (!wrapper) {
Expand Down
18 changes: 8 additions & 10 deletions source/range/Boundaries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,17 @@ const moveRangeBoundariesDownTree = (range: Range): void => {
if (!child || isLeaf(child)) {
if (startOffset) {
child = startContainer.childNodes[startOffset - 1];
let prev = child.previousSibling;
const prev = child.previousSibling;
// If we have an empty text node next to another text node,
// just skip and remove it.
while (
child instanceof Text &&
!child.length &&
prev &&
prev instanceof Text
) {
child.remove();
child = prev;
continue;
if (prev && prev instanceof Text) {
while (child instanceof Text && !child.length) {
child.remove();
child = prev;
continue;
}
}

if (child instanceof Text) {
startContainer = child;
startOffset = child.data.length;
Expand Down

0 comments on commit 436333e

Please sign in to comment.