jqtree 1.6.3 → 1.7.0
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 +21 -19
- package/.tool-versions +1 -0
- 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 +3 -3
- package/docs/_config.yml +1 -1
- package/docs/_entries/10_changelog.md +9 -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/{96_getprevioussibling.md → 97_getprevioussibling.md} +0 -0
- package/docs/_entries/98_getpreviousvisiblenode.md +14 -0
- package/docs/_entries/{97_parent.md → 99_parent.md} +0 -0
- package/docs/package.json +7 -7
- package/docs/pnpm-lock.yaml +138 -108
- package/docs/static/bower.json +1 -1
- package/docs/static/bower_components/jquery/dist/jquery.js +209 -97
- package/docs/static/bower_components/jquery/dist/jquery.min.js +2 -2
- package/docs/static/documentation.css +224 -84
- package/docs/static/example.css +0 -1
- package/docs/tree.jquery.js +2 -2
- package/lib/dataLoader.js +5 -31
- package/lib/dragAndDropHandler.js +19 -132
- package/lib/elementsRenderer.js +29 -59
- package/lib/keyHandler.js +8 -32
- package/lib/mouse.widget.js +13 -74
- package/lib/node.js +60 -125
- package/lib/nodeElement.js +5 -72
- 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 +12 -61
- package/lib/scrollHandler.js +17 -74
- package/lib/selectNodeHandler.js +5 -24
- package/lib/simple.widget.js +18 -53
- package/lib/test/jqTree/create.test.js +0 -4
- package/lib/test/jqTree/events.test.js +0 -7
- 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 +127 -72
- 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 +40 -39
- package/src/keyHandler.ts +3 -3
- package/src/node.ts +43 -12
- package/src/test/.eslintrc +3 -1
- package/src/test/node.test.ts +146 -54
- package/src/tree.jquery.ts +6 -5
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +202 -855
- package/tree.jquery.debug.js.map +1 -1
- package/tree.jquery.js +2 -2
- package/tree.jquery.js.map +1 -1
package/lib/simple.widget.js
CHANGED
|
@@ -4,62 +4,46 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = void 0;
|
|
7
|
-
|
|
8
7
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
-
|
|
10
8
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
-
|
|
12
9
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
13
|
-
|
|
14
|
-
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
15
|
-
|
|
10
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
16
11
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
17
|
-
|
|
18
|
-
function
|
|
19
|
-
|
|
12
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
14
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
20
15
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
21
|
-
|
|
22
16
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
23
|
-
|
|
24
17
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
25
|
-
|
|
26
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
27
|
-
|
|
18
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
28
19
|
var _register = function register(widgetClass, widgetName) {
|
|
29
20
|
var getDataKey = function getDataKey() {
|
|
30
21
|
return "simple_widget_".concat(widgetName);
|
|
31
22
|
};
|
|
32
|
-
|
|
33
23
|
var getWidgetData = function getWidgetData(el, dataKey) {
|
|
34
24
|
var widget = jQuery.data(el, dataKey);
|
|
35
|
-
|
|
36
25
|
if (widget && widget instanceof SimpleWidget) {
|
|
37
26
|
return widget;
|
|
38
27
|
} else {
|
|
39
28
|
return null;
|
|
40
29
|
}
|
|
41
30
|
};
|
|
42
|
-
|
|
43
31
|
var createWidget = function createWidget($el, options) {
|
|
44
32
|
var dataKey = getDataKey();
|
|
45
|
-
|
|
46
33
|
var _iterator = _createForOfIteratorHelper($el.get()),
|
|
47
|
-
|
|
48
|
-
|
|
34
|
+
_step;
|
|
49
35
|
try {
|
|
50
36
|
for (_iterator.s(); !(_step = _iterator.n()).done;) {
|
|
51
37
|
var el = _step.value;
|
|
52
38
|
var existingWidget = getWidgetData(el, dataKey);
|
|
53
|
-
|
|
54
39
|
if (!existingWidget) {
|
|
55
40
|
var simpleWidgetClass = widgetClass;
|
|
56
41
|
var widget = new simpleWidgetClass(el, options);
|
|
57
|
-
|
|
58
42
|
if (!jQuery.data(el, dataKey)) {
|
|
59
43
|
jQuery.data(el, dataKey, widget);
|
|
60
|
-
}
|
|
61
|
-
|
|
44
|
+
}
|
|
62
45
|
|
|
46
|
+
// Call init after setting data, so we can call methods
|
|
63
47
|
widget.init();
|
|
64
48
|
}
|
|
65
49
|
}
|
|
@@ -68,25 +52,19 @@ var _register = function register(widgetClass, widgetName) {
|
|
|
68
52
|
} finally {
|
|
69
53
|
_iterator.f();
|
|
70
54
|
}
|
|
71
|
-
|
|
72
55
|
return $el;
|
|
73
56
|
};
|
|
74
|
-
|
|
75
57
|
var destroyWidget = function destroyWidget($el) {
|
|
76
58
|
var dataKey = getDataKey();
|
|
77
|
-
|
|
78
59
|
var _iterator2 = _createForOfIteratorHelper($el.get()),
|
|
79
|
-
|
|
80
|
-
|
|
60
|
+
_step2;
|
|
81
61
|
try {
|
|
82
62
|
for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
|
|
83
63
|
var el = _step2.value;
|
|
84
64
|
var widget = getWidgetData(el, dataKey);
|
|
85
|
-
|
|
86
65
|
if (widget) {
|
|
87
66
|
widget.destroy();
|
|
88
67
|
}
|
|
89
|
-
|
|
90
68
|
jQuery.removeData(el, dataKey);
|
|
91
69
|
}
|
|
92
70
|
} catch (err) {
|
|
@@ -95,22 +73,17 @@ var _register = function register(widgetClass, widgetName) {
|
|
|
95
73
|
_iterator2.f();
|
|
96
74
|
}
|
|
97
75
|
};
|
|
98
|
-
|
|
99
76
|
var callFunction = function callFunction($el, functionName, args) {
|
|
100
77
|
var result = null;
|
|
101
|
-
|
|
102
78
|
var _iterator3 = _createForOfIteratorHelper($el.get()),
|
|
103
|
-
|
|
104
|
-
|
|
79
|
+
_step3;
|
|
105
80
|
try {
|
|
106
81
|
for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
|
|
107
82
|
var el = _step3.value;
|
|
108
83
|
var widget = jQuery.data(el, getDataKey());
|
|
109
|
-
|
|
110
84
|
if (widget && widget instanceof SimpleWidget) {
|
|
111
85
|
var simpleWidget = widget;
|
|
112
86
|
var widgetFunction = simpleWidget[functionName];
|
|
113
|
-
|
|
114
87
|
if (widgetFunction && typeof widgetFunction === "function") {
|
|
115
88
|
result = widgetFunction.apply(widget, args);
|
|
116
89
|
}
|
|
@@ -121,11 +94,10 @@ var _register = function register(widgetClass, widgetName) {
|
|
|
121
94
|
} finally {
|
|
122
95
|
_iterator3.f();
|
|
123
96
|
}
|
|
124
|
-
|
|
125
97
|
return result;
|
|
126
|
-
};
|
|
127
|
-
|
|
98
|
+
};
|
|
128
99
|
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
129
101
|
jQuery.fn[widgetName] = function (argument1) {
|
|
130
102
|
if (!argument1) {
|
|
131
103
|
return createWidget(this, null);
|
|
@@ -134,7 +106,6 @@ var _register = function register(widgetClass, widgetName) {
|
|
|
134
106
|
return createWidget(this, options);
|
|
135
107
|
} else if (typeof argument1 === "string" && argument1[0] !== "_") {
|
|
136
108
|
var functionName = argument1;
|
|
137
|
-
|
|
138
109
|
if (functionName === "destroy") {
|
|
139
110
|
return destroyWidget(this);
|
|
140
111
|
} else if (functionName === "get_widget_class") {
|
|
@@ -143,27 +114,22 @@ var _register = function register(widgetClass, widgetName) {
|
|
|
143
114
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
144
115
|
args[_key - 1] = arguments[_key];
|
|
145
116
|
}
|
|
146
|
-
|
|
147
117
|
return callFunction(this, functionName, args);
|
|
148
118
|
}
|
|
149
119
|
}
|
|
150
120
|
};
|
|
151
121
|
};
|
|
152
|
-
|
|
153
122
|
var SimpleWidget = /*#__PURE__*/function () {
|
|
154
123
|
function SimpleWidget(el, options) {
|
|
155
124
|
_classCallCheck(this, SimpleWidget);
|
|
156
|
-
|
|
157
125
|
_defineProperty(this, "options", void 0);
|
|
158
|
-
|
|
159
126
|
_defineProperty(this, "$el", void 0);
|
|
127
|
+
this.$el = jQuery(el);
|
|
160
128
|
|
|
161
|
-
|
|
162
|
-
|
|
129
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
163
130
|
var defaults = this.constructor["defaults"];
|
|
164
131
|
this.options = _objectSpread(_objectSpread({}, defaults), options);
|
|
165
132
|
}
|
|
166
|
-
|
|
167
133
|
_createClass(SimpleWidget, [{
|
|
168
134
|
key: "destroy",
|
|
169
135
|
value: function destroy() {
|
|
@@ -171,11 +137,13 @@ var SimpleWidget = /*#__PURE__*/function () {
|
|
|
171
137
|
}
|
|
172
138
|
}, {
|
|
173
139
|
key: "init",
|
|
174
|
-
value: function init() {
|
|
140
|
+
value: function init() {
|
|
141
|
+
//
|
|
175
142
|
}
|
|
176
143
|
}, {
|
|
177
144
|
key: "deinit",
|
|
178
|
-
value: function deinit() {
|
|
145
|
+
value: function deinit() {
|
|
146
|
+
//
|
|
179
147
|
}
|
|
180
148
|
}], [{
|
|
181
149
|
key: "register",
|
|
@@ -183,10 +151,7 @@ var SimpleWidget = /*#__PURE__*/function () {
|
|
|
183
151
|
_register(widgetClass, widgetName);
|
|
184
152
|
}
|
|
185
153
|
}]);
|
|
186
|
-
|
|
187
154
|
return SimpleWidget;
|
|
188
155
|
}();
|
|
189
|
-
|
|
190
156
|
exports["default"] = SimpleWidget;
|
|
191
|
-
|
|
192
157
|
_defineProperty(SimpleWidget, "defaults", {});
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _givens = _interopRequireDefault(require("givens"));
|
|
4
|
-
|
|
5
4
|
require("../../tree.jquery");
|
|
6
|
-
|
|
7
5
|
var _exampleData = _interopRequireDefault(require("../support/exampleData"));
|
|
8
|
-
|
|
9
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
-
|
|
11
7
|
beforeEach(function () {
|
|
12
8
|
$("body").append('<div id="tree1"></div>');
|
|
13
9
|
});
|
|
@@ -1,19 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _givens = _interopRequireDefault(require("givens"));
|
|
4
|
-
|
|
5
4
|
var _msw = require("msw");
|
|
6
|
-
|
|
7
5
|
var _node = require("msw/node");
|
|
8
|
-
|
|
9
6
|
require("../../tree.jquery");
|
|
10
|
-
|
|
11
7
|
var _exampleData = _interopRequireDefault(require("../support/exampleData"));
|
|
12
|
-
|
|
13
8
|
var _testUtil = require("../support/testUtil");
|
|
14
|
-
|
|
15
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
|
-
|
|
17
10
|
var context = describe;
|
|
18
11
|
var server = (0, _node.setupServer)();
|
|
19
12
|
beforeAll(function () {
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _givens = _interopRequireDefault(require("givens"));
|
|
4
|
-
|
|
5
4
|
require("../../tree.jquery");
|
|
6
|
-
|
|
7
5
|
var _exampleData = _interopRequireDefault(require("../support/exampleData"));
|
|
8
|
-
|
|
9
6
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
10
|
-
|
|
11
7
|
var context = describe;
|
|
12
8
|
beforeEach(function () {
|
|
13
9
|
$("body").append('<div id="tree1"></div>');
|
|
@@ -39,11 +35,9 @@ describe("keyboard support", function () {
|
|
|
39
35
|
autoOpen: given.autoOpen,
|
|
40
36
|
data: _exampleData["default"]
|
|
41
37
|
});
|
|
42
|
-
|
|
43
38
|
if (given.initialSelectedNode) {
|
|
44
39
|
given.$tree.tree("selectNode", given.initialSelectedNode);
|
|
45
40
|
}
|
|
46
|
-
|
|
47
41
|
given.$tree.trigger($.Event("keydown", {
|
|
48
42
|
which: given.pressedKey
|
|
49
43
|
}));
|
|
@@ -1,27 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
-
|
|
5
4
|
var _givens = _interopRequireDefault(require("givens"));
|
|
6
|
-
|
|
7
5
|
var _dom = require("@testing-library/dom");
|
|
8
|
-
|
|
9
6
|
var _msw = require("msw");
|
|
10
|
-
|
|
11
7
|
var _node = require("msw/node");
|
|
12
|
-
|
|
13
8
|
require("../../tree.jquery");
|
|
14
|
-
|
|
15
9
|
var _testUtil = require("../support/testUtil");
|
|
16
|
-
|
|
17
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
18
|
-
|
|
19
|
-
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
20
|
-
|
|
11
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
21
12
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
22
|
-
|
|
23
13
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
24
|
-
|
|
25
14
|
var context = describe;
|
|
26
15
|
var server = (0, _node.setupServer)();
|
|
27
16
|
beforeAll(function () {
|
|
@@ -56,7 +45,6 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
56
45
|
beforeEach(function () {
|
|
57
46
|
server.use(_msw.rest.get("/tree/", function (request, response, ctx) {
|
|
58
47
|
var parentId = request.url.searchParams.get("node");
|
|
59
|
-
|
|
60
48
|
if (parentId === "1") {
|
|
61
49
|
return response(ctx.status(200), ctx.json([{
|
|
62
50
|
id: 2,
|
|
@@ -71,7 +59,6 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
71
59
|
if (given.savedState) {
|
|
72
60
|
localStorage.setItem("tree", given.savedState);
|
|
73
61
|
}
|
|
74
|
-
|
|
75
62
|
given.$tree.tree({
|
|
76
63
|
autoOpen: given.autoOpen,
|
|
77
64
|
data: initialData,
|
|
@@ -92,26 +79,22 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
92
79
|
});
|
|
93
80
|
it("loads the subtree", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
94
81
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
95
|
-
while (1) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
case 4:
|
|
112
|
-
case "end":
|
|
113
|
-
return _context.stop();
|
|
114
|
-
}
|
|
82
|
+
while (1) switch (_context.prev = _context.next) {
|
|
83
|
+
case 0:
|
|
84
|
+
(0, _testUtil.togglerLink)(given.node.element).trigger("click");
|
|
85
|
+
_context.next = 3;
|
|
86
|
+
return _dom.screen.findByText("loaded-on-demand");
|
|
87
|
+
case 3:
|
|
88
|
+
expect(given.$tree).toHaveTreeStructure([expect.objectContaining({
|
|
89
|
+
name: "parent-node",
|
|
90
|
+
open: true,
|
|
91
|
+
children: [expect.objectContaining({
|
|
92
|
+
name: "loaded-on-demand"
|
|
93
|
+
})]
|
|
94
|
+
})]);
|
|
95
|
+
case 4:
|
|
96
|
+
case "end":
|
|
97
|
+
return _context.stop();
|
|
115
98
|
}
|
|
116
99
|
}, _callee);
|
|
117
100
|
})));
|
|
@@ -121,23 +104,19 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
121
104
|
});
|
|
122
105
|
it("keeps the node selected and focused", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
123
106
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
124
|
-
while (1) {
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
case 7:
|
|
138
|
-
case "end":
|
|
139
|
-
return _context2.stop();
|
|
140
|
-
}
|
|
107
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
108
|
+
case 0:
|
|
109
|
+
expect(given.node.element).toBeSelected();
|
|
110
|
+
expect(given.node.element).toBeFocused();
|
|
111
|
+
(0, _testUtil.togglerLink)(given.node.element).trigger("click");
|
|
112
|
+
_context2.next = 5;
|
|
113
|
+
return _dom.screen.findByText("loaded-on-demand");
|
|
114
|
+
case 5:
|
|
115
|
+
expect(given.node.element).toBeSelected();
|
|
116
|
+
expect(given.node.element).toBeFocused();
|
|
117
|
+
case 7:
|
|
118
|
+
case "end":
|
|
119
|
+
return _context2.stop();
|
|
141
120
|
}
|
|
142
121
|
}, _callee2);
|
|
143
122
|
})));
|
|
@@ -145,21 +124,17 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
145
124
|
context("when the node is not selected", function () {
|
|
146
125
|
it("doesn't select the node", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
147
126
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
148
|
-
while (1) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
case 5:
|
|
160
|
-
case "end":
|
|
161
|
-
return _context3.stop();
|
|
162
|
-
}
|
|
127
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
128
|
+
case 0:
|
|
129
|
+
expect(given.node.element).not.toBeSelected();
|
|
130
|
+
(0, _testUtil.togglerLink)(given.node.element).trigger("click");
|
|
131
|
+
_context3.next = 4;
|
|
132
|
+
return _dom.screen.findByText("loaded-on-demand");
|
|
133
|
+
case 4:
|
|
134
|
+
expect(given.node.element).not.toBeSelected();
|
|
135
|
+
case 5:
|
|
136
|
+
case "end":
|
|
137
|
+
return _context3.stop();
|
|
163
138
|
}
|
|
164
139
|
}, _callee3);
|
|
165
140
|
})));
|
|
@@ -171,23 +146,19 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
171
146
|
});
|
|
172
147
|
it("keeps the node selected and not focused", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
173
148
|
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
174
|
-
while (1) {
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
case 7:
|
|
188
|
-
case "end":
|
|
189
|
-
return _context4.stop();
|
|
190
|
-
}
|
|
149
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
150
|
+
case 0:
|
|
151
|
+
expect(given.node.element).toBeSelected();
|
|
152
|
+
expect(given.node.element).not.toBeFocused();
|
|
153
|
+
(0, _testUtil.togglerLink)(given.node.element).trigger("click");
|
|
154
|
+
_context4.next = 5;
|
|
155
|
+
return _dom.screen.findByText("loaded-on-demand");
|
|
156
|
+
case 5:
|
|
157
|
+
expect(given.node.element).toBeSelected();
|
|
158
|
+
expect(given.node.element).not.toBeFocused();
|
|
159
|
+
case 7:
|
|
160
|
+
case "end":
|
|
161
|
+
return _context4.stop();
|
|
191
162
|
}
|
|
192
163
|
}, _callee4);
|
|
193
164
|
})));
|
|
@@ -199,25 +170,21 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
199
170
|
});
|
|
200
171
|
it("loads the node on demand", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
201
172
|
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
202
|
-
while (1) {
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
case 3:
|
|
218
|
-
case "end":
|
|
219
|
-
return _context5.stop();
|
|
220
|
-
}
|
|
173
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
174
|
+
case 0:
|
|
175
|
+
_context5.next = 2;
|
|
176
|
+
return _dom.screen.findByText("loaded-on-demand");
|
|
177
|
+
case 2:
|
|
178
|
+
expect(given.$tree).toHaveTreeStructure([expect.objectContaining({
|
|
179
|
+
name: "parent-node",
|
|
180
|
+
open: true,
|
|
181
|
+
children: [expect.objectContaining({
|
|
182
|
+
name: "loaded-on-demand"
|
|
183
|
+
})]
|
|
184
|
+
})]);
|
|
185
|
+
case 3:
|
|
186
|
+
case "end":
|
|
187
|
+
return _context5.stop();
|
|
221
188
|
}
|
|
222
189
|
}, _callee5);
|
|
223
190
|
})));
|
|
@@ -228,25 +195,21 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
228
195
|
});
|
|
229
196
|
it("opens the node and loads its children on demand", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
230
197
|
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
231
|
-
while (1) {
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
case 3:
|
|
247
|
-
case "end":
|
|
248
|
-
return _context6.stop();
|
|
249
|
-
}
|
|
198
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
199
|
+
case 0:
|
|
200
|
+
_context6.next = 2;
|
|
201
|
+
return _dom.screen.findByText("loaded-on-demand");
|
|
202
|
+
case 2:
|
|
203
|
+
expect(given.$tree).toHaveTreeStructure([expect.objectContaining({
|
|
204
|
+
name: "parent-node",
|
|
205
|
+
open: true,
|
|
206
|
+
children: [expect.objectContaining({
|
|
207
|
+
name: "loaded-on-demand"
|
|
208
|
+
})]
|
|
209
|
+
})]);
|
|
210
|
+
case 3:
|
|
211
|
+
case "end":
|
|
212
|
+
return _context6.stop();
|
|
250
213
|
}
|
|
251
214
|
}, _callee6);
|
|
252
215
|
})));
|