jqtree 1.6.2 → 1.6.3
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 +3 -12
- package/.github/workflows/ci.yml +48 -23
- package/.github/workflows/codeql-analysis.yml +9 -5
- package/.prettier +3 -0
- package/README.md +11 -8
- package/bower.json +1 -1
- package/{.postcssrc → config/.postcssrc} +0 -0
- package/{babel.config.json → config/babel.config.json} +0 -0
- package/{babel.coverage.config.json → config/babel.coverage.config.json} +0 -0
- package/{jest-jsdom.config.js → config/jest.config.js} +8 -3
- package/config/playwright.config.js +18 -0
- package/config/production +4 -0
- package/{rollup.config.js → config/rollup.config.js} +3 -3
- package/{jqtree.postcss → css/jqtree.postcss} +0 -0
- package/devserver/index.html +1 -9
- package/docs/Gemfile +2 -0
- package/docs/Gemfile.lock +263 -0
- package/{_config.yml → docs/_config.yml} +8 -1
- package/{_entries → docs/_entries}/01_general.md +0 -0
- package/{_entries → docs/_entries}/02_introduction.md +0 -0
- package/{_entries → docs/_entries}/03_features.md +1 -1
- package/{_entries → docs/_entries}/04_demo.html +1 -7
- package/{_entries → docs/_entries}/05_requirements.md +0 -0
- package/{_entries → docs/_entries}/06_downloads.md +0 -0
- package/{_entries → docs/_entries}/07_tutorial.md +0 -0
- package/{_entries → docs/_entries}/08_examples.md +0 -0
- package/{_entries → docs/_entries}/09_usecases.md +0 -0
- package/{_entries → docs/_entries}/10_changelog.md +4 -0
- package/{_entries → docs/_entries}/11_options.md +0 -0
- package/{_entries → docs/_entries}/12_animationspeed.md +0 -0
- package/{_entries → docs/_entries}/13_autoescape.md +0 -0
- package/{_entries → docs/_entries}/14_autoopen.md +0 -0
- package/{_entries → docs/_entries}/15_buttonleft.md +0 -0
- package/{_entries → docs/_entries}/16_closedicon.md +0 -0
- package/{_entries → docs/_entries}/17_data.md +0 -0
- package/{_entries → docs/_entries}/18_datafilter.md +0 -0
- package/{_entries → docs/_entries}/19_data-url.md +0 -0
- package/{_entries → docs/_entries}/20_draganddrop.md +0 -0
- package/{_entries → docs/_entries}/21_keyboardsupport.md +0 -0
- package/{_entries → docs/_entries}/22_oncanmove.md +0 -0
- package/{_entries → docs/_entries}/23_oncanmoveto.md +2 -2
- package/{_entries → docs/_entries}/24_oncanselectnode.md +0 -0
- package/{_entries → docs/_entries}/25_oncreateli.md +2 -2
- package/{_entries → docs/_entries}/26_ondragmove.md +0 -0
- package/{_entries → docs/_entries}/27_ondragstop.md +0 -0
- package/{_entries → docs/_entries}/28_onismovehandle.md +0 -0
- package/{_entries → docs/_entries}/29_onloadfailed.md +0 -0
- package/{_entries → docs/_entries}/30_onloading.md +2 -2
- package/{_entries → docs/_entries}/31_openedicon.md +0 -0
- package/{_entries → docs/_entries}/32_openfolderdelay.md +2 -0
- package/{_entries → docs/_entries}/33_rtl.md +0 -0
- package/{_entries → docs/_entries}/34_savestate.md +0 -0
- package/{_entries → docs/_entries}/35_selectable.md +0 -0
- package/{_entries → docs/_entries}/36_showemptyfolder.md +0 -0
- package/{_entries → docs/_entries}/37_slide.md +0 -0
- package/{_entries → docs/_entries}/38_start_dnd_delay.md +0 -0
- package/{_entries → docs/_entries}/39_tabindex.md +0 -0
- package/{_entries → docs/_entries}/40_usecontextmenu.md +0 -0
- package/{_entries → docs/_entries}/41_functions.md +0 -0
- package/{_entries → docs/_entries}/42_addparentnode.md +1 -1
- package/{_entries → docs/_entries}/43_addnodeafter.md +1 -1
- package/{_entries → docs/_entries}/44_addnodebefore.md +1 -1
- package/{_entries → docs/_entries}/45_appendnode.md +5 -5
- package/{_entries → docs/_entries}/46_closenode.md +0 -0
- package/{_entries → docs/_entries}/47_destroy.md +0 -0
- package/{_entries → docs/_entries}/48_getnodebycallback.md +0 -0
- package/{_entries → docs/_entries}/49_getnodebyid.md +0 -0
- package/{_entries → docs/_entries}/50_getnodebyhtmlelement.md +2 -2
- package/{_entries → docs/_entries}/51_getselectednode.md +0 -0
- package/{_entries → docs/_entries}/52_getstate.md +0 -0
- package/{_entries → docs/_entries}/53_gettree.md +1 -1
- package/{_entries → docs/_entries}/54_isdragging.md +1 -1
- package/{_entries → docs/_entries}/55_loaddata.md +3 -3
- package/{_entries → docs/_entries}/56_loaddatafromurl.md +4 -4
- package/{_entries → docs/_entries}/57_movedown.md +0 -0
- package/{_entries → docs/_entries}/58_movenode.md +3 -3
- package/{_entries → docs/_entries}/59_moveup.md +0 -0
- package/{_entries → docs/_entries}/60_opennode.md +3 -3
- package/docs/_entries/61_prependnode.md +21 -0
- package/{_entries → docs/_entries}/62_refresh.md +0 -0
- package/{_entries → docs/_entries}/63_reload.md +2 -2
- package/{_entries → docs/_entries}/64_removenode.md +0 -0
- package/{_entries → docs/_entries}/65_selectnode.md +0 -0
- package/{_entries → docs/_entries}/66_scrolltonode.md +0 -0
- package/{_entries → docs/_entries}/67_setoption.md +0 -0
- package/{_entries → docs/_entries}/68_setstate.md +0 -0
- package/{_entries → docs/_entries}/69_toggle.md +0 -0
- package/{_entries → docs/_entries}/70_tojson.md +0 -0
- package/{_entries → docs/_entries}/71_updatenode.md +1 -1
- package/{_entries → docs/_entries}/72_events.md +0 -0
- package/{_entries → docs/_entries}/73_tree-click.md +0 -0
- package/{_entries → docs/_entries}/74_tree-close.md +0 -0
- package/{_entries → docs/_entries}/75_tree-contextmenu.md +0 -0
- package/{_entries → docs/_entries}/76_tree-dblclick.md +0 -0
- package/{_entries → docs/_entries}/77_tree-init.md +0 -0
- package/{_entries → docs/_entries}/78_tree-load-data.md +0 -0
- package/{_entries → docs/_entries}/79_tree-loading-data.md +0 -0
- package/{_entries → docs/_entries}/80_tree-move.md +0 -0
- package/{_entries → docs/_entries}/81_tree-refresh.md +0 -0
- package/{_entries → docs/_entries}/82_tree-open.md +0 -0
- package/{_entries → docs/_entries}/83_tree-select.md +0 -0
- package/{_entries → docs/_entries}/84_multiple-selection.md +0 -0
- package/{_entries → docs/_entries}/85_add-to-selection.md +0 -0
- package/{_entries → docs/_entries}/86_get-selected-nodes.md +0 -0
- package/{_entries → docs/_entries}/87_is-node-selected.md +1 -1
- package/{_entries → docs/_entries}/88_remove-from-selection.md +0 -0
- package/{_entries → docs/_entries}/89_node-functions.md +0 -0
- package/{_entries → docs/_entries}/90_children.md +0 -0
- package/{_entries → docs/_entries}/91_getdata.md +2 -2
- package/{_entries → docs/_entries}/92_getlevel.md +0 -0
- package/{_entries → docs/_entries}/93_getnextnode.md +0 -0
- package/{_entries → docs/_entries}/94_getnextsibling.md +0 -0
- package/{_entries → docs/_entries}/95_getpreviousnode.md +0 -0
- package/{_entries → docs/_entries}/96_getprevioussibling.md +0 -0
- package/{_entries → docs/_entries}/97_parent.md +1 -1
- package/{_entries → docs/_entries}/insert.py +0 -0
- package/{_entries → docs/_entries}/renumber.py +0 -0
- package/{_examples → docs/_examples}/01_load_json_data.html +3 -5
- package/{_examples → docs/_examples}/02_load_json_data_from_server.html +3 -5
- package/{_examples → docs/_examples}/03_drag_and_drop.html +3 -5
- package/{_examples → docs/_examples}/04_save_state.html +3 -5
- package/{_examples → docs/_examples}/05_load_on_demand.html +3 -5
- package/{_examples → docs/_examples}/06_autoescape.html +3 -5
- package/{_examples → docs/_examples}/07_autoscroll.html +3 -5
- package/{_examples → docs/_examples}/08_multiple_select.html +3 -5
- package/{_examples → docs/_examples}/09_custom_html.html +3 -5
- package/{_examples → docs/_examples}/10_icon_buttons.html +3 -5
- package/{_examples → docs/_examples}/11_right-to-left.html +3 -5
- package/{_examples → docs/_examples}/12_button_on_right.html +3 -5
- package/docs/_examples/13_drag_outside.html +48 -0
- package/{_examples → docs/_examples}/14_filter.html +7 -9
- package/docs/_layouts/example.html +7 -0
- package/{_layouts/base.html → docs/_layouts/page.html} +4 -11
- package/docs/documentation.css +3 -0
- package/docs/index.html +65 -0
- package/docs/jqtree.css +189 -0
- package/docs/package.json +22 -0
- package/docs/pnpm-lock.yaml +768 -0
- package/docs/postcss.config.js +7 -0
- package/{static → docs/static}/bower.json +0 -1
- package/{static → docs/static}/bower_components/fontawesome/css/all.min.css +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.eot +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.svg +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.ttf +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.woff +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-brands-400.woff2 +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.eot +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.svg +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.ttf +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.woff +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-regular-400.woff2 +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.eot +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.svg +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.ttf +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.woff +0 -0
- package/{static → docs/static}/bower_components/fontawesome/webfonts/fa-solid-900.woff2 +0 -0
- package/{static → docs/static}/bower_components/jquery/dist/jquery.js +0 -0
- package/{static → docs/static}/bower_components/jquery/dist/jquery.min.js +0 -0
- package/{static → docs/static}/bower_components/jquery-mockjax/dist/jquery.mockjax.js +0 -0
- package/docs/static/documentation.css +1313 -0
- package/docs/static/documentation.js +26 -0
- package/{static → docs/static}/example.css +5 -37
- package/{static → docs/static}/example.postcss +5 -35
- package/{static → docs/static}/example_data.js +0 -0
- package/{static → docs/static}/examples/autoescape.js +0 -0
- package/{static → docs/static}/examples/autoscroll.js +0 -0
- package/{static → docs/static}/examples/button-on-right.js +0 -0
- package/{static → docs/static}/examples/custom_html.js +5 -9
- package/{static → docs/static}/examples/drag-outside.js +0 -0
- package/{static → docs/static}/examples/drag_and_drop.js +0 -0
- package/{static → docs/static}/examples/filter.js +2 -2
- package/{static → docs/static}/examples/icon_buttons.js +0 -0
- package/{static → docs/static}/examples/load_json_data.js +0 -0
- package/{static → docs/static}/examples/load_json_data_from_server.js +0 -0
- package/{static → docs/static}/examples/load_on_demand.js +0 -0
- package/{static → docs/static}/examples/multiple_select.js +0 -0
- package/{static → docs/static}/examples/right-to-left.js +0 -0
- package/{static → docs/static}/examples/save_state.js +0 -0
- package/{static → docs/static}/monokai.css +0 -0
- package/{static → docs/static}/spinner.gif +0 -0
- package/docs/tailwind.config.js +16 -0
- package/docs/tree.jquery.js +21 -0
- package/lib/dragAndDropHandler.js +8 -4
- package/lib/mouse.widget.js +3 -3
- package/lib/nodeElement.js +3 -3
- package/lib/playwright/coverage.js +140 -0
- package/lib/playwright/playwright.test.js +293 -201
- package/lib/playwright/testUtils.js +267 -0
- package/lib/test/jqTree/events.test.js +10 -9
- package/lib/test/jqTree/loadOnDemand.test.js +26 -21
- package/lib/test/jqTree/methods.test.js +84 -64
- package/lib/test/jqTree/options.test.js +41 -29
- package/lib/tree.jquery.js +4 -4
- package/package.json +48 -49
- package/src/dragAndDropHandler.ts +8 -4
- package/src/jqtreeOptions.ts +1 -1
- package/src/playwright/.eslintrc +2 -2
- package/src/playwright/coverage.ts +41 -0
- package/src/playwright/playwright.test.ts +50 -52
- package/src/playwright/playwright.test.ts-snapshots/with-dragAndDrop-moves-a-node-1-Chromium-darwin.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/with-dragAndDrop-moves-a-node-1-Chromium-linux.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-displays-a-tree-1-Chromium-darwin.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-displays-a-tree-1-Chromium-linux.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-selects-a-node-1-Chromium-darwin.png +0 -0
- package/src/playwright/playwright.test.ts-snapshots/without-dragAndDrop-selects-a-node-1-Chromium-linux.png +0 -0
- package/src/playwright/testUtils.ts +122 -0
- package/src/test/.eslintrc +13 -3
- package/src/test/jqTree/events.test.ts +10 -9
- package/src/test/jqTree/loadOnDemand.test.ts +10 -10
- package/src/test/jqTree/methods.test.ts +37 -45
- package/src/test/jqTree/options.test.ts +26 -28
- package/src/tree.jquery.d.ts +1 -1
- package/tree.jquery.debug.js +17 -14
- package/tree.jquery.debug.js.map +1 -1
- package/tree.jquery.js +3 -3
- package/tree.jquery.js.map +1 -1
- package/_entries/61_prependnode.md +0 -21
- package/_examples/13_drag_outside.html +0 -26
- package/_layouts/frontpage.html +0 -20
- package/_layouts/page.html +0 -7
- package/index.html +0 -48
- package/jest-browser.config.js +0 -15
- package/jest-playwright.config.js +0 -21
- package/jest.config.js +0 -8
- package/lib/playwright/testUtil.js +0 -459
- package/lib/playwright/visualRegression.js +0 -193
- package/production +0 -5
- package/src/playwright/screenshots/displays_a_tree_Desktop.png +0 -0
- package/src/playwright/screenshots/displays_a_tree_iPhone 6.png +0 -0
- package/src/playwright/screenshots/moves_a_node_Desktop.png +0 -0
- package/src/playwright/screenshots/moves_a_node_iPhone 6.png +0 -0
- package/src/playwright/screenshots/opens_a_node_Desktop.png +0 -0
- package/src/playwright/screenshots/opens_a_node_iPhone 6.png +0 -0
- package/src/playwright/screenshots/selects_a_node_Desktop.png +0 -0
- package/src/playwright/screenshots/selects_a_node_iPhone 6.png +0 -0
- package/src/playwright/testUtil.ts +0 -170
- package/src/playwright/visualRegression.ts +0 -88
- package/static/bower_components/bootstrap/dist/css/bootstrap-theme.min.css +0 -6
- package/static/bower_components/bootstrap/dist/css/bootstrap.min.css +0 -6
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.eot +0 -0
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.svg +0 -288
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff +0 -0
- package/static/bower_components/bootstrap/dist/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/static/bower_components/bootstrap/dist/js/bootstrap.min.js +0 -6
- package/static/documentation.css +0 -171
- package/static/documentation.js +0 -48
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.selectNode = exports.getTreeStructure = exports.findNodeElement = exports.dragAndDrop = void 0;
|
|
9
|
+
|
|
10
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
11
|
+
|
|
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
|
+
|
|
14
|
+
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); }); }; }
|
|
15
|
+
|
|
16
|
+
var locateTitle = function locateTitle(page, title) {
|
|
17
|
+
return page.locator(".jqtree-title", {
|
|
18
|
+
hasText: title
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
var findNodeElement = /*#__PURE__*/function () {
|
|
23
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(page, title) {
|
|
24
|
+
var titleElement, nodeElement;
|
|
25
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
26
|
+
while (1) {
|
|
27
|
+
switch (_context.prev = _context.next) {
|
|
28
|
+
case 0:
|
|
29
|
+
_context.next = 2;
|
|
30
|
+
return locateTitle(page, title).elementHandle();
|
|
31
|
+
|
|
32
|
+
case 2:
|
|
33
|
+
titleElement = _context.sent;
|
|
34
|
+
|
|
35
|
+
if (titleElement) {
|
|
36
|
+
_context.next = 5;
|
|
37
|
+
break;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
throw new Error("Title element not found: ".concat(title));
|
|
41
|
+
|
|
42
|
+
case 5:
|
|
43
|
+
_context.next = 7;
|
|
44
|
+
return titleElement.evaluateHandle(function (el) {
|
|
45
|
+
var li = el.closest("li");
|
|
46
|
+
|
|
47
|
+
if (!li) {
|
|
48
|
+
throw Error("Node element not found");
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return li;
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
case 7:
|
|
55
|
+
nodeElement = _context.sent;
|
|
56
|
+
return _context.abrupt("return", nodeElement);
|
|
57
|
+
|
|
58
|
+
case 9:
|
|
59
|
+
case "end":
|
|
60
|
+
return _context.stop();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}, _callee);
|
|
64
|
+
}));
|
|
65
|
+
|
|
66
|
+
return function findNodeElement(_x, _x2) {
|
|
67
|
+
return _ref.apply(this, arguments);
|
|
68
|
+
};
|
|
69
|
+
}();
|
|
70
|
+
|
|
71
|
+
exports.findNodeElement = findNodeElement;
|
|
72
|
+
|
|
73
|
+
var selectNode = /*#__PURE__*/function () {
|
|
74
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(nodeElement) {
|
|
75
|
+
var titleHandle;
|
|
76
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
77
|
+
while (1) {
|
|
78
|
+
switch (_context2.prev = _context2.next) {
|
|
79
|
+
case 0:
|
|
80
|
+
_context2.next = 2;
|
|
81
|
+
return nodeElement.$(".jqtree-title");
|
|
82
|
+
|
|
83
|
+
case 2:
|
|
84
|
+
titleHandle = _context2.sent;
|
|
85
|
+
|
|
86
|
+
if (titleHandle) {
|
|
87
|
+
_context2.next = 5;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
throw new Error("Could not select: title element not found");
|
|
92
|
+
|
|
93
|
+
case 5:
|
|
94
|
+
_context2.next = 7;
|
|
95
|
+
return titleHandle.click();
|
|
96
|
+
|
|
97
|
+
case 7:
|
|
98
|
+
case "end":
|
|
99
|
+
return _context2.stop();
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}, _callee2);
|
|
103
|
+
}));
|
|
104
|
+
|
|
105
|
+
return function selectNode(_x3) {
|
|
106
|
+
return _ref2.apply(this, arguments);
|
|
107
|
+
};
|
|
108
|
+
}();
|
|
109
|
+
|
|
110
|
+
exports.selectNode = selectNode;
|
|
111
|
+
|
|
112
|
+
var getRect = /*#__PURE__*/function () {
|
|
113
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(elementHandle) {
|
|
114
|
+
var boundingBox;
|
|
115
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
116
|
+
while (1) {
|
|
117
|
+
switch (_context3.prev = _context3.next) {
|
|
118
|
+
case 0:
|
|
119
|
+
_context3.next = 2;
|
|
120
|
+
return elementHandle.boundingBox();
|
|
121
|
+
|
|
122
|
+
case 2:
|
|
123
|
+
boundingBox = _context3.sent;
|
|
124
|
+
|
|
125
|
+
if (boundingBox) {
|
|
126
|
+
_context3.next = 5;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
throw "No bounding box";
|
|
131
|
+
|
|
132
|
+
case 5:
|
|
133
|
+
return _context3.abrupt("return", boundingBox);
|
|
134
|
+
|
|
135
|
+
case 6:
|
|
136
|
+
case "end":
|
|
137
|
+
return _context3.stop();
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}, _callee3);
|
|
141
|
+
}));
|
|
142
|
+
|
|
143
|
+
return function getRect(_x4) {
|
|
144
|
+
return _ref3.apply(this, arguments);
|
|
145
|
+
};
|
|
146
|
+
}();
|
|
147
|
+
|
|
148
|
+
var getTreeStructure = /*#__PURE__*/function () {
|
|
149
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(page) {
|
|
150
|
+
var structure;
|
|
151
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
152
|
+
while (1) {
|
|
153
|
+
switch (_context4.prev = _context4.next) {
|
|
154
|
+
case 0:
|
|
155
|
+
_context4.next = 2;
|
|
156
|
+
return page.evaluate("\n ;\n function getTreeNode($li) {\n const $div = $li.children(\"div.jqtree-element\");\n const $span = $div.children(\"span.jqtree-title\");\n const name = $span.text();\n const selected = $li.hasClass(\"jqtree-selected\");\n\n if ($li.hasClass(\"jqtree-folder\")) {\n const $ul = $li.children(\"ul.jqtree_common\");\n\n return {\n nodeType: \"folder\",\n children: getChildren($ul),\n name,\n open: !$li.hasClass(\"jqtree-closed\"),\n selected,\n };\n } else {\n return {\n nodeType: \"child\",\n name,\n selected,\n };\n }\n }\n\n function getChildren($ul) {\n return $ul\n .children(\"li.jqtree_common\")\n .map((_, li) => {\n return getTreeNode(jQuery(li));\n })\n .get();\n }\n\n JSON.stringify(window.getChildren(jQuery(\"ul.jqtree-tree\")));\n");
|
|
157
|
+
|
|
158
|
+
case 2:
|
|
159
|
+
structure = _context4.sent;
|
|
160
|
+
return _context4.abrupt("return", JSON.parse(structure));
|
|
161
|
+
|
|
162
|
+
case 4:
|
|
163
|
+
case "end":
|
|
164
|
+
return _context4.stop();
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}, _callee4);
|
|
168
|
+
}));
|
|
169
|
+
|
|
170
|
+
return function getTreeStructure(_x5) {
|
|
171
|
+
return _ref4.apply(this, arguments);
|
|
172
|
+
};
|
|
173
|
+
}();
|
|
174
|
+
|
|
175
|
+
exports.getTreeStructure = getTreeStructure;
|
|
176
|
+
|
|
177
|
+
var getNodeRect = /*#__PURE__*/function () {
|
|
178
|
+
var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(page, title) {
|
|
179
|
+
var titleElement, rect;
|
|
180
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
181
|
+
while (1) {
|
|
182
|
+
switch (_context5.prev = _context5.next) {
|
|
183
|
+
case 0:
|
|
184
|
+
_context5.next = 2;
|
|
185
|
+
return locateTitle(page, title).elementHandle();
|
|
186
|
+
|
|
187
|
+
case 2:
|
|
188
|
+
titleElement = _context5.sent;
|
|
189
|
+
|
|
190
|
+
if (titleElement) {
|
|
191
|
+
_context5.next = 5;
|
|
192
|
+
break;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
throw Error("Element not found");
|
|
196
|
+
|
|
197
|
+
case 5:
|
|
198
|
+
_context5.next = 7;
|
|
199
|
+
return getRect(titleElement);
|
|
200
|
+
|
|
201
|
+
case 7:
|
|
202
|
+
rect = _context5.sent;
|
|
203
|
+
return _context5.abrupt("return", rect);
|
|
204
|
+
|
|
205
|
+
case 9:
|
|
206
|
+
case "end":
|
|
207
|
+
return _context5.stop();
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}, _callee5);
|
|
211
|
+
}));
|
|
212
|
+
|
|
213
|
+
return function getNodeRect(_x6, _x7) {
|
|
214
|
+
return _ref5.apply(this, arguments);
|
|
215
|
+
};
|
|
216
|
+
}();
|
|
217
|
+
|
|
218
|
+
var dragAndDrop = /*#__PURE__*/function () {
|
|
219
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(page, from, to) {
|
|
220
|
+
var fromRect, toRect;
|
|
221
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
222
|
+
while (1) {
|
|
223
|
+
switch (_context6.prev = _context6.next) {
|
|
224
|
+
case 0:
|
|
225
|
+
_context6.next = 2;
|
|
226
|
+
return getNodeRect(page, from);
|
|
227
|
+
|
|
228
|
+
case 2:
|
|
229
|
+
fromRect = _context6.sent;
|
|
230
|
+
_context6.next = 5;
|
|
231
|
+
return getNodeRect(page, to);
|
|
232
|
+
|
|
233
|
+
case 5:
|
|
234
|
+
toRect = _context6.sent;
|
|
235
|
+
_context6.next = 8;
|
|
236
|
+
return page.mouse.move(fromRect.x + fromRect.width / 2, fromRect.y + fromRect.height / 2);
|
|
237
|
+
|
|
238
|
+
case 8:
|
|
239
|
+
_context6.next = 10;
|
|
240
|
+
return page.mouse.down();
|
|
241
|
+
|
|
242
|
+
case 10:
|
|
243
|
+
_context6.next = 12;
|
|
244
|
+
return page.waitForTimeout(200);
|
|
245
|
+
|
|
246
|
+
case 12:
|
|
247
|
+
_context6.next = 14;
|
|
248
|
+
return page.mouse.move(toRect.x + toRect.width / 2, toRect.y + toRect.height / 2);
|
|
249
|
+
|
|
250
|
+
case 14:
|
|
251
|
+
_context6.next = 16;
|
|
252
|
+
return page.mouse.up();
|
|
253
|
+
|
|
254
|
+
case 16:
|
|
255
|
+
case "end":
|
|
256
|
+
return _context6.stop();
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}, _callee6);
|
|
260
|
+
}));
|
|
261
|
+
|
|
262
|
+
return function dragAndDrop(_x8, _x9, _x10) {
|
|
263
|
+
return _ref6.apply(this, arguments);
|
|
264
|
+
};
|
|
265
|
+
}();
|
|
266
|
+
|
|
267
|
+
exports.dragAndDrop = dragAndDrop;
|
|
@@ -15,14 +15,22 @@ var _testUtil = require("../support/testUtil");
|
|
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
16
|
|
|
17
17
|
var context = describe;
|
|
18
|
+
var server = (0, _node.setupServer)();
|
|
19
|
+
beforeAll(function () {
|
|
20
|
+
return server.listen();
|
|
21
|
+
});
|
|
18
22
|
beforeEach(function () {
|
|
19
23
|
$("body").append('<div id="tree1"></div>');
|
|
20
24
|
});
|
|
21
25
|
afterEach(function () {
|
|
26
|
+
server.resetHandlers();
|
|
22
27
|
var $tree = $("#tree1");
|
|
23
28
|
$tree.tree("destroy");
|
|
24
29
|
$tree.remove();
|
|
25
30
|
});
|
|
31
|
+
afterAll(function () {
|
|
32
|
+
return server.close();
|
|
33
|
+
});
|
|
26
34
|
describe("tree.click", function () {
|
|
27
35
|
var given = (0, _givens["default"])();
|
|
28
36
|
given("node1", function () {
|
|
@@ -126,17 +134,10 @@ describe("tree.init", function () {
|
|
|
126
134
|
});
|
|
127
135
|
});
|
|
128
136
|
context("with data loaded from an url", function () {
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
server = (0, _node.setupServer)(_msw.rest.get("/tree/", function (_request, response, ctx) {
|
|
137
|
+
beforeEach(function () {
|
|
138
|
+
server.use(_msw.rest.get("/tree/", function (_request, response, ctx) {
|
|
132
139
|
return response(ctx.status(200), ctx.json(_exampleData["default"]));
|
|
133
140
|
}));
|
|
134
|
-
server.listen();
|
|
135
|
-
});
|
|
136
|
-
afterAll(function () {
|
|
137
|
-
var _server;
|
|
138
|
-
|
|
139
|
-
(_server = server) === null || _server === void 0 ? void 0 : _server.close();
|
|
140
141
|
});
|
|
141
142
|
it("is called", function () {
|
|
142
143
|
return new Promise(function (done) {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
|
4
|
+
|
|
3
5
|
var _givens = _interopRequireDefault(require("givens"));
|
|
4
6
|
|
|
5
7
|
var _dom = require("@testing-library/dom");
|
|
@@ -14,20 +16,30 @@ var _testUtil = require("../support/testUtil");
|
|
|
14
16
|
|
|
15
17
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
18
|
|
|
19
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return generator._invoke = function (innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; }(innerFn, self, context), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; this._invoke = function (method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); }; } function maybeInvokeDelegate(delegate, context) { var method = delegate.iterator[context.method]; if (undefined === method) { if (context.delegate = null, "throw" === context.method) { if (delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method)) return ContinueSentinel; context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method"); } return ContinueSentinel; } var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) { if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; } return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (object) { var keys = []; for (var key in object) { keys.push(key); } return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) { "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); } }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
20
|
+
|
|
17
21
|
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
22
|
|
|
19
23
|
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); }); }; }
|
|
20
24
|
|
|
21
25
|
var context = describe;
|
|
26
|
+
var server = (0, _node.setupServer)();
|
|
27
|
+
beforeAll(function () {
|
|
28
|
+
return server.listen();
|
|
29
|
+
});
|
|
22
30
|
beforeEach(function () {
|
|
23
31
|
$("body").append('<div id="tree1"></div>');
|
|
24
32
|
});
|
|
25
33
|
afterEach(function () {
|
|
34
|
+
server.resetHandlers();
|
|
26
35
|
var $tree = $("#tree1");
|
|
27
36
|
$tree.tree("destroy");
|
|
28
37
|
$tree.remove();
|
|
29
38
|
localStorage.clear();
|
|
30
39
|
});
|
|
40
|
+
afterAll(function () {
|
|
41
|
+
return server.close();
|
|
42
|
+
});
|
|
31
43
|
context("when a node has load_on_demand in the data", function () {
|
|
32
44
|
var given = (0, _givens["default"])();
|
|
33
45
|
given("autoOpen", function () {
|
|
@@ -41,9 +53,8 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
41
53
|
name: "parent-node",
|
|
42
54
|
load_on_demand: true
|
|
43
55
|
}];
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
server = (0, _node.setupServer)(_msw.rest.get("/tree/", function (request, response, ctx) {
|
|
56
|
+
beforeEach(function () {
|
|
57
|
+
server.use(_msw.rest.get("/tree/", function (request, response, ctx) {
|
|
47
58
|
var parentId = request.url.searchParams.get("node");
|
|
48
59
|
|
|
49
60
|
if (parentId === "1") {
|
|
@@ -55,12 +66,6 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
55
66
|
return response(ctx.status(400));
|
|
56
67
|
}
|
|
57
68
|
}));
|
|
58
|
-
server.listen();
|
|
59
|
-
});
|
|
60
|
-
afterAll(function () {
|
|
61
|
-
var _server;
|
|
62
|
-
|
|
63
|
-
(_server = server) === null || _server === void 0 ? void 0 : _server.close();
|
|
64
69
|
});
|
|
65
70
|
beforeEach(function () {
|
|
66
71
|
if (given.savedState) {
|
|
@@ -85,8 +90,8 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
85
90
|
given("node", function () {
|
|
86
91
|
return given.$tree.tree("getNodeByNameMustExist", "parent-node");
|
|
87
92
|
});
|
|
88
|
-
it("loads the subtree", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
89
|
-
return
|
|
93
|
+
it("loads the subtree", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
94
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
90
95
|
while (1) {
|
|
91
96
|
switch (_context.prev = _context.next) {
|
|
92
97
|
case 0:
|
|
@@ -114,8 +119,8 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
114
119
|
beforeEach(function () {
|
|
115
120
|
given.$tree.tree("selectNode", given.node);
|
|
116
121
|
});
|
|
117
|
-
it("keeps the node selected and focused", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
118
|
-
return
|
|
122
|
+
it("keeps the node selected and focused", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
123
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
119
124
|
while (1) {
|
|
120
125
|
switch (_context2.prev = _context2.next) {
|
|
121
126
|
case 0:
|
|
@@ -138,8 +143,8 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
138
143
|
})));
|
|
139
144
|
});
|
|
140
145
|
context("when the node is not selected", function () {
|
|
141
|
-
it("doesn't select the node", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
142
|
-
return
|
|
146
|
+
it("doesn't select the node", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
147
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
143
148
|
while (1) {
|
|
144
149
|
switch (_context3.prev = _context3.next) {
|
|
145
150
|
case 0:
|
|
@@ -164,8 +169,8 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
164
169
|
given.$tree.tree("selectNode", given.node);
|
|
165
170
|
document.activeElement.blur();
|
|
166
171
|
});
|
|
167
|
-
it("keeps the node selected and not focused", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
168
|
-
return
|
|
172
|
+
it("keeps the node selected and not focused", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
173
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
169
174
|
while (1) {
|
|
170
175
|
switch (_context4.prev = _context4.next) {
|
|
171
176
|
case 0:
|
|
@@ -192,8 +197,8 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
192
197
|
given("autoOpen", function () {
|
|
193
198
|
return true;
|
|
194
199
|
});
|
|
195
|
-
it("loads the node on demand", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
196
|
-
return
|
|
200
|
+
it("loads the node on demand", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
201
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
197
202
|
while (1) {
|
|
198
203
|
switch (_context5.prev = _context5.next) {
|
|
199
204
|
case 0:
|
|
@@ -221,8 +226,8 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
221
226
|
given("savedState", function () {
|
|
222
227
|
return '{"open_nodes":[1],"selected_node":[]}';
|
|
223
228
|
});
|
|
224
|
-
it("opens the node and loads its children on demand", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
225
|
-
return
|
|
229
|
+
it("opens the node and loads its children on demand", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
230
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
226
231
|
while (1) {
|
|
227
232
|
switch (_context6.prev = _context6.next) {
|
|
228
233
|
case 0:
|