jqtree 1.7.4 → 1.7.5

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.
Files changed (59) hide show
  1. package/.eslintrc +5 -1
  2. package/bower.json +1 -1
  3. package/docs/_config.yml +1 -1
  4. package/docs/_entries/general/changelog.md +5 -0
  5. package/docs/package.json +1 -1
  6. package/docs/pnpm-lock.yaml +30 -30
  7. package/lib/dataLoader.js +2 -3
  8. package/lib/dragAndDropHandler.js +5 -13
  9. package/lib/elementsRenderer.js +2 -3
  10. package/lib/keyHandler.js +1 -5
  11. package/lib/mouse.widget.js +1 -2
  12. package/lib/node.js +30 -39
  13. package/lib/nodeElement.js +3 -6
  14. package/lib/nodeUtils.js +10 -0
  15. package/lib/playwright/coverage.js +14 -11
  16. package/lib/playwright/playwright.test.js +482 -104
  17. package/lib/playwright/testUtils.js +75 -49
  18. package/lib/saveStateHandler.js +2 -3
  19. package/lib/scrollHandler/containerScrollParent.js +160 -0
  20. package/lib/scrollHandler/createScrollParent.js +57 -0
  21. package/lib/scrollHandler/documentScrollParent.js +169 -0
  22. package/lib/scrollHandler/scrollParent.js +58 -0
  23. package/lib/scrollHandler/types.js +1 -0
  24. package/lib/scrollHandler.js +28 -207
  25. package/lib/selectNodeHandler.js +2 -3
  26. package/lib/simple.widget.js +1 -2
  27. package/lib/test/jqTree/loadOnDemand.test.js +3 -3
  28. package/lib/test/jqTree/methods.test.js +2 -1
  29. package/lib/test/jqTree/scrollHandler/containerScrollParent.test.js +94 -0
  30. package/lib/test/node.test.js +49 -7
  31. package/lib/test/nodeUtils.test.js +20 -0
  32. package/lib/test/support/exampleData.js +1 -2
  33. package/lib/test/support/testUtil.js +3 -6
  34. package/lib/test/support/treeStructure.js +1 -2
  35. package/lib/tree.jquery.js +6 -7
  36. package/lib/util.js +4 -7
  37. package/lib/version.js +2 -3
  38. package/package.json +27 -27
  39. package/src/dragAndDropHandler.ts +27 -33
  40. package/src/keyHandler.ts +0 -8
  41. package/src/node.ts +32 -48
  42. package/src/nodeUtils.ts +10 -0
  43. package/src/playwright/playwright.test.ts +207 -15
  44. package/src/playwright/testUtils.ts +23 -15
  45. package/src/scrollHandler/containerScrollParent.ts +177 -0
  46. package/src/scrollHandler/createScrollParent.ts +50 -0
  47. package/src/scrollHandler/documentScrollParent.ts +182 -0
  48. package/src/scrollHandler/types.ts +7 -0
  49. package/src/scrollHandler.ts +25 -243
  50. package/src/test/jqTree/loadOnDemand.test.ts +2 -3
  51. package/src/test/jqTree/methods.test.ts +1 -1
  52. package/src/test/node.test.ts +84 -25
  53. package/src/test/nodeUtils.test.ts +21 -0
  54. package/src/tree.jquery.ts +27 -30
  55. package/src/version.ts +1 -1
  56. package/tree.jquery.debug.js +391 -229
  57. package/tree.jquery.debug.js.map +1 -1
  58. package/tree.jquery.js +2 -2
  59. package/tree.jquery.js.map +1 -1
@@ -4,192 +4,226 @@ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" ==
4
4
  var _test = require("@playwright/test");
5
5
  var _testUtils = require("./testUtils");
6
6
  var _coverage = require("./coverage");
7
- var _ref2, _ref4, _ref6;
8
7
  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
8
  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
9
  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;
