jqtree 1.7.4 → 1.8.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/.eslintrc +5 -1
- package/bower.json +1 -1
- package/config/babel.config.json +1 -1
- package/config/production +2 -0
- package/devserver/devserver_scroll.js +8 -0
- package/devserver/test_scroll.html +28 -0
- package/devserver/test_scroll_container.html +39 -0
- package/docs/_config.yml +1 -1
- package/docs/_entries/general/changelog.md +12 -0
- package/docs/package.json +1 -1
- package/docs/pnpm-lock.yaml +30 -30
- package/package.json +31 -27
- package/src/dataLoader.ts +44 -19
- package/src/dragAndDropHandler/dragElement.ts +42 -0
- package/src/dragAndDropHandler/hitAreasGenerator.ts +175 -0
- package/src/dragAndDropHandler/index.ts +470 -0
- package/src/dragAndDropHandler/types.ts +12 -0
- package/src/dragAndDropHandler/visibleNodeIterator.ts +97 -0
- package/src/elementsRenderer.ts +75 -40
- package/src/jqtreeMethodTypes.ts +40 -0
- package/src/jqtreeOptions.ts +43 -25
- package/src/keyHandler.ts +59 -38
- package/src/mouse.widget.ts +3 -3
- package/src/mouseWidgetTypes.ts +6 -0
- package/src/node.ts +32 -48
- package/src/nodeElement/borderDropHint.ts +32 -0
- package/src/nodeElement/folderElement.ts +133 -0
- package/src/nodeElement/ghostDropHint.ts +68 -0
- package/src/nodeElement/index.ts +101 -0
- package/src/nodeUtils.ts +10 -0
- package/src/playwright/coverage.ts +1 -4
- package/src/playwright/playwright.test.ts +203 -15
- package/src/playwright/testUtils.ts +23 -15
- package/src/saveStateHandler.ts +75 -26
- package/src/scrollHandler/containerScrollParent.ts +177 -0
- package/src/scrollHandler/createScrollParent.ts +50 -0
- package/src/scrollHandler/documentScrollParent.ts +182 -0
- package/src/scrollHandler/types.ts +7 -0
- package/src/scrollHandler.ts +36 -248
- package/src/selectNodeHandler.ts +10 -16
- package/src/test/jqTree/keyboard.test.ts +18 -23
- package/src/test/jqTree/loadOnDemand.test.ts +2 -3
- package/src/test/jqTree/methods.test.ts +33 -4
- package/src/test/jqTree/options.test.ts +15 -4
- package/src/test/node.test.ts +85 -26
- package/src/test/nodeUtils.test.ts +21 -0
- package/src/tree.jquery.ts +262 -83
- package/src/util.ts +3 -0
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +1922 -2608
- package/tree.jquery.debug.js.map +1 -1
- package/tree.jquery.js +2 -2
- package/tree.jquery.js.map +1 -1
- package/lib/dataLoader.js +0 -124
- package/lib/dragAndDropHandler.js +0 -596
- package/lib/elementsRenderer.js +0 -268
- package/lib/jqtreeOptions.js +0 -1
- package/lib/keyHandler.js +0 -115
- package/lib/mouse.widget.js +0 -256
- package/lib/node.js +0 -717
- package/lib/nodeElement.js +0 -277
- package/lib/playwright/coverage.js +0 -96
- package/lib/playwright/playwright.test.js +0 -228
- package/lib/playwright/testUtils.js +0 -184
- package/lib/saveStateHandler.js +0 -278
- package/lib/scrollHandler.js +0 -250
- package/lib/selectNodeHandler.js +0 -129
- package/lib/simple.widget.js +0 -159
- package/lib/test/global.d.js +0 -3
- package/lib/test/jqTree/accessibility.test.js +0 -37
- package/lib/test/jqTree/create.test.js +0 -48
- package/lib/test/jqTree/events.test.js +0 -210
- package/lib/test/jqTree/keyboard.test.js +0 -225
- package/lib/test/jqTree/loadOnDemand.test.js +0 -218
- package/lib/test/jqTree/methods.test.js +0 -1347
- package/lib/test/jqTree/options.test.js +0 -548
- package/lib/test/node.test.js +0 -1160
- package/lib/test/nodeUtil.test.js +0 -27
- package/lib/test/support/exampleData.js +0 -36
- package/lib/test/support/jqTreeMatchers.js +0 -70
- package/lib/test/support/matchers.d.js +0 -1
- package/lib/test/support/setupTests.js +0 -7
- package/lib/test/support/testUtil.js +0 -32
- package/lib/test/support/treeStructure.js +0 -39
- package/lib/test/util.test.js +0 -26
- package/lib/tree.jquery.d.js +0 -1
- package/lib/tree.jquery.js +0 -1106
- package/lib/types.js +0 -1
- package/lib/typings.d.js +0 -2
- package/lib/util.js +0 -18
- package/lib/version.js +0 -9
- package/src/dragAndDropHandler.ts +0 -719
- package/src/nodeElement.ts +0 -272
- package/src/types.ts +0 -19
package/lib/nodeElement.js
DELETED
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.NodeElement = exports.FolderElement = exports.BorderDropHint = void 0;
|
|
7
|
-
var _node = require("./node");
|
|
8
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
9
|
-
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
10
|
-
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
11
|
-
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
12
|
-
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
13
|
-
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
14
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
15
|
-
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
16
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
|
-
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); } }
|
|
18
|
-
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
19
|
-
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; }
|
|
20
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
21
|
-
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); }
|
|
22
|
-
var NodeElement = /*#__PURE__*/function () {
|
|
23
|
-
function NodeElement(node, treeWidget) {
|
|
24
|
-
_classCallCheck(this, NodeElement);
|
|
25
|
-
_defineProperty(this, "node", void 0);
|
|
26
|
-
_defineProperty(this, "$element", void 0);
|
|
27
|
-
_defineProperty(this, "treeWidget", void 0);
|
|
28
|
-
this.init(node, treeWidget);
|
|
29
|
-
}
|
|
30
|
-
_createClass(NodeElement, [{
|
|
31
|
-
key: "init",
|
|
32
|
-
value: function init(node, treeWidget) {
|
|
33
|
-
this.node = node;
|
|
34
|
-
this.treeWidget = treeWidget;
|
|
35
|
-
if (!node.element) {
|
|
36
|
-
var element = this.treeWidget.element.get(0);
|
|
37
|
-
if (element) {
|
|
38
|
-
node.element = element;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
if (node.element) {
|
|
42
|
-
this.$element = jQuery(node.element);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}, {
|
|
46
|
-
key: "addDropHint",
|
|
47
|
-
value: function addDropHint(position) {
|
|
48
|
-
if (this.mustShowBorderDropHint(position)) {
|
|
49
|
-
return new BorderDropHint(this.$element, this.treeWidget._getScrollLeft());
|
|
50
|
-
} else {
|
|
51
|
-
return new GhostDropHint(this.node, this.$element, position);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}, {
|
|
55
|
-
key: "select",
|
|
56
|
-
value: function select(mustSetFocus) {
|
|
57
|
-
var _this$treeWidget$opti;
|
|
58
|
-
var $li = this.getLi();
|
|
59
|
-
$li.addClass("jqtree-selected");
|
|
60
|
-
var $span = this.getSpan();
|
|
61
|
-
$span.attr("tabindex", (_this$treeWidget$opti = this.treeWidget.options.tabIndex) !== null && _this$treeWidget$opti !== void 0 ? _this$treeWidget$opti : null);
|
|
62
|
-
$span.attr("aria-selected", "true");
|
|
63
|
-
if (mustSetFocus) {
|
|
64
|
-
$span.trigger("focus");
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}, {
|
|
68
|
-
key: "deselect",
|
|
69
|
-
value: function deselect() {
|
|
70
|
-
var $li = this.getLi();
|
|
71
|
-
$li.removeClass("jqtree-selected");
|
|
72
|
-
var $span = this.getSpan();
|
|
73
|
-
$span.removeAttr("tabindex");
|
|
74
|
-
$span.attr("aria-selected", "false");
|
|
75
|
-
$span.trigger("blur");
|
|
76
|
-
}
|
|
77
|
-
}, {
|
|
78
|
-
key: "getUl",
|
|
79
|
-
value: function getUl() {
|
|
80
|
-
return this.$element.children("ul:first");
|
|
81
|
-
}
|
|
82
|
-
}, {
|
|
83
|
-
key: "getSpan",
|
|
84
|
-
value: function getSpan() {
|
|
85
|
-
return this.$element.children(".jqtree-element").find("span.jqtree-title");
|
|
86
|
-
}
|
|
87
|
-
}, {
|
|
88
|
-
key: "getLi",
|
|
89
|
-
value: function getLi() {
|
|
90
|
-
return this.$element;
|
|
91
|
-
}
|
|
92
|
-
}, {
|
|
93
|
-
key: "mustShowBorderDropHint",
|
|
94
|
-
value: function mustShowBorderDropHint(position) {
|
|
95
|
-
return position === _node.Position.Inside;
|
|
96
|
-
}
|
|
97
|
-
}]);
|
|
98
|
-
return NodeElement;
|
|
99
|
-
}();
|
|
100
|
-
exports.NodeElement = NodeElement;
|
|
101
|
-
var FolderElement = /*#__PURE__*/function (_NodeElement) {
|
|
102
|
-
_inherits(FolderElement, _NodeElement);
|
|
103
|
-
var _super = _createSuper(FolderElement);
|
|
104
|
-
function FolderElement() {
|
|
105
|
-
_classCallCheck(this, FolderElement);
|
|
106
|
-
return _super.apply(this, arguments);
|
|
107
|
-
}
|
|
108
|
-
_createClass(FolderElement, [{
|
|
109
|
-
key: "open",
|
|
110
|
-
value: function open(onFinished) {
|
|
111
|
-
var _this = this;
|
|
112
|
-
var slide = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
113
|
-
var animationSpeed = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : "fast";
|
|
114
|
-
if (this.node.is_open) {
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
|
-
this.node.is_open = true;
|
|
118
|
-
var $button = this.getButton();
|
|
119
|
-
$button.removeClass("jqtree-closed");
|
|
120
|
-
$button.html("");
|
|
121
|
-
var buttonEl = $button.get(0);
|
|
122
|
-
if (buttonEl) {
|
|
123
|
-
var openedIconElement = this.treeWidget.renderer.openedIconElement;
|
|
124
|
-
if (openedIconElement) {
|
|
125
|
-
var icon = openedIconElement.cloneNode(true);
|
|
126
|
-
buttonEl.appendChild(icon);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
var doOpen = function doOpen() {
|
|
130
|
-
var $li = _this.getLi();
|
|
131
|
-
$li.removeClass("jqtree-closed");
|
|
132
|
-
var $titleSpan = _this.getSpan();
|
|
133
|
-
$titleSpan.attr("aria-expanded", "true");
|
|
134
|
-
if (onFinished) {
|
|
135
|
-
onFinished(_this.node);
|
|
136
|
-
}
|
|
137
|
-
_this.treeWidget._triggerEvent("tree.open", {
|
|
138
|
-
node: _this.node
|
|
139
|
-
});
|
|
140
|
-
};
|
|
141
|
-
if (slide) {
|
|
142
|
-
this.getUl().slideDown(animationSpeed, doOpen);
|
|
143
|
-
} else {
|
|
144
|
-
this.getUl().show();
|
|
145
|
-
doOpen();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}, {
|
|
149
|
-
key: "close",
|
|
150
|
-
value: function close() {
|
|
151
|
-
var _this2 = this;
|
|
152
|
-
var slide = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
153
|
-
var animationSpeed = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "fast";
|
|
154
|
-
if (!this.node.is_open) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
this.node.is_open = false;
|
|
158
|
-
var $button = this.getButton();
|
|
159
|
-
$button.addClass("jqtree-closed");
|
|
160
|
-
$button.html("");
|
|
161
|
-
var buttonEl = $button.get(0);
|
|
162
|
-
if (buttonEl) {
|
|
163
|
-
var closedIconElement = this.treeWidget.renderer.closedIconElement;
|
|
164
|
-
if (closedIconElement) {
|
|
165
|
-
var icon = closedIconElement.cloneNode(true);
|
|
166
|
-
buttonEl.appendChild(icon);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
var doClose = function doClose() {
|
|
170
|
-
var $li = _this2.getLi();
|
|
171
|
-
$li.addClass("jqtree-closed");
|
|
172
|
-
var $titleSpan = _this2.getSpan();
|
|
173
|
-
$titleSpan.attr("aria-expanded", "false");
|
|
174
|
-
_this2.treeWidget._triggerEvent("tree.close", {
|
|
175
|
-
node: _this2.node
|
|
176
|
-
});
|
|
177
|
-
};
|
|
178
|
-
if (slide) {
|
|
179
|
-
this.getUl().slideUp(animationSpeed, doClose);
|
|
180
|
-
} else {
|
|
181
|
-
this.getUl().hide();
|
|
182
|
-
doClose();
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}, {
|
|
186
|
-
key: "mustShowBorderDropHint",
|
|
187
|
-
value: function mustShowBorderDropHint(position) {
|
|
188
|
-
return !this.node.is_open && position === _node.Position.Inside;
|
|
189
|
-
}
|
|
190
|
-
}, {
|
|
191
|
-
key: "getButton",
|
|
192
|
-
value: function getButton() {
|
|
193
|
-
return this.$element.children(".jqtree-element").find("a.jqtree-toggler");
|
|
194
|
-
}
|
|
195
|
-
}]);
|
|
196
|
-
return FolderElement;
|
|
197
|
-
}(NodeElement);
|
|
198
|
-
exports.FolderElement = FolderElement;
|
|
199
|
-
var BorderDropHint = /*#__PURE__*/function () {
|
|
200
|
-
function BorderDropHint($element, scrollLeft) {
|
|
201
|
-
_classCallCheck(this, BorderDropHint);
|
|
202
|
-
_defineProperty(this, "$hint", void 0);
|
|
203
|
-
var $div = $element.children(".jqtree-element");
|
|
204
|
-
var elWidth = $element.width() || 0;
|
|
205
|
-
var width = Math.max(elWidth + scrollLeft - 4, 0);
|
|
206
|
-
var elHeight = $div.outerHeight() || 0;
|
|
207
|
-
var height = Math.max(elHeight - 4, 0);
|
|
208
|
-
this.$hint = jQuery('<span class="jqtree-border"></span>');
|
|
209
|
-
$div.append(this.$hint);
|
|
210
|
-
this.$hint.css({
|
|
211
|
-
width: width,
|
|
212
|
-
height: height
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
_createClass(BorderDropHint, [{
|
|
216
|
-
key: "remove",
|
|
217
|
-
value: function remove() {
|
|
218
|
-
this.$hint.remove();
|
|
219
|
-
}
|
|
220
|
-
}]);
|
|
221
|
-
return BorderDropHint;
|
|
222
|
-
}();
|
|
223
|
-
exports.BorderDropHint = BorderDropHint;
|
|
224
|
-
var GhostDropHint = /*#__PURE__*/function () {
|
|
225
|
-
function GhostDropHint(node, $element, position) {
|
|
226
|
-
_classCallCheck(this, GhostDropHint);
|
|
227
|
-
_defineProperty(this, "$element", void 0);
|
|
228
|
-
_defineProperty(this, "node", void 0);
|
|
229
|
-
_defineProperty(this, "$ghost", void 0);
|
|
230
|
-
this.$element = $element;
|
|
231
|
-
this.node = node;
|
|
232
|
-
this.$ghost = jQuery("<li class=\"jqtree_common jqtree-ghost\"><span class=\"jqtree_common jqtree-circle\"></span>\n <span class=\"jqtree_common jqtree-line\"></span></li>");
|
|
233
|
-
if (position === _node.Position.After) {
|
|
234
|
-
this.moveAfter();
|
|
235
|
-
} else if (position === _node.Position.Before) {
|
|
236
|
-
this.moveBefore();
|
|
237
|
-
} else if (position === _node.Position.Inside) {
|
|
238
|
-
if (node.isFolder() && node.is_open) {
|
|
239
|
-
this.moveInsideOpenFolder();
|
|
240
|
-
} else {
|
|
241
|
-
this.moveInside();
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}
|
|
245
|
-
_createClass(GhostDropHint, [{
|
|
246
|
-
key: "remove",
|
|
247
|
-
value: function remove() {
|
|
248
|
-
this.$ghost.remove();
|
|
249
|
-
}
|
|
250
|
-
}, {
|
|
251
|
-
key: "moveAfter",
|
|
252
|
-
value: function moveAfter() {
|
|
253
|
-
this.$element.after(this.$ghost);
|
|
254
|
-
}
|
|
255
|
-
}, {
|
|
256
|
-
key: "moveBefore",
|
|
257
|
-
value: function moveBefore() {
|
|
258
|
-
this.$element.before(this.$ghost);
|
|
259
|
-
}
|
|
260
|
-
}, {
|
|
261
|
-
key: "moveInsideOpenFolder",
|
|
262
|
-
value: function moveInsideOpenFolder() {
|
|
263
|
-
var _this$node$children$;
|
|
264
|
-
var childElement = (_this$node$children$ = this.node.children[0]) === null || _this$node$children$ === void 0 ? void 0 : _this$node$children$.element;
|
|
265
|
-
if (childElement) {
|
|
266
|
-
jQuery(childElement).before(this.$ghost);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}, {
|
|
270
|
-
key: "moveInside",
|
|
271
|
-
value: function moveInside() {
|
|
272
|
-
this.$element.after(this.$ghost);
|
|
273
|
-
this.$ghost.addClass("jqtree-inside");
|
|
274
|
-
}
|
|
275
|
-
}]);
|
|
276
|
-
return GhostDropHint;
|
|
277
|
-
}();
|
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
Object.defineProperty(exports, "__esModule", {
|
|
5
|
-
value: true
|
|
6
|
-
});
|
|
7
|
-
exports.saveCoverage = exports.initCoverage = void 0;
|
|
8
|
-
var _fs = _interopRequireDefault(require("fs"));
|
|
9
|
-
var _path = _interopRequireDefault(require("path"));
|
|
10
|
-
var _crypto = _interopRequireDefault(require("crypto"));
|
|
11
|
-
var _ref, _ref2;
|
|
12
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
-
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; } } }; }
|
|
14
|
-
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); }
|
|
15
|
-
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; }
|
|
16
|
-
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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
17
|
-
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); } }
|
|
18
|
-
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); }); }; }
|
|
19
|
-
var istanbulCLIOutput = _path["default"].join(process.cwd(), ".nyc_output");
|
|
20
|
-
var generateUUID = function generateUUID() {
|
|
21
|
-
return _crypto["default"].randomBytes(16).toString("hex");
|
|
22
|
-
};
|
|
23
|
-
var initCoverage = function initCoverage(_x) {
|
|
24
|
-
return (_ref = _ref || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(context) {
|
|
25
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
26
|
-
while (1) switch (_context.prev = _context.next) {
|
|
27
|
-
case 0:
|
|
28
|
-
_context.next = 2;
|
|
29
|
-
return _fs["default"].promises.mkdir(istanbulCLIOutput, {
|
|
30
|
-
recursive: true
|
|
31
|
-
});
|
|
32
|
-
case 2:
|
|
33
|
-
_context.next = 4;
|
|
34
|
-
return context.exposeFunction("collectIstanbulCoverage", function (coverageJSON) {
|
|
35
|
-
if (!coverageJSON) {
|
|
36
|
-
console.log("No coverage");
|
|
37
|
-
} else {
|
|
38
|
-
var filename = _path["default"].join(istanbulCLIOutput, "playwright_coverage_".concat(generateUUID(), ".json"));
|
|
39
|
-
console.log("Writing coverage to ".concat(filename));
|
|
40
|
-
_fs["default"].writeFileSync(filename, coverageJSON);
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
case 4:
|
|
44
|
-
case "end":
|
|
45
|
-
return _context.stop();
|
|
46
|
-
}
|
|
47
|
-
}, _callee);
|
|
48
|
-
}))).apply(this, arguments);
|
|
49
|
-
};
|
|
50
|
-
exports.initCoverage = initCoverage;
|
|
51
|
-
var saveCoverage = function saveCoverage(_x2) {
|
|
52
|
-
return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(context) {
|
|
53
|
-
var _iterator, _step, page;
|
|
54
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
55
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
56
|
-
case 0:
|
|
57
|
-
_iterator = _createForOfIteratorHelper(context.pages());
|
|
58
|
-
_context2.prev = 1;
|
|
59
|
-
_iterator.s();
|
|
60
|
-
case 3:
|
|
61
|
-
if ((_step = _iterator.n()).done) {
|
|
62
|
-
_context2.next = 9;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
page = _step.value;
|
|
66
|
-
_context2.next = 7;
|
|
67
|
-
return page.evaluate(function () {
|
|
68
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
69
|
-
var anyWindow = window;
|
|
70
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
|
|
71
|
-
var coverageData = anyWindow.__coverage__;
|
|
72
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
|
|
73
|
-
anyWindow.collectIstanbulCoverage(JSON.stringify(coverageData));
|
|
74
|
-
});
|
|
75
|
-
case 7:
|
|
76
|
-
_context2.next = 3;
|
|
77
|
-
break;
|
|
78
|
-
case 9:
|
|
79
|
-
_context2.next = 14;
|
|
80
|
-
break;
|
|
81
|
-
case 11:
|
|
82
|
-
_context2.prev = 11;
|
|
83
|
-
_context2.t0 = _context2["catch"](1);
|
|
84
|
-
_iterator.e(_context2.t0);
|
|
85
|
-
case 14:
|
|
86
|
-
_context2.prev = 14;
|
|
87
|
-
_iterator.f();
|
|
88
|
-
return _context2.finish(14);
|
|
89
|
-
case 17:
|
|
90
|
-
case "end":
|
|
91
|
-
return _context2.stop();
|
|
92
|
-
}
|
|
93
|
-
}, _callee2, null, [[1, 11, 14, 17]]);
|
|
94
|
-
}))).apply(this, arguments);
|
|
95
|
-
};
|
|
96
|
-
exports.saveCoverage = saveCoverage;
|
|
@@ -1,228 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
4
|
-
var _test = require("@playwright/test");
|
|
5
|
-
var _testUtils = require("./testUtils");
|
|
6
|
-
var _coverage = require("./coverage");
|
|
7
|
-
var _ref2, _ref4, _ref6;
|
|
8
|
-
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 e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator["return"] && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, "catch": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
9
|
-
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); } }
|
|
10
|
-
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); }); }; }
|
|
11
|
-
var initPage = function initPage(_x) {
|
|
12
|
-
return (_ref2 = _ref2 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(_ref) {
|
|
13
|
-
var baseURL, dragAndDrop, page;
|
|
14
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
15
|
-
while (1) switch (_context.prev = _context.next) {
|
|
16
|
-
case 0:
|
|
17
|
-
baseURL = _ref.baseURL, dragAndDrop = _ref.dragAndDrop, page = _ref.page;
|
|
18
|
-
if (baseURL) {
|
|
19
|
-
_context.next = 3;
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
throw new Error("Missing baseURL");
|
|
23
|
-
case 3:
|
|
24
|
-
_context.next = 5;
|
|
25
|
-
return page["goto"]("".concat(baseURL, "/test_index.html"));
|
|
26
|
-
case 5:
|
|
27
|
-
_context.next = 7;
|
|
28
|
-
return page.waitForLoadState("domcontentloaded");
|
|
29
|
-
case 7:
|
|
30
|
-
page.on("console", function (msg) {
|
|
31
|
-
return console.log("console: ".concat(msg.text()));
|
|
32
|
-
});
|
|
33
|
-
_context.next = 10;
|
|
34
|
-
return page.evaluate("\n const $tree = jQuery(\"#tree1\");\n\n $tree.tree({\n animationSpeed: 0,\n autoOpen: 0,\n data: ExampleData.exampleData,\n dragAndDrop: ".concat(dragAndDrop, ",\n startDndDelay: 100,\n });\n "));
|
|
35
|
-
case 10:
|
|
36
|
-
_context.next = 12;
|
|
37
|
-
return page.evaluate("\n console.log(window.__coverage__ ? 'Coverage enabled' : 'Coverage not enabled');\n ");
|
|
38
|
-
case 12:
|
|
39
|
-
case "end":
|
|
40
|
-
return _context.stop();
|
|
41
|
-
}
|
|
42
|
-
}, _callee);
|
|
43
|
-
}))).apply(this, arguments);
|
|
44
|
-
};
|
|
45
|
-
_test.test.beforeEach(function (_x2) {
|
|
46
|
-
return (_ref4 = _ref4 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(_ref3) {
|
|
47
|
-
var context;
|
|
48
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
49
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
50
|
-
case 0:
|
|
51
|
-
context = _ref3.context;
|
|
52
|
-
_context2.next = 3;
|
|
53
|
-
return (0, _coverage.initCoverage)(context);
|
|
54
|
-
case 3:
|
|
55
|
-
case "end":
|
|
56
|
-
return _context2.stop();
|
|
57
|
-
}
|
|
58
|
-
}, _callee2);
|
|
59
|
-
}))).apply(this, arguments);
|
|
60
|
-
});
|
|
61
|
-
_test.test.afterEach(function (_x3) {
|
|
62
|
-
return (_ref6 = _ref6 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) {
|
|
63
|
-
var context;
|
|
64
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
65
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
66
|
-
case 0:
|
|
67
|
-
context = _ref5.context;
|
|
68
|
-
_context3.next = 3;
|
|
69
|
-
return (0, _coverage.saveCoverage)(context);
|
|
70
|
-
case 3:
|
|
71
|
-
case "end":
|
|
72
|
-
return _context3.stop();
|
|
73
|
-
}
|
|
74
|
-
}, _callee3);
|
|
75
|
-
}))).apply(this, arguments);
|
|
76
|
-
});
|
|
77
|
-
_test.test.describe("without dragAndDrop", function () {
|
|
78
|
-
var _ref8, _ref10, _ref12;
|
|
79
|
-
_test.test.beforeEach(function (_x4) {
|
|
80
|
-
return (_ref8 = _ref8 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref7) {
|
|
81
|
-
var baseURL, page;
|
|
82
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
83
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
84
|
-
case 0:
|
|
85
|
-
baseURL = _ref7.baseURL, page = _ref7.page;
|
|
86
|
-
_context4.next = 3;
|
|
87
|
-
return initPage({
|
|
88
|
-
baseURL: baseURL,
|
|
89
|
-
page: page,
|
|
90
|
-
dragAndDrop: false
|
|
91
|
-
});
|
|
92
|
-
case 3:
|
|
93
|
-
case "end":
|
|
94
|
-
return _context4.stop();
|
|
95
|
-
}
|
|
96
|
-
}, _callee4);
|
|
97
|
-
}))).apply(this, arguments);
|
|
98
|
-
});
|
|
99
|
-
(0, _test.test)("displays a tree", function (_x5) {
|
|
100
|
-
return (_ref10 = _ref10 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref9) {
|
|
101
|
-
var page, screenshot;
|
|
102
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
103
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
104
|
-
case 0:
|
|
105
|
-
page = _ref9.page;
|
|
106
|
-
_context5.next = 3;
|
|
107
|
-
return (0, _test.expect)(page.locator("body")).toHaveText(/.*Saurischia.*/);
|
|
108
|
-
case 3:
|
|
109
|
-
_context5.next = 5;
|
|
110
|
-
return (0, _test.expect)(page.locator("body")).toHaveText(/.*Ornithischians.*/);
|
|
111
|
-
case 5:
|
|
112
|
-
_context5.next = 7;
|
|
113
|
-
return (0, _test.expect)(page.locator("body")).toHaveText(/.*Coelophysoids.*/);
|
|
114
|
-
case 7:
|
|
115
|
-
_context5.next = 9;
|
|
116
|
-
return page.screenshot();
|
|
117
|
-
case 9:
|
|
118
|
-
screenshot = _context5.sent;
|
|
119
|
-
(0, _test.expect)(screenshot).toMatchSnapshot();
|
|
120
|
-
case 11:
|
|
121
|
-
case "end":
|
|
122
|
-
return _context5.stop();
|
|
123
|
-
}
|
|
124
|
-
}, _callee5);
|
|
125
|
-
}))).apply(this, arguments);
|
|
126
|
-
});
|
|
127
|
-
(0, _test.test)("selects a node", function (_x6) {
|
|
128
|
-
return (_ref12 = _ref12 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref11) {
|
|
129
|
-
var page, saurischia, screenshot;
|
|
130
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
131
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
132
|
-
case 0:
|
|
133
|
-
page = _ref11.page;
|
|
134
|
-
_context6.next = 3;
|
|
135
|
-
return (0, _test.expect)(page.locator("body")).toHaveText(/.*Saurischia.*/);
|
|
136
|
-
case 3:
|
|
137
|
-
_context6.next = 5;
|
|
138
|
-
return (0, _testUtils.findNodeElement)(page, "Saurischia");
|
|
139
|
-
case 5:
|
|
140
|
-
saurischia = _context6.sent;
|
|
141
|
-
_context6.next = 8;
|
|
142
|
-
return (0, _testUtils.selectNode)(saurischia);
|
|
143
|
-
case 8:
|
|
144
|
-
_context6.next = 10;
|
|
145
|
-
return page.screenshot();
|
|
146
|
-
case 10:
|
|
147
|
-
screenshot = _context6.sent;
|
|
148
|
-
(0, _test.expect)(screenshot).toMatchSnapshot();
|
|
149
|
-
case 12:
|
|
150
|
-
case "end":
|
|
151
|
-
return _context6.stop();
|
|
152
|
-
}
|
|
153
|
-
}, _callee6);
|
|
154
|
-
}))).apply(this, arguments);
|
|
155
|
-
});
|
|
156
|
-
});
|
|
157
|
-
_test.test.describe("with dragAndDrop", function () {
|
|
158
|
-
var _ref14, _ref16;
|
|
159
|
-
_test.test.beforeEach(function (_x7) {
|
|
160
|
-
return (_ref14 = _ref14 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref13) {
|
|
161
|
-
var baseURL, page;
|
|
162
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
163
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
164
|
-
case 0:
|
|
165
|
-
baseURL = _ref13.baseURL, page = _ref13.page;
|
|
166
|
-
_context7.next = 3;
|
|
167
|
-
return initPage({
|
|
168
|
-
baseURL: baseURL,
|
|
169
|
-
page: page,
|
|
170
|
-
dragAndDrop: true
|
|
171
|
-
});
|
|
172
|
-
case 3:
|
|
173
|
-
case "end":
|
|
174
|
-
return _context7.stop();
|
|
175
|
-
}
|
|
176
|
-
}, _callee7);
|
|
177
|
-
}))).apply(this, arguments);
|
|
178
|
-
});
|
|
179
|
-
(0, _test.test)("moves a node", function (_x8) {
|
|
180
|
-
return (_ref16 = _ref16 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref15) {
|
|
181
|
-
var page, structure, screenshot;
|
|
182
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
183
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
184
|
-
case 0:
|
|
185
|
-
page = _ref15.page;
|
|
186
|
-
_context8.next = 3;
|
|
187
|
-
return (0, _testUtils.dragAndDrop)(page, "Herrerasaurians", "Ornithischians");
|
|
188
|
-
case 3:
|
|
189
|
-
_context8.next = 5;
|
|
190
|
-
return (0, _testUtils.getTreeStructure)(page);
|
|
191
|
-
case 5:
|
|
192
|
-
structure = _context8.sent;
|
|
193
|
-
(0, _test.expect)(structure).toEqual([_test.expect.objectContaining({
|
|
194
|
-
name: "Saurischia",
|
|
195
|
-
children: [_test.expect.objectContaining({
|
|
196
|
-
name: "Theropods"
|
|
197
|
-
}), _test.expect.objectContaining({
|
|
198
|
-
name: "Sauropodomorphs"
|
|
199
|
-
})]
|
|
200
|
-
}), _test.expect.objectContaining({
|
|
201
|
-
name: "Ornithischians",
|
|
202
|
-
children: [_test.expect.objectContaining({
|
|
203
|
-
name: "Herrerasaurians"
|
|
204
|
-
}), _test.expect.objectContaining({
|
|
205
|
-
name: "Heterodontosaurids"
|
|
206
|
-
}), _test.expect.objectContaining({
|
|
207
|
-
name: "Thyreophorans"
|
|
208
|
-
}), _test.expect.objectContaining({
|
|
209
|
-
name: "Ornithopods"
|
|
210
|
-
}), _test.expect.objectContaining({
|
|
211
|
-
name: "Pachycephalosaurians"
|
|
212
|
-
}), _test.expect.objectContaining({
|
|
213
|
-
name: "Ceratopsians"
|
|
214
|
-
})]
|
|
215
|
-
})]);
|
|
216
|
-
_context8.next = 9;
|
|
217
|
-
return page.screenshot();
|
|
218
|
-
case 9:
|
|
219
|
-
screenshot = _context8.sent;
|
|
220
|
-
(0, _test.expect)(screenshot).toMatchSnapshot();
|
|
221
|
-
case 11:
|
|
222
|
-
case "end":
|
|
223
|
-
return _context8.stop();
|
|
224
|
-
}
|
|
225
|
-
}, _callee8);
|
|
226
|
-
}))).apply(this, arguments);
|
|
227
|
-
});
|
|
228
|
-
});
|