jqtree 1.6.3 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/ci.yml +15 -21
- package/.github/workflows/codeql-analysis.yml +2 -2
- package/README.md +1 -1
- package/bower.json +10 -3
- package/config/production +2 -2
- package/config/{rollup.config.js → rollup.config.mjs} +3 -8
- package/docs/Gemfile.lock +34 -37
- package/docs/_config.yml +1 -1
- package/docs/_entries/10_changelog.md +13 -0
- package/docs/_entries/93_getnextnode.md +4 -1
- package/docs/_entries/{95_getpreviousnode.md → 95_getnextvisiblenode.md} +1 -1
- package/docs/_entries/96_getpreviousnode.md +0 -0
- package/docs/_entries/98_getpreviousvisiblenode.md +14 -0
- package/docs/package.json +7 -7
- package/docs/pnpm-lock.yaml +413 -265
- package/docs/static/bower.json +2 -2
- package/docs/static/bower_components/fontawesome/css/all.min.css +6 -2
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-v4compatibility.ttf +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-v4compatibility.woff2 +0 -0
- package/docs/static/bower_components/jquery/dist/jquery.js +944 -1121
- package/docs/static/bower_components/jquery/dist/jquery.min.js +2 -2
- package/docs/static/documentation.css +181 -159
- package/docs/static/example.css +0 -1
- package/docs/tree.jquery.js +3 -3
- package/lib/dataLoader.js +5 -31
- package/lib/dragAndDropHandler.js +40 -142
- package/lib/elementsRenderer.js +52 -72
- package/lib/keyHandler.js +8 -32
- package/lib/mouse.widget.js +24 -74
- package/lib/node.js +72 -134
- package/lib/nodeElement.js +24 -84
- package/lib/playwright/coverage.js +58 -97
- package/lib/playwright/playwright.test.js +148 -210
- package/lib/playwright/testUtils.js +116 -182
- package/lib/saveStateHandler.js +13 -62
- package/lib/scrollHandler.js +24 -77
- package/lib/selectNodeHandler.js +6 -25
- package/lib/simple.widget.js +20 -53
- package/lib/test/jqTree/accessibility.test.js +37 -0
- package/lib/test/jqTree/create.test.js +0 -4
- package/lib/test/jqTree/events.test.js +73 -84
- package/lib/test/jqTree/keyboard.test.js +0 -6
- package/lib/test/jqTree/loadOnDemand.test.js +84 -121
- package/lib/test/jqTree/methods.test.js +107 -150
- package/lib/test/jqTree/options.test.js +32 -54
- package/lib/test/node.test.js +134 -76
- package/lib/test/nodeUtil.test.js +0 -1
- package/lib/test/support/jqTreeMatchers.js +4 -9
- package/lib/test/support/setupTests.js +0 -4
- package/lib/test/support/testUtil.js +2 -11
- package/lib/test/support/treeStructure.js +0 -6
- package/lib/test/util.test.js +0 -1
- package/lib/tree.jquery.js +28 -239
- package/lib/util.js +0 -6
- package/lib/version.js +1 -1
- package/package.json +44 -47
- package/src/dragAndDropHandler.ts +24 -10
- package/src/elementsRenderer.ts +49 -42
- package/src/jqtreeOptions.ts +3 -3
- package/src/keyHandler.ts +3 -3
- package/src/mouse.widget.ts +12 -0
- package/src/node.ts +52 -16
- package/src/nodeElement.ts +27 -21
- package/src/saveStateHandler.ts +1 -1
- package/src/scrollHandler.ts +6 -2
- package/src/selectNodeHandler.ts +1 -1
- package/src/simple.widget.ts +2 -0
- package/src/test/.eslintrc +3 -1
- package/src/test/jqTree/accessibility.test.ts +25 -0
- package/src/test/jqTree/events.test.ts +79 -93
- package/src/test/jqTree/methods.test.ts +1 -1
- package/src/test/node.test.ts +152 -58
- package/src/test/nodeUtil.test.ts +1 -1
- package/src/tree.jquery.ts +7 -6
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +297 -904
- package/tree.jquery.debug.js.map +1 -1
- package/tree.jquery.js +3 -3
- package/tree.jquery.js.map +1 -1
- package/tsconfig.json +1 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.eot +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.svg +0 -3717
- package/docs/static/bower_components/fontawesome/webfonts/fa-brands-400.woff +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.eot +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.svg +0 -801
- package/docs/static/bower_components/fontawesome/webfonts/fa-regular-400.woff +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.eot +0 -0
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.svg +0 -5028
- package/docs/static/bower_components/fontawesome/webfonts/fa-solid-900.woff +0 -0
- /package/docs/_entries/{96_getprevioussibling.md → 97_getprevioussibling.md} +0 -0
- /package/docs/_entries/{97_parent.md → 99_parent.md} +0 -0
package/lib/test/node.test.js
CHANGED
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _givens = _interopRequireDefault(require("givens"));
|
|
4
|
-
|
|
5
4
|
var _node = require("../node");
|
|
6
|
-
|
|
7
5
|
var _exampleData = _interopRequireDefault(require("./support/exampleData"));
|
|
8
|
-
|
|
9
6
|
require("jest-extended");
|
|
10
|
-
|
|
11
7
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
-
|
|
13
8
|
var context = describe;
|
|
14
9
|
describe("addAfter", function () {
|
|
15
10
|
var given = (0, _givens["default"])();
|
|
@@ -156,7 +151,8 @@ describe("addChild", function () {
|
|
|
156
151
|
})]));
|
|
157
152
|
});
|
|
158
153
|
it("sets the parent of the child", function () {
|
|
159
|
-
|
|
154
|
+
var _given$node$children$;
|
|
155
|
+
expect((_given$node$children$ = given.node.children[0]) === null || _given$node$children$ === void 0 ? void 0 : _given$node$children$.parent).toEqual(given.node);
|
|
160
156
|
});
|
|
161
157
|
});
|
|
162
158
|
describe("addChildAtPosition", function () {
|
|
@@ -378,8 +374,8 @@ describe("constructor", function () {
|
|
|
378
374
|
id: 123,
|
|
379
375
|
name: "n1",
|
|
380
376
|
url: "/"
|
|
381
|
-
});
|
|
382
|
-
|
|
377
|
+
});
|
|
378
|
+
// todo: match object?
|
|
383
379
|
expect(given.node).not.toHaveProperty("label");
|
|
384
380
|
expect(given.node.children).toHaveLength(0);
|
|
385
381
|
expect(given.node.parent).toBeNull();
|
|
@@ -491,13 +487,15 @@ describe("getLastChild", function () {
|
|
|
491
487
|
context("when its last child is open and has children", function () {
|
|
492
488
|
beforeEach(function () {
|
|
493
489
|
var child2 = given.node.children[1];
|
|
494
|
-
child2.append("child2a");
|
|
495
|
-
child2.append("child2b");
|
|
490
|
+
child2 === null || child2 === void 0 ? void 0 : child2.append("child2a");
|
|
491
|
+
child2 === null || child2 === void 0 ? void 0 : child2.append("child2b");
|
|
496
492
|
});
|
|
497
493
|
context("and the last child is open", function () {
|
|
498
494
|
beforeEach(function () {
|
|
499
495
|
var child2 = given.node.children[1];
|
|
500
|
-
child2
|
|
496
|
+
if (child2) {
|
|
497
|
+
child2.is_open = true;
|
|
498
|
+
}
|
|
501
499
|
});
|
|
502
500
|
it("returns the last child of that child", function () {
|
|
503
501
|
expect(given.node.getLastChild()).toMatchObject({
|
|
@@ -520,50 +518,39 @@ describe("getNextNode", function () {
|
|
|
520
518
|
given("tree", function () {
|
|
521
519
|
return new _node.Node().loadFromData(_exampleData["default"]);
|
|
522
520
|
});
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
context("with includeChildren is true", function () {
|
|
527
|
-
given("includeChildren", function () {
|
|
528
|
-
return true;
|
|
521
|
+
context("with a parent node", function () {
|
|
522
|
+
given("fromNode", function () {
|
|
523
|
+
return given.tree.getNodeByNameMustExist("node1");
|
|
529
524
|
});
|
|
530
|
-
context("
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
context("when the parent node is closed", function () {
|
|
535
|
-
it("returns the next sibling", function () {
|
|
536
|
-
expect(given.nextNode).toMatchObject({
|
|
537
|
-
name: "node2"
|
|
538
|
-
});
|
|
539
|
-
});
|
|
540
|
-
});
|
|
541
|
-
context("when the parent node is open", function () {
|
|
542
|
-
beforeEach(function () {
|
|
543
|
-
given.fromNode.is_open = true;
|
|
544
|
-
});
|
|
545
|
-
it("returns the first child", function () {
|
|
546
|
-
expect(given.nextNode).toMatchObject({
|
|
547
|
-
name: "child1"
|
|
548
|
-
});
|
|
525
|
+
context("when the parent node is closed", function () {
|
|
526
|
+
it("returns the first child", function () {
|
|
527
|
+
expect(given.fromNode.getNextNode()).toMatchObject({
|
|
528
|
+
name: "child1"
|
|
549
529
|
});
|
|
550
530
|
});
|
|
551
531
|
});
|
|
552
|
-
context("
|
|
553
|
-
|
|
554
|
-
|
|
532
|
+
context("when the parent node is open", function () {
|
|
533
|
+
beforeEach(function () {
|
|
534
|
+
given.fromNode.is_open = true;
|
|
555
535
|
});
|
|
556
|
-
it("returns the
|
|
557
|
-
expect(given.
|
|
558
|
-
name: "
|
|
536
|
+
it("returns the first child", function () {
|
|
537
|
+
expect(given.fromNode.getNextNode()).toMatchObject({
|
|
538
|
+
name: "child1"
|
|
559
539
|
});
|
|
560
540
|
});
|
|
561
541
|
});
|
|
562
542
|
});
|
|
563
|
-
context("with
|
|
564
|
-
given("
|
|
565
|
-
return
|
|
543
|
+
context("with the node is the last child", function () {
|
|
544
|
+
given("fromNode", function () {
|
|
545
|
+
return given.tree.getNodeByNameMustExist("child2");
|
|
546
|
+
});
|
|
547
|
+
it("returns the next sibling of the parent", function () {
|
|
548
|
+
expect(given.fromNode.getNextNode()).toMatchObject({
|
|
549
|
+
name: "node2"
|
|
550
|
+
});
|
|
566
551
|
});
|
|
552
|
+
});
|
|
553
|
+
context("with includeChildren is false", function () {
|
|
567
554
|
context("with an open parent node", function () {
|
|
568
555
|
given("fromNode", function () {
|
|
569
556
|
return given.tree.getNodeByNameMustExist("node1");
|
|
@@ -572,11 +559,57 @@ describe("getNextNode", function () {
|
|
|
572
559
|
given.fromNode.is_open = true;
|
|
573
560
|
});
|
|
574
561
|
it("returns the next sibling", function () {
|
|
575
|
-
expect(given.
|
|
562
|
+
expect(given.fromNode.getNextNode(false)).toMatchObject({
|
|
563
|
+
name: "node2"
|
|
564
|
+
});
|
|
565
|
+
});
|
|
566
|
+
});
|
|
567
|
+
});
|
|
568
|
+
});
|
|
569
|
+
describe("getNextVisibleNode", function () {
|
|
570
|
+
var given = (0, _givens["default"])();
|
|
571
|
+
given("tree", function () {
|
|
572
|
+
return new _node.Node().loadFromData(_exampleData["default"]);
|
|
573
|
+
});
|
|
574
|
+
context("with a parent node", function () {
|
|
575
|
+
given("fromNode", function () {
|
|
576
|
+
return given.tree.getNodeByNameMustExist("node1");
|
|
577
|
+
});
|
|
578
|
+
context("when the parent node is closed", function () {
|
|
579
|
+
it("returns the next sibling", function () {
|
|
580
|
+
expect(given.fromNode.getNextVisibleNode()).toMatchObject({
|
|
576
581
|
name: "node2"
|
|
577
582
|
});
|
|
578
583
|
});
|
|
579
584
|
});
|
|
585
|
+
context("when the parent node is open", function () {
|
|
586
|
+
beforeEach(function () {
|
|
587
|
+
given.fromNode.is_open = true;
|
|
588
|
+
});
|
|
589
|
+
it("returns the first child", function () {
|
|
590
|
+
expect(given.fromNode.getNextVisibleNode()).toMatchObject({
|
|
591
|
+
name: "child1"
|
|
592
|
+
});
|
|
593
|
+
});
|
|
594
|
+
});
|
|
595
|
+
});
|
|
596
|
+
context("with the node is the last child", function () {
|
|
597
|
+
given("fromNode", function () {
|
|
598
|
+
return given.tree.getNodeByNameMustExist("child2");
|
|
599
|
+
});
|
|
600
|
+
it("returns the next sibling of the parent", function () {
|
|
601
|
+
expect(given.fromNode.getNextVisibleNode()).toMatchObject({
|
|
602
|
+
name: "node2"
|
|
603
|
+
});
|
|
604
|
+
});
|
|
605
|
+
});
|
|
606
|
+
context("with the tree node", function () {
|
|
607
|
+
given("fromNode", function () {
|
|
608
|
+
return given.tree;
|
|
609
|
+
});
|
|
610
|
+
it("returns null", function () {
|
|
611
|
+
expect(given.fromNode.getNextVisibleNode()).toBeNull();
|
|
612
|
+
});
|
|
580
613
|
});
|
|
581
614
|
});
|
|
582
615
|
describe("getNextSibling", function () {
|
|
@@ -699,44 +732,71 @@ describe("getParent", function () {
|
|
|
699
732
|
});
|
|
700
733
|
describe("getPreviousNode", function () {
|
|
701
734
|
var given = (0, _givens["default"])();
|
|
702
|
-
given("
|
|
703
|
-
return
|
|
735
|
+
given("tree", function () {
|
|
736
|
+
return new _node.Node().loadFromData(_exampleData["default"]);
|
|
737
|
+
});
|
|
738
|
+
it("returns null with a tree node", function () {
|
|
739
|
+
expect(given.tree.getPreviousNode()).toBeNull();
|
|
740
|
+
});
|
|
741
|
+
it("returns the last child of the previous sibling when the previous node is closed and has children", function () {
|
|
742
|
+
given.tree.getNodeByNameMustExist("node2").is_open = false;
|
|
743
|
+
var node2 = given.tree.getNodeByNameMustExist("node2");
|
|
744
|
+
expect(node2.getPreviousNode()).toMatchObject({
|
|
745
|
+
name: "child2"
|
|
746
|
+
});
|
|
747
|
+
});
|
|
748
|
+
it("returns the last child of the previous sibling when the previous node is open and has children", function () {
|
|
749
|
+
given.tree.getNodeByNameMustExist("node2").is_open = true;
|
|
750
|
+
var node2 = given.tree.getNodeByNameMustExist("node2");
|
|
751
|
+
expect(node2.getPreviousNode()).toMatchObject({
|
|
752
|
+
name: "child2"
|
|
753
|
+
});
|
|
754
|
+
});
|
|
755
|
+
it("returns the first child if a node is the second child", function () {
|
|
756
|
+
var child2 = given.tree.getNodeByNameMustExist("child2");
|
|
757
|
+
expect(child2.getPreviousNode()).toMatchObject({
|
|
758
|
+
name: "child1"
|
|
759
|
+
});
|
|
704
760
|
});
|
|
705
|
-
|
|
706
|
-
|
|
761
|
+
it("returns the parent with a node that is the first child", function () {
|
|
762
|
+
var node3 = given.tree.getNodeByNameMustExist("node3");
|
|
763
|
+
expect(node3.getPreviousNode()).toMatchObject({
|
|
764
|
+
name: "node2"
|
|
765
|
+
});
|
|
707
766
|
});
|
|
767
|
+
});
|
|
768
|
+
describe("getPreviousVisibleNode", function () {
|
|
769
|
+
var given = (0, _givens["default"])();
|
|
708
770
|
given("tree", function () {
|
|
709
771
|
return new _node.Node().loadFromData(_exampleData["default"]);
|
|
710
772
|
});
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
773
|
+
it("returns null with a tree node", function () {
|
|
774
|
+
expect(given.tree.getPreviousVisibleNode()).toBeNull();
|
|
775
|
+
});
|
|
776
|
+
it("returns the previous sibling when the previous sibling is closed and has children", function () {
|
|
777
|
+
given.tree.getNodeByNameMustExist("node2").is_open = false;
|
|
778
|
+
var node2 = given.tree.getNodeByNameMustExist("node2");
|
|
779
|
+
expect(node2.getPreviousVisibleNode()).toMatchObject({
|
|
780
|
+
name: "node1"
|
|
714
781
|
});
|
|
715
782
|
});
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
});
|
|
722
|
-
});
|
|
783
|
+
it("returns the last child of the previous sibling when the previous sibling is open and has children", function () {
|
|
784
|
+
given.tree.getNodeByNameMustExist("node1").is_open = true;
|
|
785
|
+
var node2 = given.tree.getNodeByNameMustExist("node2");
|
|
786
|
+
expect(node2.getPreviousVisibleNode()).toMatchObject({
|
|
787
|
+
name: "child2"
|
|
723
788
|
});
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
expect(given.node2.getPreviousNode()).toMatchObject({
|
|
730
|
-
name: "child2"
|
|
731
|
-
});
|
|
732
|
-
});
|
|
789
|
+
});
|
|
790
|
+
it("returns the first child if a node is the second child", function () {
|
|
791
|
+
var child2 = given.tree.getNodeByNameMustExist("child2");
|
|
792
|
+
expect(child2.getPreviousVisibleNode()).toMatchObject({
|
|
793
|
+
name: "child1"
|
|
733
794
|
});
|
|
734
795
|
});
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
});
|
|
796
|
+
it("returns the parent when a node is the first child", function () {
|
|
797
|
+
var node3 = given.tree.getNodeByNameMustExist("node3");
|
|
798
|
+
expect(node3.getPreviousVisibleNode()).toMatchObject({
|
|
799
|
+
name: "node2"
|
|
740
800
|
});
|
|
741
801
|
});
|
|
742
802
|
});
|
|
@@ -861,7 +921,6 @@ describe("iterate", function () {
|
|
|
861
921
|
given.visited.push([node.name, level]);
|
|
862
922
|
return true;
|
|
863
923
|
};
|
|
864
|
-
|
|
865
924
|
given("visitor", function () {
|
|
866
925
|
return visitAllNodes;
|
|
867
926
|
});
|
|
@@ -874,7 +933,6 @@ describe("iterate", function () {
|
|
|
874
933
|
given.visited.push([node.name, level]);
|
|
875
934
|
return false;
|
|
876
935
|
};
|
|
877
|
-
|
|
878
936
|
given("visitor", function () {
|
|
879
937
|
return visitNodes;
|
|
880
938
|
});
|
|
@@ -1,24 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _treeStructure = _interopRequireDefault(require("./treeStructure"));
|
|
4
|
-
|
|
5
4
|
var _testUtil = require("./testUtil");
|
|
6
|
-
|
|
7
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
-
|
|
9
6
|
var assertJqTreeFolder = function assertJqTreeFolder($el) {
|
|
10
7
|
/* istanbul ignore if */
|
|
11
8
|
if (!$el.hasClass("jqtree-folder")) {
|
|
12
9
|
throw new Error("Node is not a folder");
|
|
13
10
|
}
|
|
14
11
|
};
|
|
15
|
-
|
|
16
12
|
expect.extend({
|
|
17
13
|
toBeClosed: function toBeClosed(el) {
|
|
18
14
|
var $el = jQuery(el);
|
|
19
15
|
assertJqTreeFolder($el);
|
|
20
|
-
/* istanbul ignore next */
|
|
21
16
|
|
|
17
|
+
/* istanbul ignore next */
|
|
22
18
|
return {
|
|
23
19
|
message: function message() {
|
|
24
20
|
return "The node is open";
|
|
@@ -38,8 +34,8 @@ expect.extend({
|
|
|
38
34
|
toBeOpen: function toBeOpen(el) {
|
|
39
35
|
var $el = jQuery(el);
|
|
40
36
|
assertJqTreeFolder($el);
|
|
41
|
-
/* istanbul ignore next */
|
|
42
37
|
|
|
38
|
+
/* istanbul ignore next */
|
|
43
39
|
return {
|
|
44
40
|
message: function message() {
|
|
45
41
|
return "The node is closed";
|
|
@@ -49,8 +45,8 @@ expect.extend({
|
|
|
49
45
|
},
|
|
50
46
|
toBeSelected: function toBeSelected(el) {
|
|
51
47
|
var $el = jQuery(el);
|
|
52
|
-
/* istanbul ignore next */
|
|
53
48
|
|
|
49
|
+
/* istanbul ignore next */
|
|
54
50
|
return {
|
|
55
51
|
message: function message() {
|
|
56
52
|
return "The node is not selected";
|
|
@@ -60,11 +56,10 @@ expect.extend({
|
|
|
60
56
|
},
|
|
61
57
|
toHaveTreeStructure: function toHaveTreeStructure(el, expectedStructure) {
|
|
62
58
|
var _this = this;
|
|
63
|
-
|
|
64
59
|
var $el = jQuery(el);
|
|
65
60
|
var receivedStructure = (0, _treeStructure["default"])($el);
|
|
66
|
-
/* istanbul ignore next */
|
|
67
61
|
|
|
62
|
+
/* istanbul ignore next */
|
|
68
63
|
return {
|
|
69
64
|
message: function message() {
|
|
70
65
|
return _this.utils.printDiffOrStringify(expectedStructure, receivedStructure, "expected", "received", true);
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _jquery = _interopRequireDefault(require("jquery"));
|
|
4
|
-
|
|
5
4
|
require("./jqTreeMatchers");
|
|
6
|
-
|
|
7
5
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
8
|
-
|
|
9
6
|
window.$ = _jquery["default"]; // eslint-disable-line @typescript-eslint/no-unsafe-member-access
|
|
10
|
-
|
|
11
7
|
window.jQuery = _jquery["default"]; // eslint-disable-line @typescript-eslint/no-unsafe-member-access
|
|
@@ -4,38 +4,29 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.togglerLink = exports.titleSpan = exports.singleChild = void 0;
|
|
7
|
-
|
|
8
7
|
var singleChild = function singleChild($el, selector) {
|
|
9
8
|
var $result = $el.children(selector);
|
|
10
|
-
/* istanbul ignore if */
|
|
11
9
|
|
|
10
|
+
/* istanbul ignore if */
|
|
12
11
|
if ($result.length === 0) {
|
|
13
12
|
throw "No child found for selector '".concat(selector, "'");
|
|
14
13
|
}
|
|
15
|
-
/* istanbul ignore if */
|
|
16
|
-
|
|
17
14
|
|
|
15
|
+
/* istanbul ignore if */
|
|
18
16
|
if ($result.length > 1) {
|
|
19
17
|
throw "Multiple elements found for selector '".concat(selector, "'");
|
|
20
18
|
}
|
|
21
|
-
|
|
22
19
|
return $result;
|
|
23
20
|
};
|
|
24
|
-
|
|
25
21
|
exports.singleChild = singleChild;
|
|
26
|
-
|
|
27
22
|
var titleSpan = function titleSpan(liNode) {
|
|
28
23
|
return singleChild(nodeElement(liNode), "span.jqtree-title");
|
|
29
24
|
};
|
|
30
|
-
|
|
31
25
|
exports.titleSpan = titleSpan;
|
|
32
|
-
|
|
33
26
|
var togglerLink = function togglerLink(liNode) {
|
|
34
27
|
return singleChild(nodeElement(liNode), "a.jqtree-toggler");
|
|
35
28
|
};
|
|
36
|
-
|
|
37
29
|
exports.togglerLink = togglerLink;
|
|
38
|
-
|
|
39
30
|
var nodeElement = function nodeElement(liNode) {
|
|
40
31
|
return singleChild(jQuery(liNode), "div.jqtree-element ");
|
|
41
32
|
};
|
|
@@ -4,15 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
var _testUtil = require("./testUtil");
|
|
9
|
-
|
|
10
8
|
var getTreeNode = function getTreeNode($li) {
|
|
11
9
|
var $div = (0, _testUtil.singleChild)($li, "div.jqtree-element");
|
|
12
10
|
var $span = (0, _testUtil.singleChild)($div, "span.jqtree-title");
|
|
13
11
|
var name = $span.html();
|
|
14
12
|
var selected = $li.hasClass("jqtree-selected");
|
|
15
|
-
|
|
16
13
|
if ($li.hasClass("jqtree-folder")) {
|
|
17
14
|
var $ul = $li.children("ul.jqtree_common");
|
|
18
15
|
return {
|
|
@@ -30,16 +27,13 @@ var getTreeNode = function getTreeNode($li) {
|
|
|
30
27
|
};
|
|
31
28
|
}
|
|
32
29
|
};
|
|
33
|
-
|
|
34
30
|
var getChildren = function getChildren($ul) {
|
|
35
31
|
return $ul.children("li.jqtree_common").map(function (_, li) {
|
|
36
32
|
return getTreeNode(jQuery(li));
|
|
37
33
|
}).get();
|
|
38
34
|
};
|
|
39
|
-
|
|
40
35
|
var treeStructure = function treeStructure($el) {
|
|
41
36
|
return getChildren((0, _testUtil.singleChild)($el, "ul.jqtree-tree"));
|
|
42
37
|
};
|
|
43
|
-
|
|
44
38
|
var _default = treeStructure;
|
|
45
39
|
exports["default"] = _default;
|