10
+ var initPage = /*#__PURE__*/function () {
11
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(page, baseURL) {
14
12
  return _regeneratorRuntime().wrap(function _callee$(_context) {
15
13
  while (1) switch (_context.prev = _context.next) {
16
14
  case 0:
17
- baseURL = _ref.baseURL, dragAndDrop = _ref.dragAndDrop, page = _ref.page;
18
15
  if (baseURL) {
19
- _context.next = 3;
16
+ _context.next = 2;
20
17
  break;
21
18
  }
22
19
  throw new Error("Missing baseURL");
23
- case 3:
24
- _context.next = 5;
20
+ case 2:
21
+ _context.next = 4;
25
22
  return page["goto"]("".concat(baseURL, "/test_index.html"));
26
- case 5:
27
- _context.next = 7;
23
+ case 4:
24
+ _context.next = 6;
28
25
  return page.waitForLoadState("domcontentloaded");
29
- case 7:
26
+ case 6:
30
27
  page.on("console", function (msg) {
31
28
  return console.log("console: ".concat(msg.text()));
32
29
  });
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;
30
+ _context.next = 9;
37
31
  return page.evaluate("\n console.log(window.__coverage__ ? 'Coverage enabled' : 'Coverage not enabled');\n ");
38
- case 12:
32
+ case 9:
39
33
  case "end":
40
34
  return _context.stop();
41
35
  }
42
36
  }, _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;
37
+ }));
38
+ return function initPage(_x, _x2) {
39
+ return _ref.apply(this, arguments);
40
+ };
41
+ }();
42
+ var initTree = /*#__PURE__*/function () {
43
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(page, _ref2) {
44
+ var autoOpen, dragAndDrop;
48
45
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
49
46
  while (1) switch (_context2.prev = _context2.next) {
50
47
  case 0:
51
- context = _ref3.context;
48
+ autoOpen = _ref2.autoOpen, dragAndDrop = _ref2.dragAndDrop;
52
49
  _context2.next = 3;
53
- return (0, _coverage.initCoverage)(context);
50
+ return page.evaluate("\n const $tree = jQuery(\"#tree1\");\n\n $tree.tree({\n animationSpeed: 0,\n autoOpen: ".concat(autoOpen || 0, ",\n data: ExampleData.exampleData,\n dragAndDrop: ").concat(dragAndDrop || false, ",\n startDndDelay: 100,\n });\n "));
54
51
  case 3:
55
52
  case "end":
56
53
  return _context2.stop();
57
54
  }
58
55
  }, _callee2);
