Skip to content

Commit 04578d3

Browse files
committed
ci: add test and lint jobs to ci
1 parent cdb57eb commit 04578d3

File tree

11 files changed

+66
-58
lines changed

11 files changed

+66
-58
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@ insert_final_newline = true
1010
charset = utf-8
1111
indent_style = space
1212
indent_size = 4
13+
14+
[*.{yml,yaml}]
15+
indent_size = 2

.gitlab-ci.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
1+
before_script:
2+
- npm ci --ignore-scripts --force
3+
4+
build:
5+
stage: build
6+
script: npm run build
7+
only:
8+
- merge_requests
9+
10+
lint:
11+
stage: test
12+
script: npm run lint
13+
only:
14+
- merge_requests
15+
116
test:
217
stage: test
3-
script: npm ci --ignore-scripts --force && npm run test
18+
script: npm run test
419
only:
520
- merge_requests

dist/squire-raw.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -338,11 +338,13 @@
338338
if (!child || isLeaf(child)) {
339339
if (startOffset) {
340340
child = startContainer.childNodes[startOffset - 1];
341-
let prev = child.previousSibling;
342-
while (child instanceof Text && !child.length && prev && prev instanceof Text) {
343-
child.remove();
344-
child = prev;
345-
continue;
341+
const prev = child.previousSibling;
342+
if (prev && prev instanceof Text) {
343+
while (child instanceof Text && !child.length) {
344+
child.remove();
345+
child = prev;
346+
continue;
347+
}
346348
}
347349
if (child instanceof Text) {
348350
startContainer = child;
@@ -466,18 +468,14 @@
466468
return node;
467469
};
468470
var fixContainer = (container, root) => {
469-
const children = container.childNodes;
470471
let wrapper = null;
471-
for (let i = 0, l = children.length; i < l; i += 1) {
472-
const child = children[i];
472+
[...container.childNodes].forEach((child) => {
473473
const isBR = child.nodeName === "BR";
474474
if (!isBR && isInline(child)) {
475475
if (!wrapper) {
476476
wrapper = createElement("DIV");
477477
}
478478
wrapper.appendChild(child);
479-
i -= 1;
480-
l -= 1;
481479
} else if (isBR || wrapper) {
482480
if (!wrapper) {
483481
wrapper = createElement("DIV");
@@ -487,15 +485,13 @@
487485
container.replaceChild(wrapper, child);
488486
} else {
489487
container.insertBefore(wrapper, child);
490-
i += 1;
491-
l += 1;
492488
}
493489
wrapper = null;
494490
}
495491
if (isContainer(child)) {
496492
fixContainer(child, root);
497493
}
498-
}
494+
});
499495
if (wrapper) {
500496
container.appendChild(fixCursor(wrapper));
501497
}

dist/squire-raw.mjs

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -340,11 +340,13 @@ var moveRangeBoundariesDownTree = (range) => {
340340
if (!child || isLeaf(child)) {
341341
if (startOffset) {
342342
child = startContainer.childNodes[startOffset - 1];
343-
let prev = child.previousSibling;
344-
while (child instanceof Text && !child.length && prev && prev instanceof Text) {
345-
child.remove();
346-
child = prev;
347-
continue;
343+
const prev = child.previousSibling;
344+
if (prev && prev instanceof Text) {
345+
while (child instanceof Text && !child.length) {
346+
child.remove();
347+
child = prev;
348+
continue;
349+
}
348350
}
349351
if (child instanceof Text) {
350352
startContainer = child;
@@ -468,18 +470,14 @@ var fixCursor = (node) => {
468470
return node;
469471
};
470472
var fixContainer = (container, root) => {
471-
const children = container.childNodes;
472473
let wrapper = null;
473-
for (let i = 0, l = children.length; i < l; i += 1) {
474-
const child = children[i];
474+
[...container.childNodes].forEach((child) => {
475475
const isBR = child.nodeName === "BR";
476476
if (!isBR && isInline(child)) {
477477
if (!wrapper) {
478478
wrapper = createElement("DIV");
479479
}
480480
wrapper.appendChild(child);
481-
i -= 1;
482-
l -= 1;
483481
} else if (isBR || wrapper) {
484482
if (!wrapper) {
485483
wrapper = createElement("DIV");
@@ -489,15 +487,13 @@ var fixContainer = (container, root) => {
489487
container.replaceChild(wrapper, child);
490488
} else {
491489
container.insertBefore(wrapper, child);
492-
i += 1;
493-
l += 1;
494490
}
495491
wrapper = null;
496492
}
497493
if (isContainer(child)) {
498494
fixContainer(child, root);
499495
}
500-
}
496+
});
501497
if (wrapper) {
502498
container.appendChild(fixCursor(wrapper));
503499
}

dist/squire.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/squire.js.map

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/squire.mjs

Lines changed: 11 additions & 11 deletions
Large diffs are not rendered by default.

dist/squire.mjs.map

Lines changed: 3 additions & 3 deletions
Large diffs are not rendered by default.

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

source/node/MergeSplit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const fixContainer = (
6060
root: Element | DocumentFragment,
6161
): Node => {
6262
let wrapper: HTMLElement | null = null;
63-
[...container.childNodes].forEach(child => {
63+
[...container.childNodes].forEach((child) => {
6464
const isBR = child.nodeName === 'BR';
6565
if (!isBR && isInline(child)) {
6666
if (!wrapper) {

0 commit comments

Comments
 (0)