@lvce-editor/renderer-process 15.2.0 → 15.3.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.
@@ -953,6 +953,11 @@ const render = (elements, eventMap = {}, newEventMap = {}) => {
953
953
  renderInternal($Root, elements, eventMap, newEventMap);
954
954
  return $Root;
955
955
  };
956
+ const focusElement = $Element => {
957
+ $Element.focus({
958
+ preventScroll: true
959
+ });
960
+ };
956
961
  const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
957
962
  startIgnore();
958
963
  const oldLeft = $Viewlet.style.left;
@@ -1004,18 +1009,18 @@ const rememberFocus$1 = ($Viewlet, dom, eventMap, uid = 0) => {
1004
1009
  renderInto($Viewlet, dom, eventMap);
1005
1010
  }
1006
1011
  if (isRootTree) {
1007
- $Viewlet.focus();
1012
+ focusElement($Viewlet);
1008
1013
  } else if (isTreeFocused) {
1009
1014
  const $Tree = $Viewlet.querySelector('[role="tree"]');
1010
1015
  if ($Tree) {
1011
1016
  // @ts-ignore
1012
- $Tree.focus();
1017
+ focusElement($Tree);
1013
1018
  }
1014
1019
  } else if (focused) {
1015
1020
  const $Focused = $Viewlet.querySelector(`[name="${focused}"]`);
1016
1021
  if ($Focused) {
1017
1022
  // @ts-ignore
1018
- $Focused.focus();
1023
+ focusElement($Focused);
1019
1024
  }
1020
1025
  }
1021
1026
  $Viewlet.style.top = oldTop;
@@ -3645,7 +3650,7 @@ const toHaveAttribute$1 = (element, {
3645
3650
  const attribute = element.getAttribute(key);
3646
3651
  return attribute === value;
3647
3652
  };
3648
- const toHaveJSProperty = (element, {
3653
+ const toHaveJSProperty$1 = (element, {
3649
3654
  key,
3650
3655
  value
3651
3656
  }) => {
@@ -3686,7 +3691,7 @@ const SingleElementConditions = {
3686
3691
  toHaveClass: toHaveClass$1,
3687
3692
  toHaveCss: toHaveCss$1,
3688
3693
  toHaveId: toHaveId$1,
3689
- toHaveJSProperty,
3694
+ toHaveJSProperty: toHaveJSProperty$1,
3690
3695
  toHaveText: toHaveText$1,
3691
3696
  toHaveValue
3692
3697
  };
@@ -3798,6 +3803,22 @@ const toHaveCss = (locator, {
3798
3803
  actual
3799
3804
  };
3800
3805
  };
3806
+ const toHaveJSProperty = (locator, {
3807
+ key
3808
+ }) => {
3809
+ const [element] = querySelector(locator._selector);
3810
+ if (!element) {
3811
+ return {
3812
+ wasFound: false,
3813
+ actual: ''
3814
+ };
3815
+ }
3816
+ const actual = element[key];
3817
+ return {
3818
+ wasFound: true,
3819
+ actual
3820
+ };
3821
+ };
3801
3822
 
3802
3823
  const ConditionValues = {
3803
3824
  __proto__: null,
@@ -3807,6 +3828,7 @@ const ConditionValues = {
3807
3828
  toHaveCount,
3808
3829
  toHaveCss,
3809
3830
  toHaveId,
3831
+ toHaveJSProperty,
3810
3832
  toHaveText
3811
3833
  };
3812
3834
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/renderer-process",
3
- "version": "15.2.0",
3
+ "version": "15.3.0",
4
4
  "description": "",
5
5
  "keywords": [
6
6
  "lvce-editor",