59
- }))).apply(this, arguments);
60
- });
61
- _test.test.afterEach(function (_x3) {
62
- return (_ref6 = _ref6 || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref5) {
56
+ }));
57
+ return function initTree(_x3, _x4) {
58
+ return _ref3.apply(this, arguments);
59
+ };
60
+ }();
61
+ _test.test.beforeEach( /*#__PURE__*/function () {
62
+ var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(_ref4) {
63
63
  var context;
64
64
  return _regeneratorRuntime().wrap(function _callee3$(_context3) {
65
65
  while (1) switch (_context3.prev = _context3.next) {
66
66
  case 0:
67
- context = _ref5.context;
67
+ context = _ref4.context;
68
68
  _context3.next = 3;
69
- return (0, _coverage.saveCoverage)(context);
69
+ return (0, _coverage.initCoverage)(context);
70
70
  case 3:
71
71
  case "end":
72
72
  return _context3.stop();
73
73
  }
74
74
  }, _callee3);
75
- }))).apply(this, arguments);
76
- });
75
+ }));
76
+ return function (_x5) {
77
+ return _ref5.apply(this, arguments);
78
+ };
79
+ }());
80
+ _test.test.afterEach( /*#__PURE__*/function () {
81
+ var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(_ref6) {
82
+ var context;
83
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
84
+ while (1) switch (_context4.prev = _context4.next) {
85
+ case 0:
86
+ context = _ref6.context;
87
+ _context4.next = 3;
88
+ return (0, _coverage.saveCoverage)(context);
89
+ case 3:
90
+ case "end":
91
+ return _context4.stop();
92
+ }
93
+ }, _callee4);
94
+ }));
95
+ return function (_x6) {
96
+ return _ref7.apply(this, arguments);
97
+ };
98
+ }());
77
99
  _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) {
100
+ _test.test.beforeEach( /*#__PURE__*/function () {
101
+ var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(_ref8) {
81
102
  var baseURL, page;
82
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
83
- while (1) switch (_context4.prev = _context4.next) {
103
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
104
+ while (1) switch (_context5.prev = _context5.next) {
84
105
  case 0:
85
- baseURL = _ref7.baseURL, page = _ref7.page;
86
- _context4.next = 3;
87
- return initPage({
88
- baseURL: baseURL,
89
- page: page,
106
+ baseURL = _ref8.baseURL, page = _ref8.page;
107
+ _context5.next = 3;
108
+ return initPage(page, baseURL);
109
+ case 3:
110
+ _context5.next = 5;
111
+ return initTree(page, {
90
112
  dragAndDrop: false
91
113
  });
92
- case 3:
114
+ case 5:
93
115
  case "end":
94
- return _context4.stop();
116
+ return _context5.stop();
95
117
  }
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) {
118
+ }, _callee5);
119
+ }));
120
+ return function (_x7) {
121
+ return _ref9.apply(this, arguments);
122
+ };
123
+ }());
124
+ (0, _test.test)("displays a tree", /*#__PURE__*/function () {
125
+ var _ref11 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(_ref10) {
101
126
  var page, screenshot;
102
- return _regeneratorRuntime().wrap(function _callee5$(_context5) {
103
- while (1) switch (_context5.prev = _context5.next) {
127
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
128
+ while (1) switch (_context6.prev = _context6.next) {
104
129
  case 0:
105
- page = _ref9.page;
106
- _context5.next = 3;
130
+ page = _ref10.page;
131
+ _context6.next = 3;
107
132
  return (0, _test.expect)(page.locator("body")).toHaveText(/.*Saurischia.*/);
108
133
  case 3:
109
- _context5.next = 5;
134
+ _context6.next = 5;
110
135
  return (0, _test.expect)(page.locator("body")).toHaveText(/.*Ornithischians.*/);
111
136
  case 5:
112
- _context5.next = 7;
137
+ _context6.next = 7;
113
138
  return (0, _test.expect)(page.locator("body")).toHaveText(/.*Coelophysoids.*/);
114
139
  case 7:
115
- _context5.next = 9;
140
+ _context6.next = 9;
116
141
  return page.screenshot();
117
142
  case 9:
118
- screenshot = _context5.sent;
143
+ screenshot = _context6.sent;
119
144
  (0, _test.expect)(screenshot).toMatchSnapshot();
120
145
  case 11:
121
146
  case "end":
122
- return _context5.stop();
147
+ return _context6.stop();
123
148
  }
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) {
149
+ }, _callee6);
150
+ }));
151
+ return function (_x8) {
152
+ return _ref11.apply(this, arguments);
153
+ };
154
+ }());
155
+ (0, _test.test)("selects a node", /*#__PURE__*/function () {
156
+ var _ref13 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(_ref12) {
129
157
  var page, saurischia, screenshot;
130
- return _regeneratorRuntime().wrap(function _callee6$(_context6) {
131
- while (1) switch (_context6.prev = _context6.next) {
158
+ return _regeneratorRuntime().wrap(function _callee7$(_context7) {
159
+ while (1) switch (_context7.prev = _context7.next) {
132
160
  case 0:
133
- page = _ref11.page;
134
- _context6.next = 3;
161
+ page = _ref12.page;
162
+ _context7.next = 3;
135
163
  return (0, _test.expect)(page.locator("body")).toHaveText(/.*Saurischia.*/);
136
164
  case 3:
137
- _context6.next = 5;
165
+ _context7.next = 5;
138
166
  return (0, _testUtils.findNodeElement)(page, "Saurischia");
139
167
  case 5:
140
- saurischia = _context6.sent;
141
- _context6.next = 8;
168
+ saurischia = _context7.sent;
169
+ _context7.next = 8;
142
170
  return (0, _testUtils.selectNode)(saurischia);
143
171
  case 8:
144
- _context6.next = 10;
172
+ _context7.next = 10;
145
173
  return page.screenshot();
146
174
  case 10:
147
- screenshot = _context6.sent;
175
+ screenshot = _context7.sent;
148
176
  (0, _test.expect)(screenshot).toMatchSnapshot();
149
177
  case 12:
150
178
  case "end":
151
- return _context6.stop();
179
+ return _context7.stop();
152
180
  }
153
- }, _callee6);
154
- }))).apply(this, arguments);
155
- });
181
+ }, _callee7);
182
+ }));
183
+ return function (_x9) {
184
+ return _ref13.apply(this, arguments);
185
+ };
186
+ }());
156
187
  });
