jqtree 1.7.5 → 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/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 +7 -0
- package/package.json +5 -1
- 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 -30
- package/src/mouse.widget.ts +3 -3
- package/src/mouseWidgetTypes.ts +6 -0
- 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/playwright/coverage.ts +1 -4
- package/src/playwright/playwright.test.ts +0 -4
- package/src/saveStateHandler.ts +75 -26
- package/src/scrollHandler.ts +13 -7
- package/src/selectNodeHandler.ts +10 -16
- package/src/test/jqTree/keyboard.test.ts +18 -23
- package/src/test/jqTree/methods.test.ts +32 -3
- package/src/test/jqTree/options.test.ts +15 -4
- package/src/test/node.test.ts +1 -1
- package/src/tree.jquery.ts +239 -57
- package/src/util.ts +3 -0
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +1728 -2576
- 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 -123
- package/lib/dragAndDropHandler.js +0 -588
- package/lib/elementsRenderer.js +0 -267
- package/lib/jqtreeOptions.js +0 -1
- package/lib/keyHandler.js +0 -111
- package/lib/mouse.widget.js +0 -255
- package/lib/node.js +0 -708
- package/lib/nodeElement.js +0 -274
- package/lib/nodeUtils.js +0 -10
- package/lib/playwright/coverage.js +0 -99
- package/lib/playwright/playwright.test.js +0 -606
- package/lib/playwright/testUtils.js +0 -210
- package/lib/saveStateHandler.js +0 -277
- package/lib/scrollHandler/containerScrollParent.js +0 -160
- package/lib/scrollHandler/createScrollParent.js +0 -57
- package/lib/scrollHandler/documentScrollParent.js +0 -169
- package/lib/scrollHandler/scrollParent.js +0 -58
- package/lib/scrollHandler/types.js +0 -1
- package/lib/scrollHandler.js +0 -71
- package/lib/selectNodeHandler.js +0 -128
- package/lib/simple.widget.js +0 -158
- 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 -1348
- package/lib/test/jqTree/options.test.js +0 -548
- package/lib/test/jqTree/scrollHandler/containerScrollParent.test.js +0 -94
- package/lib/test/node.test.js +0 -1202
- package/lib/test/nodeUtil.test.js +0 -27
- package/lib/test/nodeUtils.test.js +0 -20
- package/lib/test/support/exampleData.js +0 -35
- 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 -29
- package/lib/test/support/treeStructure.js +0 -38
- package/lib/test/util.test.js +0 -26
- package/lib/tree.jquery.d.js +0 -1
- package/lib/tree.jquery.js +0 -1105
- package/lib/types.js +0 -1
- package/lib/typings.d.js +0 -2
- package/lib/util.js +0 -15
- package/lib/version.js +0 -8
- package/src/dragAndDropHandler.ts +0 -713
- package/src/nodeElement.ts +0 -272
- package/src/types.ts +0 -19
|
@@ -1,218 +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 _givens = _interopRequireDefault(require("givens"));
|
|
5
|
-
var _dom = require("@testing-library/dom");
|
|
6
|
-
var _msw = require("msw");
|
|
7
|
-
var _node = require("msw/node");
|
|
8
|
-
require("../../tree.jquery");
|
|
9
|
-
var _testUtil = require("../support/testUtil");
|
|
10
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
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 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; }
|
|
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); } }
|
|
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); }); }; }
|
|
14
|
-
var context = describe;
|
|
15
|
-
var server = (0, _node.setupServer)();
|
|
16
|
-
beforeAll(function () {
|
|
17
|
-
return server.listen();
|
|
18
|
-
});
|
|
19
|
-
beforeEach(function () {
|
|
20
|
-
$("body").append('<div id="tree1"></div>');
|
|
21
|
-
});
|
|
22
|
-
afterEach(function () {
|
|
23
|
-
server.resetHandlers();
|
|
24
|
-
var $tree = $("#tree1");
|
|
25
|
-
$tree.tree("destroy");
|
|
26
|
-
$tree.remove();
|
|
27
|
-
localStorage.clear();
|
|
28
|
-
});
|
|
29
|
-
afterAll(function () {
|
|
30
|
-
return server.close();
|
|
31
|
-
});
|
|
32
|
-
context("when a node has load_on_demand in the data", function () {
|
|
33
|
-
var given = (0, _givens["default"])();
|
|
34
|
-
given("autoOpen", function () {
|
|
35
|
-
return false;
|
|
36
|
-
});
|
|
37
|
-
given("$tree", function () {
|
|
38
|
-
return $("#tree1");
|
|
39
|
-
});
|
|
40
|
-
var initialData = [{
|
|
41
|
-
id: 1,
|
|
42
|
-
name: "parent-node",
|
|
43
|
-
load_on_demand: true
|
|
44
|
-
}];
|
|
45
|
-
beforeEach(function () {
|
|
46
|
-
server.use(_msw.rest.get("/tree/", function (request, response, ctx) {
|
|
47
|
-
var parentId = request.url.searchParams.get("node");
|
|
48
|
-
if (parentId === "1") {
|
|
49
|
-
return response(ctx.status(200), ctx.json([{
|
|
50
|
-
id: 2,
|
|
51
|
-
name: "loaded-on-demand"
|
|
52
|
-
}]));
|
|
53
|
-
} else {
|
|
54
|
-
return response(ctx.status(400));
|
|
55
|
-
}
|
|
56
|
-
}));
|
|
57
|
-
});
|
|
58
|
-
beforeEach(function () {
|
|
59
|
-
if (given.savedState) {
|
|
60
|
-
localStorage.setItem("tree", given.savedState);
|
|
61
|
-
}
|
|
62
|
-
given.$tree.tree({
|
|
63
|
-
autoOpen: given.autoOpen,
|
|
64
|
-
data: initialData,
|
|
65
|
-
dataUrl: "/tree/",
|
|
66
|
-
saveState: true
|
|
67
|
-
});
|
|
68
|
-
});
|
|
69
|
-
it("creates a parent node without children", function () {
|
|
70
|
-
expect(given.$tree).toHaveTreeStructure([expect.objectContaining({
|
|
71
|
-
children: [],
|
|
72
|
-
name: "parent-node",
|
|
73
|
-
open: false
|
|
74
|
-
})]);
|
|
75
|
-
});
|
|
76
|
-
context("when the node is opened", function () {
|
|
77
|
-
given("node", function () {
|
|
78
|
-
return given.$tree.tree("getNodeByNameMustExist", "parent-node");
|
|
79
|
-
});
|
|
80
|
-
it("loads the subtree", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
81
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
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();
|
|
98
|
-
}
|
|
99
|
-
}, _callee);
|
|
100
|
-
})));
|
|
101
|
-
context("when the node is selected and has the focus", function () {
|
|
102
|
-
beforeEach(function () {
|
|
103
|
-
given.$tree.tree("selectNode", given.node);
|
|
104
|
-
});
|
|
105
|
-
it("keeps the node selected and focused", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
106
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
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();
|
|
120
|
-
}
|
|
121
|
-
}, _callee2);
|
|
122
|
-
})));
|
|
123
|
-
});
|
|
124
|
-
context("when the node is not selected", function () {
|
|
125
|
-
it("doesn't select the node", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
126
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
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();
|
|
138
|
-
}
|
|
139
|
-
}, _callee3);
|
|
140
|
-
})));
|
|
141
|
-
});
|
|
142
|
-
context("when the node is selected and doesn't have the focus", function () {
|
|
143
|
-
beforeEach(function () {
|
|
144
|
-
given.$tree.tree("selectNode", given.node);
|
|
145
|
-
document.activeElement.blur(); // eslint-disable-line testing-library/no-node-access
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
it("keeps the node selected and not focused", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
149
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
150
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
151
|
-
case 0:
|
|
152
|
-
expect(given.node.element).toBeSelected();
|
|
153
|
-
expect(given.node.element).not.toBeFocused();
|
|
154
|
-
(0, _testUtil.togglerLink)(given.node.element).trigger("click");
|
|
155
|
-
_context4.next = 5;
|
|
156
|
-
return _dom.screen.findByText("loaded-on-demand");
|
|
157
|
-
case 5:
|
|
158
|
-
expect(given.node.element).toBeSelected();
|
|
159
|
-
expect(given.node.element).not.toBeFocused();
|
|
160
|
-
case 7:
|
|
161
|
-
case "end":
|
|
162
|
-
return _context4.stop();
|
|
163
|
-
}
|
|
164
|
-
}, _callee4);
|
|
165
|
-
})));
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
context("with autoOpen is true", function () {
|
|
169
|
-
given("autoOpen", function () {
|
|
170
|
-
return true;
|
|
171
|
-
});
|
|
172
|
-
it("loads the node on demand", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
173
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
174
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
175
|
-
case 0:
|
|
176
|
-
_context5.next = 2;
|
|
177
|
-
return _dom.screen.findByText("loaded-on-demand");
|
|
178
|
-
case 2:
|
|
179
|
-
expect(given.$tree).toHaveTreeStructure([expect.objectContaining({
|
|
180
|
-
name: "parent-node",
|
|
181
|
-
open: true,
|
|
182
|
-
children: [expect.objectContaining({
|
|
183
|
-
name: "loaded-on-demand"
|
|
184
|
-
})]
|
|
185
|
-
})]);
|
|
186
|
-
case 3:
|
|
187
|
-
case "end":
|
|
188
|
-
return _context5.stop();
|
|
189
|
-
}
|
|
190
|
-
}, _callee5);
|
|
191
|
-
})));
|
|
192
|
-
});
|
|
193
|
-
context("with a saved state with an opened node", function () {
|
|
194
|
-
given("savedState", function () {
|
|
195
|
-
return '{"open_nodes":[1],"selected_node":[]}';
|
|
196
|
-
});
|
|
197
|
-
it("opens the node and loads its children on demand", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
198
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
199
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
200
|
-
case 0:
|
|
201
|
-
_context6.next = 2;
|
|
202
|
-
return _dom.screen.findByText("loaded-on-demand");
|
|
203
|
-
case 2:
|
|
204
|
-
expect(given.$tree).toHaveTreeStructure([expect.objectContaining({
|
|
205
|
-
name: "parent-node",
|
|
206
|
-
open: true,
|
|
207
|
-
children: [expect.objectContaining({
|
|
208
|
-
name: "loaded-on-demand"
|
|
209
|
-
})]
|
|
210
|
-
})]);
|
|
211
|
-
case 3:
|
|
212
|
-
case "end":
|
|
213
|
-
return _context6.stop();
|
|
214
|
-
}
|
|
215
|
-
}, _callee6);
|
|
216
|
-
})));
|
|
217
|
-
});
|
|
218
|
-
});
|