jqtree 1.6.2 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +3 -12
- package/.github/workflows/ci.yml +57 -30
- package/.github/workflows/codeql-analysis.yml +9 -5
- package/.prettier +3 -0
- package/.tool-versions +1 -0
- package/README.md +12 -9
- package/bower.json +10 -3
- 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.mjs} +3 -8
- 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 +13 -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/docs/_entries/93_getnextnode.md +15 -0
- package/{_entries → docs/_entries}/94_getnextsibling.md +0 -0
- package/{_entries/95_getpreviousnode.md → docs/_entries/95_getnextvisiblenode.md} +1 -1
- package/docs/_entries/96_getpreviousnode.md +0 -0
- package/{_entries/96_getprevioussibling.md → docs/_entries/97_getprevioussibling.md} +0 -0
- package/docs/_entries/98_getpreviousvisiblenode.md +14 -0
- package/{_entries/97_parent.md → docs/_entries/99_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 +798 -0
- package/docs/postcss.config.js +7 -0
- package/{static → docs/static}/bower.json +1 -2
- 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 +209 -97
- package/docs/static/bower_components/jquery/dist/jquery.min.js +2 -0
- package/{static → docs/static}/bower_components/jquery-mockjax/dist/jquery.mockjax.js +0 -0
- package/docs/static/documentation.css +1453 -0
- package/docs/static/documentation.js +26 -0
- package/{static → docs/static}/example.css +5 -38
- 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/dataLoader.js +5 -31
- package/lib/dragAndDropHandler.js +26 -135
- package/lib/elementsRenderer.js +29 -59
- package/lib/keyHandler.js +8 -32
- package/lib/mouse.widget.js +16 -77
- package/lib/node.js +60 -125
- package/lib/nodeElement.js +8 -75
- package/lib/playwright/coverage.js +101 -0
- package/lib/playwright/playwright.test.js +212 -182
- package/lib/playwright/testUtils.js +201 -0
- package/lib/saveStateHandler.js +12 -61
- package/lib/scrollHandler.js +17 -74
- package/lib/selectNodeHandler.js +5 -24
- package/lib/simple.widget.js +18 -53
- package/lib/test/jqTree/create.test.js +0 -4
- package/lib/test/jqTree/events.test.js +10 -16
- package/lib/test/jqTree/keyboard.test.js +0 -6
- package/lib/test/jqTree/loadOnDemand.test.js +107 -139
- package/lib/test/jqTree/methods.test.js +136 -159
- package/lib/test/jqTree/options.test.js +53 -63
- package/lib/test/node.test.js +127 -72
- package/lib/test/nodeUtil.test.js +0 -1
- package/lib/test/support/jqTreeMatchers.js +4 -9
- package/lib/test/support/setupTests.js +0 -4
- package/lib/test/support/testUtil.js +2 -11
- package/lib/test/support/treeStructure.js +0 -6
- package/lib/test/util.test.js +0 -1
- package/lib/tree.jquery.js +32 -243
- package/lib/util.js +0 -6
- package/lib/version.js +1 -1
- package/package.json +54 -54
- package/src/dragAndDropHandler.ts +8 -4
- package/src/jqtreeOptions.ts +1 -1
- package/src/keyHandler.ts +3 -3
- package/src/node.ts +43 -12
- 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 +15 -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/test/node.test.ts +146 -54
- package/src/tree.jquery.d.ts +1 -1
- package/src/tree.jquery.ts +6 -5
- package/src/version.ts +1 -1
- package/tree.jquery.debug.js +217 -867
- 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/_entries/93_getnextnode.md +0 -12
- 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/bower_components/jquery/dist/jquery.min.js +0 -2
- package/static/documentation.css +0 -171
- package/static/documentation.js +0 -48
|
@@ -1,33 +1,34 @@
|
|
|
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); }
|
|
3
4
|
var _givens = _interopRequireDefault(require("givens"));
|
|
4
|
-
|
|
5
5
|
var _dom = require("@testing-library/dom");
|
|
6
|
-
|
|
7
6
|
var _msw = require("msw");
|
|
8
|
-
|
|
9
7
|
var _node = require("msw/node");
|
|
10
|
-
|
|
11
8
|
require("../../tree.jquery");
|
|
12
|
-
|
|
13
9
|
var _testUtil = require("../support/testUtil");
|
|
14
|
-
|
|
15
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
16
|
-
|
|
11
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
|
|
17
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); } }
|
|
18
|
-
|
|
19
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); }); }; }
|
|
20
|
-
|
|
21
14
|
var context = describe;
|
|
15
|
+
var server = (0, _node.setupServer)();
|
|
16
|
+
beforeAll(function () {
|
|
17
|
+
return server.listen();
|
|
18
|
+
});
|
|
22
19
|
beforeEach(function () {
|
|
23
20
|
$("body").append('<div id="tree1"></div>');
|
|
24
21
|
});
|
|
25
22
|
afterEach(function () {
|
|
23
|
+
server.resetHandlers();
|
|
26
24
|
var $tree = $("#tree1");
|
|
27
25
|
$tree.tree("destroy");
|
|
28
26
|
$tree.remove();
|
|
29
27
|
localStorage.clear();
|
|
30
28
|
});
|
|
29
|
+
afterAll(function () {
|
|
30
|
+
return server.close();
|
|
31
|
+
});
|
|
31
32
|
context("when a node has load_on_demand in the data", function () {
|
|
32
33
|
var given = (0, _givens["default"])();
|
|
33
34
|
given("autoOpen", function () {
|
|
@@ -41,11 +42,9 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
41
42
|
name: "parent-node",
|
|
42
43
|
load_on_demand: true
|
|
43
44
|
}];
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
server = (0, _node.setupServer)(_msw.rest.get("/tree/", function (request, response, ctx) {
|
|
45
|
+
beforeEach(function () {
|
|
46
|
+
server.use(_msw.rest.get("/tree/", function (request, response, ctx) {
|
|
47
47
|
var parentId = request.url.searchParams.get("node");
|
|
48
|
-
|
|
49
48
|
if (parentId === "1") {
|
|
50
49
|
return response(ctx.status(200), ctx.json([{
|
|
51
50
|
id: 2,
|
|
@@ -55,18 +54,11 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
55
54
|
return response(ctx.status(400));
|
|
56
55
|
}
|
|
57
56
|
}));
|
|
58
|
-
server.listen();
|
|
59
|
-
});
|
|
60
|
-
afterAll(function () {
|
|
61
|
-
var _server;
|
|
62
|
-
|
|
63
|
-
(_server = server) === null || _server === void 0 ? void 0 : _server.close();
|
|
64
57
|
});
|
|
65
58
|
beforeEach(function () {
|
|
66
59
|
if (given.savedState) {
|
|
67
60
|
localStorage.setItem("tree", given.savedState);
|
|
68
61
|
}
|
|
69
|
-
|
|
70
62
|
given.$tree.tree({
|
|
71
63
|
autoOpen: given.autoOpen,
|
|
72
64
|
data: initialData,
|
|
@@ -85,28 +77,24 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
85
77
|
given("node", function () {
|
|
86
78
|
return given.$tree.tree("getNodeByNameMustExist", "parent-node");
|
|
87
79
|
});
|
|
88
|
-
it("loads the subtree", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
89
|
-
return
|
|
90
|
-
while (1) {
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
case 4:
|
|
107
|
-
case "end":
|
|
108
|
-
return _context.stop();
|
|
109
|
-
}
|
|
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();
|
|
110
98
|
}
|
|
111
99
|
}, _callee);
|
|
112
100
|
})));
|
|
@@ -114,47 +102,39 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
114
102
|
beforeEach(function () {
|
|
115
103
|
given.$tree.tree("selectNode", given.node);
|
|
116
104
|
});
|
|
117
|
-
it("keeps the node selected and focused", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
118
|
-
return
|
|
119
|
-
while (1) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
case 7:
|
|
133
|
-
case "end":
|
|
134
|
-
return _context2.stop();
|
|
135
|
-
}
|
|
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();
|
|
136
120
|
}
|
|
137
121
|
}, _callee2);
|
|
138
122
|
})));
|
|
139
123
|
});
|
|
140
124
|
context("when the node is not selected", function () {
|
|
141
|
-
it("doesn't select the node", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
142
|
-
return
|
|
143
|
-
while (1) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
case 5:
|
|
155
|
-
case "end":
|
|
156
|
-
return _context3.stop();
|
|
157
|
-
}
|
|
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();
|
|
158
138
|
}
|
|
159
139
|
}, _callee3);
|
|
160
140
|
})));
|
|
@@ -164,25 +144,21 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
164
144
|
given.$tree.tree("selectNode", given.node);
|
|
165
145
|
document.activeElement.blur();
|
|
166
146
|
});
|
|
167
|
-
it("keeps the node selected and not focused", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
168
|
-
return
|
|
169
|
-
while (1) {
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
case 7:
|
|
183
|
-
case "end":
|
|
184
|
-
return _context4.stop();
|
|
185
|
-
}
|
|
147
|
+
it("keeps the node selected and not focused", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
148
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
149
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
150
|
+
case 0:
|
|
151
|
+
expect(given.node.element).toBeSelected();
|
|
152
|
+
expect(given.node.element).not.toBeFocused();
|
|
153
|
+
(0, _testUtil.togglerLink)(given.node.element).trigger("click");
|
|
154
|
+
_context4.next = 5;
|
|
155
|
+
return _dom.screen.findByText("loaded-on-demand");
|
|
156
|
+
case 5:
|
|
157
|
+
expect(given.node.element).toBeSelected();
|
|
158
|
+
expect(given.node.element).not.toBeFocused();
|
|
159
|
+
case 7:
|
|
160
|
+
case "end":
|
|
161
|
+
return _context4.stop();
|
|
186
162
|
}
|
|
187
163
|
}, _callee4);
|
|
188
164
|
})));
|
|
@@ -192,27 +168,23 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
192
168
|
given("autoOpen", function () {
|
|
193
169
|
return true;
|
|
194
170
|
});
|
|
195
|
-
it("loads the node on demand", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
196
|
-
return
|
|
197
|
-
while (1) {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
case 3:
|
|
213
|
-
case "end":
|
|
214
|
-
return _context5.stop();
|
|
215
|
-
}
|
|
171
|
+
it("loads the node on demand", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
172
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
173
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
174
|
+
case 0:
|
|
175
|
+
_context5.next = 2;
|
|
176
|
+
return _dom.screen.findByText("loaded-on-demand");
|
|
177
|
+
case 2:
|
|
178
|
+
expect(given.$tree).toHaveTreeStructure([expect.objectContaining({
|
|
179
|
+
name: "parent-node",
|
|
180
|
+
open: true,
|
|
181
|
+
children: [expect.objectContaining({
|
|
182
|
+
name: "loaded-on-demand"
|
|
183
|
+
})]
|
|
184
|
+
})]);
|
|
185
|
+
case 3:
|
|
186
|
+
case "end":
|
|
187
|
+
return _context5.stop();
|
|
216
188
|
}
|
|
217
189
|
}, _callee5);
|
|
218
190
|
})));
|
|
@@ -221,27 +193,23 @@ context("when a node has load_on_demand in the data", function () {
|
|
|
221
193
|
given("savedState", function () {
|
|
222
194
|
return '{"open_nodes":[1],"selected_node":[]}';
|
|
223
195
|
});
|
|
224
|
-
it("opens the node and loads its children on demand", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/
|
|
225
|
-
return
|
|
226
|
-
while (1) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
case 3:
|
|
242
|
-
case "end":
|
|
243
|
-
return _context6.stop();
|
|
244
|
-
}
|
|
196
|
+
it("opens the node and loads its children on demand", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
197
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
198
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
199
|
+
case 0:
|
|
200
|
+
_context6.next = 2;
|
|
201
|
+
return _dom.screen.findByText("loaded-on-demand");
|
|
202
|
+
case 2:
|
|
203
|
+
expect(given.$tree).toHaveTreeStructure([expect.objectContaining({
|
|
204
|
+
name: "parent-node",
|
|
205
|
+
open: true,
|
|
206
|
+
children: [expect.objectContaining({
|
|
207
|
+
name: "loaded-on-demand"
|
|
208
|
+
})]
|
|
209
|
+
})]);
|
|
210
|
+
case 3:
|
|
211
|
+
case "end":
|
|
212
|
+
return _context6.stop();
|
|
245
213
|
}
|
|
246
214
|
}, _callee6);
|
|
247
215
|
})));
|