157
188
  _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) {
189
+ _test.test.beforeEach( /*#__PURE__*/function () {
190
+ var _ref15 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(_ref14) {
161
191
  var baseURL, page;
162
- return _regeneratorRuntime().wrap(function _callee7$(_context7) {
163
- while (1) switch (_context7.prev = _context7.next) {
192
+ return _regeneratorRuntime().wrap(function _callee8$(_context8) {
193
+ while (1) switch (_context8.prev = _context8.next) {
164
194
  case 0:
165
- baseURL = _ref13.baseURL, page = _ref13.page;
166
- _context7.next = 3;
167
- return initPage({
168
- baseURL: baseURL,
169
- page: page,
195
+ baseURL = _ref14.baseURL, page = _ref14.page;
196
+ _context8.next = 3;
197
+ return initPage(page, baseURL);
198
+ case 3:
199
+ _context8.next = 5;
200
+ return initTree(page, {
170
201
  dragAndDrop: true
171
202
  });
172
- case 3:
203
+ case 5:
173
204
  case "end":
174
- return _context7.stop();
205
+ return _context8.stop();
175
206
  }
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) {
207
+ }, _callee8);
208
+ }));
209
+ return function (_x10) {
210
+ return _ref15.apply(this, arguments);
211
+ };
212
+ }());
213
+ (0, _test.test)("moves a node", /*#__PURE__*/function () {
214
+ var _ref17 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(_ref16) {
181
215
  var page, structure, screenshot;
182
- return _regeneratorRuntime().wrap(function _callee8$(_context8) {
183
- while (1) switch (_context8.prev = _context8.next) {
216
+ return _regeneratorRuntime().wrap(function _callee9$(_context9) {
217
+ while (1) switch (_context9.prev = _context9.next) {
184
218
  case 0:
185
- page = _ref15.page;
186
- _context8.next = 3;
219
+ page = _ref16.page;
220
+ _context9.next = 3;
187
221
  return (0, _testUtils.dragAndDrop)(page, "Herrerasaurians", "Ornithischians");
188
222
  case 3:
189
- _context8.next = 5;
223
+ _context9.next = 5;
190
224
  return (0, _testUtils.getTreeStructure)(page);
191
225
  case 5:
192
- structure = _context8.sent;
226
+ structure = _context9.sent;
193
227
  (0, _test.expect)(structure).toEqual([_test.expect.objectContaining({
194
228
  name: "Saurischia",
195
229
  children: [_test.expect.objectContaining({
@@ -213,16 +247,360 @@ _test.test.describe("with dragAndDrop", function () {
213
247
  name: "Ceratopsians"
214
248
  })]
215
249
  })]);
216
- _context8.next = 9;
250
+ _context9.next = 9;
217
251
  return page.screenshot();
218
252
  case 9:
219
- screenshot = _context8.sent;
253
+ screenshot = _context9.sent;
220
254
  (0, _test.expect)(screenshot).toMatchSnapshot();
221
255
  case 11:
222
256
  case "end":
223
- return _context8.stop();
257
+ return _context9.stop();
224
258
  }
225
- }, _callee8);
226
- }))).apply(this, arguments);
227
- });
259
+ }, _callee9);
260
+ }));
261
+ return function (_x11) {
262
+ return _ref17.apply(this, arguments);
263
+ };
264
+ }());
265
+ });
266
+ _test.test.describe("autoscroll when the window is scrollable", function () {
267
+ (0, _test.test)("it scrolls vertically when the users drags an element to the bottom ", /*#__PURE__*/function () {
268
+ var _ref19 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(_ref18) {
269
+ var baseURL, page;
270
+ return _regeneratorRuntime().wrap(function _callee10$(_context10) {
271
+ while (1) switch (_context10.prev = _context10.next) {
272
+ case 0:
273
+ baseURL = _ref18.baseURL, page = _ref18.page;
274
+ _context10.next = 3;
275
+ return page.setViewportSize({
276
+ width: 200,
277
+ height: 100
278
+ });
279
+ case 3:
280
+ _context10.next = 5;
281
+ return initPage(page, baseURL);
282
+ case 5:
283
+ _context10.next = 7;
284
+ return initTree(page, {
285
+ autoOpen: 3,
286
+ dragAndDrop: true
287
+ });
288
+ case 7:
289
+ _context10.t0 = _test.expect;
290
+ _context10.next = 10;
291
+ return page.getByRole("document").evaluate(function (element) {
292
+ return element.scrollTop;
293
+ });
294
+ case 10:
295
+ _context10.t1 = _context10.sent;
296
+ (0, _context10.t0)(_context10.t1).toEqual(0);
297
+ _context10.next = 14;
298
+ return (0, _testUtils.moveMouseToNode)(page, "Saurischia");
299
+ case 14:
300
+ _context10.next = 16;
301
+ return page.mouse.down();
302
+ case 16:
303
+ _context10.next = 18;
304
+ return page.waitForTimeout(200);
305
+ case 18:
306
+ _context10.next = 20;
307
+ return page.mouse.move(20, 190);
308
+ case 20:
309
+ _context10.next = 22;
310
+ return page.waitForTimeout(50);
311
+ case 22:
312
+ _context10.t2 = _test.expect;
313
+ _context10.next = 25;
314
+ return page.getByRole("document").evaluate(function (element) {
315
+ return element.scrollTop;
316
+ });
317
+ case 25:
318
+ _context10.t3 = _context10.sent;
319
+ (0, _context10.t2)(_context10.t3).toBeGreaterThan(0);
320
+ case 27:
321
+ case "end":
322
+ return _context10.stop();
323
+ }
324
+ }, _callee10);
325
+ }));
326
+ return function (_x12) {
327
+ return _ref19.apply(this, arguments);
328
+ };
329
+ }());
330
+ (0, _test.test)("it scrolls horizontally when the users drags an element to the right", /*#__PURE__*/function () {
331
+ var _ref21 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(_ref20) {
332
+ var baseURL, page;
333
+ return _regeneratorRuntime().wrap(function _callee11$(_context11) {
334
+ while (1) switch (_context11.prev = _context11.next) {
335
+ case 0:
336
+ baseURL = _ref20.baseURL, page = _ref20.page;
337
+ _context11.next = 3;
338
+ return page.setViewportSize({
339
+ width: 60,
340
+ height: 400
341
+ });
342
+ case 3:
343
+ _context11.next = 5;
344
+ return initPage(page, baseURL);
345
+ case 5:
346
+ _context11.next = 7;
347
+ return initTree(page, {
348
+ autoOpen: 3,
349
+ dragAndDrop: true
350
+ });
351
+ case 7:
352
+ _context11.t0 = _test.expect;
353
+ _context11.next = 10;
354
+ return page.getByRole("document").evaluate(function (element) {
355
+ return element.scrollLeft;
356
+ });
357
+ case 10:
358
+ _context11.t1 = _context11.sent;
359
+ (0, _context11.t0)(_context11.t1).toEqual(0);
360
+ _context11.next = 14;
361
+ return (0, _testUtils.moveMouseToNode)(page, "Saurischia");
362
+ case 14:
363
+ _context11.next = 16;
364
+ return page.mouse.down();
365
+ case 16:
366
+ _context11.next = 18;
367
+ return page.waitForTimeout(200);
368
+ case 18:
369
+ _context11.next = 20;
370
+ return page.mouse.move(55, 10);
371
+ case 20:
372
+ _context11.next = 22;
373
+ return page.waitForTimeout(50);
374
+ case 22:
375
+ _context11.t2 = _test.expect;
376
+ _context11.next = 25;
377
+ return page.getByRole("document").evaluate(function (element) {
378
+ return element.scrollLeft;
379
+ });
380
+ case 25:
381
+ _context11.t3 = _context11.sent;
382
+ (0, _context11.t2)(_context11.t3).toBeGreaterThan(0);
383
+ case 27:
384
+ case "end":
385
+ return _context11.stop();
386
+ }
387
+ }, _callee11);
388
+ }));
389
+ return function (_x13) {
390
+ return _ref21.apply(this, arguments);
391
+ };
392
+ }());
393
+ (0, _test.test)("scrollToNode scrolls to a node", /*#__PURE__*/function () {
394
+ var _ref23 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12(_ref22) {
395
+ var baseURL, page;
396
+ return _regeneratorRuntime().wrap(function _callee12$(_context12) {
397
+ while (1) switch (_context12.prev = _context12.next) {
398
+ case 0:
399
+ baseURL = _ref22.baseURL, page = _ref22.page;
400
+ _context12.next = 3;
401
+ return page.setViewportSize({
402
+ width: 200,
403
+ height: 100
404
+ });
405
+ case 3:
406
+ _context12.next = 5;
407
+ return initPage(page, baseURL);
408
+ case 5:
409
+ _context12.next = 7;
410
+ return initTree(page, {
411
+ autoOpen: 3,
412
+ dragAndDrop: true
413
+ });
414
+ case 7:
415
+ _context12.t0 = _test.expect;
416
+ _context12.next = 10;
417
+ return page.getByRole("document").evaluate(function (element) {
418
+ return element.scrollTop;
419
+ });
420
+ case 10:
421
+ _context12.t1 = _context12.sent;
422
+ (0, _context12.t0)(_context12.t1).toEqual(0);
423
+ _context12.next = 14;
424
+ return page.evaluate("\n const $tree = jQuery(\"#tree1\");\n const node = $tree.tree(\"getNodeByName\", \"Sauropodomorphs\");\n $tree.tree(\"scrollToNode\",node);\n ");
425
+ case 14:
426
+ _context12.t2 = _test.expect;
427
+ _context12.next = 17;
428
+ return page.getByRole("document").evaluate(function (element) {
429
+ return element.scrollTop;
430
+ });
431
+ case 17:
432
+ _context12.t3 = _context12.sent;
433
+ (0, _context12.t2)(_context12.t3).toBeGreaterThan(0);
434
+ case 19:
435
+ case "end":
436
+ return _context12.stop();
437
+ }
438
+ }, _callee12);
439
+ }));
440
+ return function (_x14) {
441
+ return _ref23.apply(this, arguments);
442
+ };
443
+ }());
444
+ });
445
+ _test.test.describe("autoscroll when the container is scrollable", function () {
446
+ _test.test.beforeEach( /*#__PURE__*/function () {
447
+ var _ref25 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13(_ref24) {
448
+ var page, baseURL;
449
+ return _regeneratorRuntime().wrap(function _callee13$(_context13) {
450
+ while (1) switch (_context13.prev = _context13.next) {
451
+ case 0:
452
+ page = _ref24.page, baseURL = _ref24.baseURL;
453
+ _context13.next = 3;
454
+ return initPage(page, baseURL);
455
+ case 3:
456
+ _context13.next = 5;
457
+ return page.evaluate("\n document.body.style.marginLeft = \"40px\";\n document.body.style.marginTop = \"40px\";\n\n const treeElement = document.querySelector(\"#tree1\");\n\n const container = document.createElement(\"div\");\n container.id = \"container\";\n container.style.height = \"200px\";\n container.style.width = \"60px\";\n container.style.overflowY = \"scroll\";\n\n document.body.replaceChild(container, treeElement);\n container.appendChild(treeElement);\n ");
458
+ case 5:
459
+ _context13.next = 7;
460
+ return initTree(page, {
461
+ autoOpen: 3,
462
+ dragAndDrop: true
463
+ });
464
+ case 7:
465
+ case "end":
466
+ return _context13.stop();
467
+ }
468
+ }, _callee13);
469
+ }));
470
+ return function (_x15) {
471
+ return _ref25.apply(this, arguments);
472
+ };
473
+ }());
474
+ (0, _test.test)("it scrolls vertically when the users drags an element to the bottom", /*#__PURE__*/function () {
475
+ var _ref27 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14(_ref26) {
476
+ var page;
477
+ return _regeneratorRuntime().wrap(function _callee14$(_context14) {
478
+ while (1) switch (_context14.prev = _context14.next) {
479
+ case 0:
480
+ page = _ref26.page;
481
+ _context14.t0 = _test.expect;
482
+ _context14.next = 4;
483
+ return page.locator("#container").evaluate(function (element) {
484
+ return element.scrollTop;
485
+ });
486
+ case 4:
487
+ _context14.t1 = _context14.sent;
488
+ (0, _context14.t0)(_context14.t1).toEqual(0);
489
+ _context14.next = 8;
490
+ return (0, _testUtils.moveMouseToNode)(page, "Saurischia");
491
+ case 8:
492
+ _context14.next = 10;
493
+ return page.mouse.down();
494
+ case 10:
495
+ _context14.next = 12;
496
+ return page.waitForTimeout(200);
497
+ case 12:
498
+ _context14.next = 14;
499
+ return page.mouse.move(20, 245);
500
+ case 14:
501
+ _context14.next = 16;
502
+ return page.waitForTimeout(50);
503
+ case 16:
504
+ _context14.t2 = _test.expect;
505
+ _context14.next = 19;
506
+ return page.locator("#container").evaluate(function (element) {
507
+ return element.scrollTop;
508
+ });
509
+ case 19:
510
+ _context14.t3 = _context14.sent;
511
+ (0, _context14.t2)(_context14.t3).toBeGreaterThan(0);
512
+ case 21:
513
+ case "end":
514
+ return _context14.stop();
515
+ }
516
+ }, _callee14);
517
+ }));
518
+ return function (_x16) {
519
+ return _ref27.apply(this, arguments);
520
+ };
521
+ }());
522
+ (0, _test.test)("it scrolls horizontally when the users drags an element to the right", /*#__PURE__*/function () {
523
+ var _ref29 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15(_ref28) {
524
+ var page;
525
+ return _regeneratorRuntime().wrap(function _callee15$(_context15) {
526
+ while (1) switch (_context15.prev = _context15.next) {
527
+ case 0:
528
+ page = _ref28.page;
529
+ _context15.t0 = _test.expect;
530
+ _context15.next = 4;
531
+ return page.locator("#container").evaluate(function (element) {
532
+ return element.scrollLeft;
533
+ });
534
+ case 4:
535
+ _context15.t1 = _context15.sent;
536
+ (0, _context15.t0)(_context15.t1).toEqual(0);
537
+ _context15.next = 8;
538
+ return (0, _testUtils.moveMouseToNode)(page, "Saurischia");
539
+ case 8:
540
+ _context15.next = 10;
541
+ return page.mouse.down();
542
+ case 10:
543
+ _context15.next = 12;
544
+ return page.waitForTimeout(200);
545
+ case 12:
546
+ _context15.next = 14;
547
+ return page.mouse.move(100, 50);
548
+ case 14:
549
+ _context15.next = 16;
550
+ return page.waitForTimeout(50);
551
+ case 16:
552
+ _context15.t2 = _test.expect;
553
+ _context15.next = 19;
554
+ return page.locator("#container").evaluate(function (element) {
555
+ return element.scrollLeft;
556
+ });
557
+ case 19:
558
+ _context15.t3 = _context15.sent;
559
+ (0, _context15.t2)(_context15.t3).toBeGreaterThan(0);
560
+ case 21:
561
+ case "end":
562
+ return _context15.stop();
563
+ }
564
+ }, _callee15);
565
+ }));
566
+ return function (_x17) {
567
+ return _ref29.apply(this, arguments);
568
+ };
569
+ }());
570
+ (0, _test.test)("scrollToNode scrolls to a node", /*#__PURE__*/function () {
571
+ var _ref31 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16(_ref30) {
572
+ var page;
573
+ return _regeneratorRuntime().wrap(function _callee16$(_context16) {
574
+ while (1) switch (_context16.prev = _context16.next) {
575
+ case 0:
576
+ page = _ref30.page;
577
+ _context16.t0 = _test.expect;
578
+ _context16.next = 4;
579
+ return page.locator("#container").evaluate(function (element) {
580
+ return element.scrollTop;
581
+ });
582
+ case 4:
583
+ _context16.t1 = _context16.sent;
584
+ (0, _context16.t0)(_context16.t1).toEqual(0);
585
+ _context16.next = 8;
586
+ return page.evaluate("\n const $tree = jQuery(\"#tree1\");\n const node = $tree.tree(\"getNodeByName\", \"Sauropodomorphs\");\n $tree.tree(\"scrollToNode\",node);\n ");
587
+ case 8:
588
+ _context16.t2 = _test.expect;
589
+ _context16.next = 11;
590
+ return page.locator("#container").evaluate(function (element) {
591
+ return element.scrollTop;
592
+ });
593
+ case 11:
594
+ _context16.t3 = _context16.sent;
595
+ (0, _context16.t2)(_context16.t3).toBeGreaterThan(0);
596
+ case 13:
597
+ case "end":
598
+ return _context16.stop();
599
+ }
600
+ }, _callee16);
601
+ }));
602
+ return function (_x18) {
603
+ return _ref31.apply(this, arguments);
604
+ };
605
+ }());
228
606
  });