@enact/core 4.7.1 → 4.7.2
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/CHANGELOG.md +6 -0
- package/handle/handle.js +11 -11
- package/handle/tests/handle-specs.js +185 -0
- package/package.json +1 -1
- package/platform/platform.js +11 -5
- package/platform/tests/platform-specs.js +66 -0
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
The following is a curated list of changes in the Enact core module, newest changes on the top.
|
|
4
4
|
|
|
5
|
+
## [4.7.2] - 2023-07-14
|
|
6
|
+
|
|
7
|
+
### Fixed
|
|
8
|
+
|
|
9
|
+
- `core/handle.forwardCustom` and `core/handle.forwardCustomWithPrevent` to bind an adapter function properly
|
|
10
|
+
|
|
5
11
|
## [4.7.1] - 2023-06-02
|
|
6
12
|
|
|
7
13
|
No significant changes.
|
package/handle/handle.js
CHANGED
|
@@ -751,11 +751,11 @@ var adaptEvent = handle.adaptEvent = (0, _curry["default"])(function (adapter, h
|
|
|
751
751
|
*/
|
|
752
752
|
exports.adaptEvent = adaptEvent;
|
|
753
753
|
var forwardCustom = handle.forwardCustom = function (name, adapter) {
|
|
754
|
-
return
|
|
754
|
+
return named(adaptEvent(function (ev) {
|
|
755
755
|
for (var _len7 = arguments.length, args = new Array(_len7 > 1 ? _len7 - 1 : 0), _key7 = 1; _key7 < _len7; _key7++) {
|
|
756
756
|
args[_key7 - 1] = arguments[_key7];
|
|
757
757
|
}
|
|
758
|
-
var customEventPayload = adapter ? adapter.apply(
|
|
758
|
+
var customEventPayload = adapter ? adapter.call.apply(adapter, [this, ev].concat(args)) : null;
|
|
759
759
|
|
|
760
760
|
// Handle either no adapter or a non-object return from the adapter
|
|
761
761
|
if (!customEventPayload || typeof customEventPayload !== 'object') {
|
|
@@ -769,7 +769,7 @@ var forwardCustom = handle.forwardCustom = function (name, adapter) {
|
|
|
769
769
|
customEventPayload.stopPropagation = ev.stopPropagation.bind(ev);
|
|
770
770
|
}
|
|
771
771
|
return customEventPayload;
|
|
772
|
-
}, forward(name))
|
|
772
|
+
}, forward(name)), 'forwardCustom');
|
|
773
773
|
};
|
|
774
774
|
|
|
775
775
|
/**
|
|
@@ -814,14 +814,14 @@ var forwardCustom = handle.forwardCustom = function (name, adapter) {
|
|
|
814
814
|
* @private
|
|
815
815
|
*/
|
|
816
816
|
exports.forwardCustom = forwardCustom;
|
|
817
|
-
var forwardCustomWithPrevent = handle.forwardCustomWithPrevent =
|
|
818
|
-
return function (ev) {
|
|
817
|
+
var forwardCustomWithPrevent = handle.forwardCustomWithPrevent = function (name, adapter) {
|
|
818
|
+
return named(function (ev) {
|
|
819
819
|
for (var _len8 = arguments.length, args = new Array(_len8 > 1 ? _len8 - 1 : 0), _key8 = 1; _key8 < _len8; _key8++) {
|
|
820
820
|
args[_key8 - 1] = arguments[_key8];
|
|
821
821
|
}
|
|
822
822
|
var prevented = false;
|
|
823
|
-
|
|
824
|
-
var customEventPayload = adapter ? adapter.apply(
|
|
823
|
+
function adapterWithPrevent() {
|
|
824
|
+
var customEventPayload = adapter ? adapter.call.apply(adapter, [this, ev].concat(args)) : null;
|
|
825
825
|
var existingPreventDefault = null;
|
|
826
826
|
|
|
827
827
|
// Handle either no adapter or a non-object return from the adapter
|
|
@@ -840,10 +840,10 @@ var forwardCustomWithPrevent = handle.forwardCustomWithPrevent = named(function
|
|
|
840
840
|
}
|
|
841
841
|
};
|
|
842
842
|
return customEventPayload;
|
|
843
|
-
}
|
|
844
|
-
return forwardCustom(name, adapterWithPrevent).apply(void 0, [ev].concat(args)) && !prevented;
|
|
845
|
-
};
|
|
846
|
-
}
|
|
843
|
+
}
|
|
844
|
+
return forwardCustom.call(this, name, adapterWithPrevent.bind(this)).apply(void 0, [ev].concat(args)) && !prevented;
|
|
845
|
+
}, 'forwardCustomWithPrevent');
|
|
846
|
+
};
|
|
847
847
|
|
|
848
848
|
/**
|
|
849
849
|
* Accepts a handler and returns the logical complement of the value returned from the handler.
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
4
|
+
var _react = require("react");
|
|
5
|
+
var _react2 = require("@testing-library/react");
|
|
3
6
|
var _handle = require("../handle");
|
|
7
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
10
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
|
11
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
|
12
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
13
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
14
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
15
|
+
function _possibleConstructorReturn(self, call) { if (call && (typeof call === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
16
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
17
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
18
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
4
19
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5
20
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
21
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -445,6 +460,91 @@ describe('handle', function () {
|
|
|
445
460
|
var actual = adapter.mock.calls[0];
|
|
446
461
|
expect(actual).toEqual(expected);
|
|
447
462
|
});
|
|
463
|
+
test('should support bound adapter function', function () {
|
|
464
|
+
var handler = jest.fn();
|
|
465
|
+
var expected = 'ok';
|
|
466
|
+
var obj = {
|
|
467
|
+
data: expected,
|
|
468
|
+
adapter: function adapter() {
|
|
469
|
+
return {
|
|
470
|
+
value: this === null || this === void 0 ? void 0 : this.data
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
};
|
|
474
|
+
var forwarderFn = (0, _handle.forwardCustom)('onCustomEvent', obj.adapter).bind(obj);
|
|
475
|
+
forwarderFn(null, {
|
|
476
|
+
onCustomEvent: handler
|
|
477
|
+
}, null);
|
|
478
|
+
var actual = handler.mock.calls[0][0];
|
|
479
|
+
expect(actual).toEqual(expect.objectContaining({
|
|
480
|
+
value: expected
|
|
481
|
+
}));
|
|
482
|
+
});
|
|
483
|
+
test('should support bound adapter function by call', function () {
|
|
484
|
+
var handler = jest.fn();
|
|
485
|
+
var expected = 'ok';
|
|
486
|
+
var obj = {
|
|
487
|
+
data: expected,
|
|
488
|
+
adapter: function adapter() {
|
|
489
|
+
return {
|
|
490
|
+
value: this === null || this === void 0 ? void 0 : this.data
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
};
|
|
494
|
+
var forwarderFn = (0, _handle.forwardCustom)('onCustomEvent', (0, _handle.call)('adapter')).bind(obj);
|
|
495
|
+
forwarderFn(null, {
|
|
496
|
+
onCustomEvent: handler
|
|
497
|
+
}, null);
|
|
498
|
+
var actual = handler.mock.calls[0][0];
|
|
499
|
+
expect(actual).toEqual(expect.objectContaining({
|
|
500
|
+
value: expected
|
|
501
|
+
}));
|
|
502
|
+
});
|
|
503
|
+
test('should support bound adapter function by handle', function () {
|
|
504
|
+
var handler = jest.fn();
|
|
505
|
+
var expected = 'ok';
|
|
506
|
+
var TestComponent = /*#__PURE__*/function (_Component) {
|
|
507
|
+
_inherits(TestComponent, _Component);
|
|
508
|
+
var _super = _createSuper(TestComponent);
|
|
509
|
+
function TestComponent(props) {
|
|
510
|
+
var _this;
|
|
511
|
+
_classCallCheck(this, TestComponent);
|
|
512
|
+
_this = _super.call(this, props);
|
|
513
|
+
_this.data = expected;
|
|
514
|
+
(0, _handle.handle)((0, _handle.forwardCustom)('onCustomEvent', (0, _handle.call)('adapter'))).bindAs(_assertThisInitialized(_this), 'handleCustomEvent');
|
|
515
|
+
return _this;
|
|
516
|
+
}
|
|
517
|
+
_createClass(TestComponent, [{
|
|
518
|
+
key: "componentDidMount",
|
|
519
|
+
value: function componentDidMount() {
|
|
520
|
+
this.handleCustomEvent(null, this.props, this.context);
|
|
521
|
+
}
|
|
522
|
+
}, {
|
|
523
|
+
key: "adapter",
|
|
524
|
+
value: function adapter() {
|
|
525
|
+
return {
|
|
526
|
+
value: this === null || this === void 0 ? void 0 : this.data
|
|
527
|
+
};
|
|
528
|
+
}
|
|
529
|
+
}, {
|
|
530
|
+
key: "render",
|
|
531
|
+
value: function render() {
|
|
532
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
|
|
533
|
+
}
|
|
534
|
+
}]);
|
|
535
|
+
return TestComponent;
|
|
536
|
+
}(_react.Component);
|
|
537
|
+
TestComponent.propTypes = {
|
|
538
|
+
onCustomEvent: _propTypes["default"].func
|
|
539
|
+
};
|
|
540
|
+
(0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TestComponent, {
|
|
541
|
+
onCustomEvent: handler
|
|
542
|
+
}));
|
|
543
|
+
var actual = handler.mock.calls[0][0];
|
|
544
|
+
expect(actual).toEqual(expect.objectContaining({
|
|
545
|
+
value: expected
|
|
546
|
+
}));
|
|
547
|
+
});
|
|
448
548
|
});
|
|
449
549
|
describe('#forwardCustomWithPrevent', function () {
|
|
450
550
|
test('should pass an object with `type` and `preventDefault` when no adapter is provided', function () {
|
|
@@ -524,6 +624,91 @@ describe('handle', function () {
|
|
|
524
624
|
var actual = adapter.mock.calls[0];
|
|
525
625
|
expect(actual).toEqual(expected);
|
|
526
626
|
});
|
|
627
|
+
test('should support bound adapter function', function () {
|
|
628
|
+
var handler = jest.fn();
|
|
629
|
+
var expected = 'ok';
|
|
630
|
+
var obj = {
|
|
631
|
+
data: expected,
|
|
632
|
+
adapter: function adapter() {
|
|
633
|
+
return {
|
|
634
|
+
value: this === null || this === void 0 ? void 0 : this.data
|
|
635
|
+
};
|
|
636
|
+
}
|
|
637
|
+
};
|
|
638
|
+
var forwarderFn = (0, _handle.forwardCustomWithPrevent)('onCustomEvent', obj.adapter).bind(obj);
|
|
639
|
+
forwarderFn(null, {
|
|
640
|
+
onCustomEvent: handler
|
|
641
|
+
}, null);
|
|
642
|
+
var actual = handler.mock.calls[0][0];
|
|
643
|
+
expect(actual).toEqual(expect.objectContaining({
|
|
644
|
+
value: expected
|
|
645
|
+
}));
|
|
646
|
+
});
|
|
647
|
+
test('should support bound adapter function by call', function () {
|
|
648
|
+
var handler = jest.fn();
|
|
649
|
+
var expected = 'ok';
|
|
650
|
+
var obj = {
|
|
651
|
+
data: expected,
|
|
652
|
+
adapter: function adapter() {
|
|
653
|
+
return {
|
|
654
|
+
value: this === null || this === void 0 ? void 0 : this.data
|
|
655
|
+
};
|
|
656
|
+
}
|
|
657
|
+
};
|
|
658
|
+
var forwarderFn = (0, _handle.forwardCustomWithPrevent)('onCustomEvent', (0, _handle.call)('adapter')).bind(obj);
|
|
659
|
+
forwarderFn(null, {
|
|
660
|
+
onCustomEvent: handler
|
|
661
|
+
}, null);
|
|
662
|
+
var actual = handler.mock.calls[0][0];
|
|
663
|
+
expect(actual).toEqual(expect.objectContaining({
|
|
664
|
+
value: expected
|
|
665
|
+
}));
|
|
666
|
+
});
|
|
667
|
+
test('should support bound adapter function by handle', function () {
|
|
668
|
+
var handler = jest.fn();
|
|
669
|
+
var expected = 'ok';
|
|
670
|
+
var TestComponent = /*#__PURE__*/function (_Component2) {
|
|
671
|
+
_inherits(TestComponent, _Component2);
|
|
672
|
+
var _super2 = _createSuper(TestComponent);
|
|
673
|
+
function TestComponent(props) {
|
|
674
|
+
var _this2;
|
|
675
|
+
_classCallCheck(this, TestComponent);
|
|
676
|
+
_this2 = _super2.call(this, props);
|
|
677
|
+
_this2.data = expected;
|
|
678
|
+
(0, _handle.handle)((0, _handle.forwardCustomWithPrevent)('onCustomEvent', (0, _handle.call)('adapter'))).bindAs(_assertThisInitialized(_this2), 'handleCustomEvent');
|
|
679
|
+
return _this2;
|
|
680
|
+
}
|
|
681
|
+
_createClass(TestComponent, [{
|
|
682
|
+
key: "componentDidMount",
|
|
683
|
+
value: function componentDidMount() {
|
|
684
|
+
this.handleCustomEvent(null, this.props, this.context);
|
|
685
|
+
}
|
|
686
|
+
}, {
|
|
687
|
+
key: "adapter",
|
|
688
|
+
value: function adapter() {
|
|
689
|
+
return {
|
|
690
|
+
value: this === null || this === void 0 ? void 0 : this.data
|
|
691
|
+
};
|
|
692
|
+
}
|
|
693
|
+
}, {
|
|
694
|
+
key: "render",
|
|
695
|
+
value: function render() {
|
|
696
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
|
|
697
|
+
}
|
|
698
|
+
}]);
|
|
699
|
+
return TestComponent;
|
|
700
|
+
}(_react.Component);
|
|
701
|
+
TestComponent.propTypes = {
|
|
702
|
+
onCustomEvent: _propTypes["default"].func
|
|
703
|
+
};
|
|
704
|
+
(0, _react2.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(TestComponent, {
|
|
705
|
+
onCustomEvent: handler
|
|
706
|
+
}));
|
|
707
|
+
var actual = handler.mock.calls[0][0];
|
|
708
|
+
expect(actual).toEqual(expect.objectContaining({
|
|
709
|
+
value: expected
|
|
710
|
+
}));
|
|
711
|
+
});
|
|
527
712
|
test('should call the next handler when `preventDefault` from provided props hasn\'t been called', function () {
|
|
528
713
|
var event = 'onMyClick';
|
|
529
714
|
var handler = jest.fn();
|
package/package.json
CHANGED
package/platform/platform.js
CHANGED
|
@@ -55,6 +55,14 @@ var platforms = [
|
|
|
55
55
|
platform: 'windowsPhone',
|
|
56
56
|
regex: /Windows Phone (?:OS )?(\d+)[.\d]+/
|
|
57
57
|
},
|
|
58
|
+
// Edge
|
|
59
|
+
{
|
|
60
|
+
platform: 'edge',
|
|
61
|
+
regex: /Chrome\/(\d+)[.\d]+.*Edg(?:e|A|iOS)?\/(\d+)[.\d]+/
|
|
62
|
+
}, {
|
|
63
|
+
platform: 'edge',
|
|
64
|
+
regex: /Edg(?:e|A|iOS)?\/(\d+)[.\d]+/
|
|
65
|
+
},
|
|
58
66
|
// Android 4+ using Chrome
|
|
59
67
|
{
|
|
60
68
|
platform: 'androidChrome',
|
|
@@ -102,11 +110,6 @@ var platforms = [
|
|
|
102
110
|
platform: 'ie',
|
|
103
111
|
regex: /Trident\/.*; rv:(\d+)/
|
|
104
112
|
},
|
|
105
|
-
// Edge
|
|
106
|
-
{
|
|
107
|
-
platform: 'edge',
|
|
108
|
-
regex: /Edge\/(\d+)/
|
|
109
|
-
},
|
|
110
113
|
// iOS 3 - 5
|
|
111
114
|
// Apple likes to make this complicated
|
|
112
115
|
{
|
|
@@ -235,6 +238,9 @@ var parseUserAgent = function parseUserAgent(userAgent) {
|
|
|
235
238
|
if (v >= 7 || v === -1) {
|
|
236
239
|
plat.chrome = Number(m[1]);
|
|
237
240
|
}
|
|
241
|
+
} else if (p.platform === 'edge' && m[2]) {
|
|
242
|
+
plat.chrome = Number(m[1]);
|
|
243
|
+
v = Number(m[2]);
|
|
238
244
|
} else {
|
|
239
245
|
v = Number(m[1]);
|
|
240
246
|
}
|
|
@@ -116,6 +116,72 @@ describe('platform', function () {
|
|
|
116
116
|
expect(actual).toMatchObject(expected);
|
|
117
117
|
});
|
|
118
118
|
});
|
|
119
|
+
describe('parseUserAgent for Edge', function () {
|
|
120
|
+
var edge1 = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Safari/537.36 Edg/113.0.1774.42';
|
|
121
|
+
var edge2 = 'Mozilla/5.0 (Linux; Android 10; HD1913) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.5672.76 Mobile Safari/537.36 EdgA/113.0.1774.38';
|
|
122
|
+
var edge3 = 'Mozilla/5.0 (iPhone; CPU iPhone OS 16_4_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.0 EdgiOS/113.1774.42 Mobile/15E148 Safari/605.1.15';
|
|
123
|
+
var edge4 = 'Mozilla/5.0 (Windows Mobile 10; Android 10.0; Microsoft; Lumia 950XL) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.0.0 Mobile Safari/537.36 Edge/40.15254.603';
|
|
124
|
+
test('should return edge for Edg', function () {
|
|
125
|
+
var expected = {
|
|
126
|
+
platformName: 'edge'
|
|
127
|
+
};
|
|
128
|
+
var actual = (0, _platform.parseUserAgent)(edge1);
|
|
129
|
+
expect(actual).toMatchObject(expected);
|
|
130
|
+
expected = {
|
|
131
|
+
chrome: 113
|
|
132
|
+
};
|
|
133
|
+
expect(actual).toMatchObject(expected);
|
|
134
|
+
expected = {
|
|
135
|
+
edge: 113
|
|
136
|
+
};
|
|
137
|
+
expect(actual).toMatchObject(expected);
|
|
138
|
+
});
|
|
139
|
+
test('should return edge for EdgA', function () {
|
|
140
|
+
var expected = {
|
|
141
|
+
platformName: 'edge'
|
|
142
|
+
};
|
|
143
|
+
var actual = (0, _platform.parseUserAgent)(edge2);
|
|
144
|
+
expect(actual).toMatchObject(expected);
|
|
145
|
+
expected = {
|
|
146
|
+
chrome: 113
|
|
147
|
+
};
|
|
148
|
+
expect(actual).toMatchObject(expected);
|
|
149
|
+
expected = {
|
|
150
|
+
edge: 113
|
|
151
|
+
};
|
|
152
|
+
expect(actual).toMatchObject(expected);
|
|
153
|
+
});
|
|
154
|
+
test('should return edge for EdgiOS', function () {
|
|
155
|
+
var expected = {
|
|
156
|
+
platformName: 'edge'
|
|
157
|
+
};
|
|
158
|
+
var actual = (0, _platform.parseUserAgent)(edge3);
|
|
159
|
+
expect(actual).toMatchObject(expected);
|
|
160
|
+
expected = {
|
|
161
|
+
chrome: 113
|
|
162
|
+
};
|
|
163
|
+
expect(actual).not.toMatchObject(expected);
|
|
164
|
+
expected = {
|
|
165
|
+
edge: 113
|
|
166
|
+
};
|
|
167
|
+
expect(actual).toMatchObject(expected);
|
|
168
|
+
});
|
|
169
|
+
test('should return edge for Edge', function () {
|
|
170
|
+
var expected = {
|
|
171
|
+
platformName: 'edge'
|
|
172
|
+
};
|
|
173
|
+
var actual = (0, _platform.parseUserAgent)(edge4);
|
|
174
|
+
expect(actual).toMatchObject(expected);
|
|
175
|
+
expected = {
|
|
176
|
+
chrome: 113
|
|
177
|
+
};
|
|
178
|
+
expect(actual).toMatchObject(expected);
|
|
179
|
+
expected = {
|
|
180
|
+
edge: 40
|
|
181
|
+
};
|
|
182
|
+
expect(actual).toMatchObject(expected);
|
|
183
|
+
});
|
|
184
|
+
});
|
|
119
185
|
describe('parseUserAgent for User-Agent Reduction', function () {
|
|
120
186
|
var testVersion = '113';
|
|
121
187
|
var uaGenerator = function uaGenerator(unifiedPlatform) {
|