@testing-library/user-event 14.6.7 → 14.6.8

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.
@@ -15,7 +15,8 @@ function prepareInterceptor(element, propName, interceptorImpl) {
15
15
  }
16
16
  function intercept(...args) {
17
17
  const { applyNative = false, realArgs, then } = interceptorImpl.call(this, ...args);
18
- const realFunc = (!applyNative && objectDescriptor || prototypeDescriptor)[target];
18
+ const sourceDescriptor = !applyNative && objectDescriptor ? objectDescriptor : prototypeDescriptor;
19
+ const realFunc = sourceDescriptor === null || sourceDescriptor === void 0 ? void 0 : sourceDescriptor[target];
19
20
  if (target === 'set') {
20
21
  realFunc.call(this, realArgs);
21
22
  } else {
@@ -31,14 +32,16 @@ function prepareInterceptor(element, propName, interceptorImpl) {
31
32
  }
32
33
  function prepareValueInterceptor(element) {
33
34
  prepareInterceptor(element, 'value', function interceptorImpl(v) {
34
- const isUI = UI.isUIValue(v);
35
+ // `value` is a [LegacyNullToEmptyString] DOMString.
36
+ const value = v === null ? '' : v;
37
+ const isUI = UI.isUIValue(value);
35
38
  if (isUI) {
36
39
  trackValue.startTrackValue(this);
37
40
  }
38
41
  return {
39
42
  applyNative: !!isUI,
40
- realArgs: sanitizeValue(this, v),
41
- then: isUI ? undefined : ()=>trackValue.trackOrSetValue(this, String(v))
43
+ realArgs: sanitizeValue(this, value),
44
+ then: isUI ? undefined : ()=>trackValue.trackOrSetValue(this, String(value))
42
45
  };
43
46
  });
44
47
  }
@@ -13,7 +13,8 @@ function prepareInterceptor(element, propName, interceptorImpl) {
13
13
  }
14
14
  function intercept(...args) {
15
15
  const { applyNative = false, realArgs, then } = interceptorImpl.call(this, ...args);
16
- const realFunc = (!applyNative && objectDescriptor || prototypeDescriptor)[target];
16
+ const sourceDescriptor = !applyNative && objectDescriptor ? objectDescriptor : prototypeDescriptor;
17
+ const realFunc = sourceDescriptor === null || sourceDescriptor === void 0 ? void 0 : sourceDescriptor[target];
17
18
  if (target === 'set') {
18
19
  realFunc.call(this, realArgs);
19
20
  } else {
@@ -29,14 +30,16 @@ function prepareInterceptor(element, propName, interceptorImpl) {
29
30
  }
30
31
  function prepareValueInterceptor(element) {
31
32
  prepareInterceptor(element, 'value', function interceptorImpl(v) {
32
- const isUI = isUIValue(v);
33
+ // `value` is a [LegacyNullToEmptyString] DOMString.
34
+ const value = v === null ? '' : v;
35
+ const isUI = isUIValue(value);
33
36
  if (isUI) {
34
37
  startTrackValue(this);
35
38
  }
36
39
  return {
37
40
  applyNative: !!isUI,
38
- realArgs: sanitizeValue(this, v),
39
- then: isUI ? undefined : ()=>trackOrSetValue(this, String(v))
41
+ realArgs: sanitizeValue(this, value),
42
+ then: isUI ? undefined : ()=>trackOrSetValue(this, String(value))
40
43
  };
41
44
  });
42
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@testing-library/user-event",
3
- "version": "14.6.7",
3
+ "version": "14.6.8",
4
4
  "description": "Fire events the same way the user does",
5
5
  "keywords": [
6
6
  "react-testing-library",