@zohodesk/dot 1.0.0-temp-187.2 → 1.0.0-temp-200
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/.cli/propValidation_report.html +1 -1
- package/README.md +4 -0
- package/es/Attachment/Attachment.js +2 -1
- package/es/Attachment/Attachment.module.css +7 -3
- package/es/AttachmentViewer/Attachment.js +60 -1
- package/es/AttachmentViewer/AttachmentViewer.js +146 -12
- package/es/AttachmentViewer/AttachmentViewer.module.css +124 -4
- package/es/DotProvider/__tests__/DotProvider.spec.js +174 -0
- package/es/DotProvider/__tests__/__snapshots__/DotProvider.spec.js.snap +478 -0
- package/es/common/dot_common.module.css +35 -0
- package/es/form/fields/TagsMultiSelect/TagsMultiSelect.js +2 -4
- package/es/list/DepartmentDropDown/DepartmentDropDown.js +2 -7
- package/es/list/DepartmentDropDown/props/defaultProps.js +1 -2
- package/es/list/DepartmentDropDown/props/propTypes.js +1 -2
- package/es/list/status/StatusListItem/StatusListItem.module.css +5 -35
- package/es/lookup/header/Search/LookupSearch.module.css +33 -27
- package/es/lookup/header/Search/Search.js +58 -40
- package/es/lookup/header/Search/__tests__/Search.spec.js +67 -1
- package/es/lookup/header/Search/__tests__/__snapshots__/Search.spec.js.snap +316 -3
- package/es/lookup/header/Search/props/defaultProps.js +3 -1
- package/es/lookup/header/Search/props/propTypes.js +6 -1
- package/lib/Attachment/Attachment.js +3 -1
- package/lib/Attachment/Attachment.module.css +7 -3
- package/lib/AttachmentViewer/Attachment.js +88 -1
- package/lib/AttachmentViewer/AttachmentViewer.js +147 -13
- package/lib/AttachmentViewer/AttachmentViewer.module.css +124 -4
- package/lib/DotProvider/__tests__/DotProvider.spec.js +441 -0
- package/lib/DotProvider/__tests__/__snapshots__/DotProvider.spec.js.snap +478 -0
- package/lib/common/dot_common.module.css +35 -0
- package/lib/form/fields/TagsMultiSelect/TagsMultiSelect.js +3 -5
- package/lib/list/DepartmentDropDown/DepartmentDropDown.js +3 -8
- package/lib/list/DepartmentDropDown/props/defaultProps.js +1 -2
- package/lib/list/DepartmentDropDown/props/propTypes.js +1 -1
- package/lib/list/status/StatusListItem/StatusListItem.module.css +5 -35
- package/lib/lookup/header/Search/LookupSearch.module.css +33 -27
- package/lib/lookup/header/Search/Search.js +76 -66
- package/lib/lookup/header/Search/__tests__/Search.spec.js +65 -0
- package/lib/lookup/header/Search/__tests__/__snapshots__/Search.spec.js.snap +316 -3
- package/lib/lookup/header/Search/props/defaultProps.js +3 -1
- package/lib/lookup/header/Search/props/propTypes.js +6 -1
- package/package.json +8 -8
- package/result.json +1 -1
- package/unittest/index.html +2 -6
- /package/images/{audio_thumbnail.png → audio_thumbnail_old.png} +0 -0
|
@@ -0,0 +1,441 @@
|
|
|
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
|
+
var _react = _interopRequireDefault(require("react"));
|
|
6
|
+
|
|
7
|
+
var _react2 = require("@testing-library/react");
|
|
8
|
+
|
|
9
|
+
var _DotProvider = _interopRequireDefault(require("../DotProvider"));
|
|
10
|
+
|
|
11
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
12
|
+
|
|
13
|
+
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; }
|
|
14
|
+
|
|
15
|
+
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); } }
|
|
16
|
+
|
|
17
|
+
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); }); }; }
|
|
18
|
+
|
|
19
|
+
// snapshot test cases
|
|
20
|
+
describe('DotProvider Snapshot', function () {
|
|
21
|
+
var THEME_APPEARANCE = ['light', 'dark', 'pureDark'];
|
|
22
|
+
var THEME_COLOR = ['blue', 'green', 'orange', 'red', 'yellow'];
|
|
23
|
+
var BASE_ZOOM_UNIT = ['0.5', '0.8', '1', '1.2'];
|
|
24
|
+
var BASE_FONT_UNIT = ['1px', '1rem', '1em', '1'];
|
|
25
|
+
test('rendering the default props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
26
|
+
var _render, asFragment;
|
|
27
|
+
|
|
28
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
29
|
+
while (1) {
|
|
30
|
+
switch (_context.prev = _context.next) {
|
|
31
|
+
case 0:
|
|
32
|
+
_render = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], null, "This is a DotProvider component")), asFragment = _render.asFragment; // wait for the data attributes and styles to be applied
|
|
33
|
+
|
|
34
|
+
_context.next = 3;
|
|
35
|
+
return (0, _react2.waitFor)(function () {});
|
|
36
|
+
|
|
37
|
+
case 3:
|
|
38
|
+
// take the snapshot after the attributes and styles are applied
|
|
39
|
+
expect(asFragment()).toMatchSnapshot();
|
|
40
|
+
|
|
41
|
+
case 4:
|
|
42
|
+
case "end":
|
|
43
|
+
return _context.stop();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}, _callee);
|
|
47
|
+
})));
|
|
48
|
+
test('rendering the default attributes, styles and modified the tag props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
49
|
+
var _render2, asFragment;
|
|
50
|
+
|
|
51
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
52
|
+
while (1) {
|
|
53
|
+
switch (_context2.prev = _context2.next) {
|
|
54
|
+
case 0:
|
|
55
|
+
_render2 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
56
|
+
tag: "span"
|
|
57
|
+
}, "This is a DotProvider component")), asFragment = _render2.asFragment;
|
|
58
|
+
_context2.next = 3;
|
|
59
|
+
return (0, _react2.waitFor)(function () {});
|
|
60
|
+
|
|
61
|
+
case 3:
|
|
62
|
+
expect(asFragment()).toMatchSnapshot();
|
|
63
|
+
|
|
64
|
+
case 4:
|
|
65
|
+
case "end":
|
|
66
|
+
return _context2.stop();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}, _callee2);
|
|
70
|
+
})));
|
|
71
|
+
test('rendering the default attributes, styles and modifying the tag prop to React.Fragment', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
72
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
73
|
+
while (1) {
|
|
74
|
+
switch (_context3.prev = _context3.next) {
|
|
75
|
+
case 0:
|
|
76
|
+
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
77
|
+
tag: _react["default"].Fragment
|
|
78
|
+
}, "This is a DotProvider component"));
|
|
79
|
+
_context3.next = 3;
|
|
80
|
+
return (0, _react2.waitFor)(function () {});
|
|
81
|
+
|
|
82
|
+
case 3:
|
|
83
|
+
expect(document.documentElement).toMatchSnapshot();
|
|
84
|
+
|
|
85
|
+
case 4:
|
|
86
|
+
case "end":
|
|
87
|
+
return _context3.stop();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}, _callee3);
|
|
91
|
+
})));
|
|
92
|
+
test('rendering the providerRef props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
93
|
+
var mockProviderRef, _render3, asFragment;
|
|
94
|
+
|
|
95
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
96
|
+
while (1) {
|
|
97
|
+
switch (_context4.prev = _context4.next) {
|
|
98
|
+
case 0:
|
|
99
|
+
mockProviderRef = jest.fn();
|
|
100
|
+
_render3 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
101
|
+
providerRef: mockProviderRef
|
|
102
|
+
}, "This is a DotProvider component")), asFragment = _render3.asFragment;
|
|
103
|
+
_context4.next = 4;
|
|
104
|
+
return (0, _react2.waitFor)(function () {});
|
|
105
|
+
|
|
106
|
+
case 4:
|
|
107
|
+
expect(asFragment()).toMatchSnapshot();
|
|
108
|
+
|
|
109
|
+
case 5:
|
|
110
|
+
case "end":
|
|
111
|
+
return _context4.stop();
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}, _callee4);
|
|
115
|
+
})));
|
|
116
|
+
test('rendering the additional ...rest props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
117
|
+
var _render4, asFragment;
|
|
118
|
+
|
|
119
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
120
|
+
while (1) {
|
|
121
|
+
switch (_context5.prev = _context5.next) {
|
|
122
|
+
case 0:
|
|
123
|
+
_render4 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
124
|
+
className: "testClass",
|
|
125
|
+
"data-id": "test-id"
|
|
126
|
+
}, "This is a DotProvider component")), asFragment = _render4.asFragment;
|
|
127
|
+
_context5.next = 3;
|
|
128
|
+
return (0, _react2.waitFor)(function () {});
|
|
129
|
+
|
|
130
|
+
case 3:
|
|
131
|
+
expect(asFragment()).toMatchSnapshot();
|
|
132
|
+
|
|
133
|
+
case 4:
|
|
134
|
+
case "end":
|
|
135
|
+
return _context5.stop();
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}, _callee5);
|
|
139
|
+
})));
|
|
140
|
+
test('rendering the wrong themeAppearance and themeColor', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
141
|
+
var _render5, asFragment;
|
|
142
|
+
|
|
143
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
144
|
+
while (1) {
|
|
145
|
+
switch (_context6.prev = _context6.next) {
|
|
146
|
+
case 0:
|
|
147
|
+
_render5 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
148
|
+
themeAppearance: "ligt",
|
|
149
|
+
themeColor: "gren"
|
|
150
|
+
}, "This is a DotProvider component")), asFragment = _render5.asFragment;
|
|
151
|
+
_context6.next = 3;
|
|
152
|
+
return (0, _react2.waitFor)(function () {});
|
|
153
|
+
|
|
154
|
+
case 3:
|
|
155
|
+
expect(asFragment()).toMatchSnapshot();
|
|
156
|
+
|
|
157
|
+
case 4:
|
|
158
|
+
case "end":
|
|
159
|
+
return _context6.stop();
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}, _callee6);
|
|
163
|
+
})));
|
|
164
|
+
THEME_APPEARANCE.map(function (appearance) {
|
|
165
|
+
test.each(THEME_COLOR)("rendering the theme-appearance of ".concat(appearance, " along with theme-color of %s"), /*#__PURE__*/function () {
|
|
166
|
+
var _ref7 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(theme) {
|
|
167
|
+
var _render6, asFragment;
|
|
168
|
+
|
|
169
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
170
|
+
while (1) {
|
|
171
|
+
switch (_context7.prev = _context7.next) {
|
|
172
|
+
case 0:
|
|
173
|
+
_render6 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
174
|
+
themeAppearance: appearance,
|
|
175
|
+
themeColor: theme
|
|
176
|
+
})), asFragment = _render6.asFragment;
|
|
177
|
+
_context7.next = 3;
|
|
178
|
+
return (0, _react2.waitFor)(function () {});
|
|
179
|
+
|
|
180
|
+
case 3:
|
|
181
|
+
expect(asFragment()).toMatchSnapshot();
|
|
182
|
+
|
|
183
|
+
case 4:
|
|
184
|
+
case "end":
|
|
185
|
+
return _context7.stop();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}, _callee7);
|
|
189
|
+
}));
|
|
190
|
+
|
|
191
|
+
return function (_x) {
|
|
192
|
+
return _ref7.apply(this, arguments);
|
|
193
|
+
};
|
|
194
|
+
}());
|
|
195
|
+
});
|
|
196
|
+
THEME_APPEARANCE.map(function (appearance) {
|
|
197
|
+
test.each(THEME_COLOR)("rendering the custom themeAppearanceAttr and themeColorAttr props with theme-appearance of ".concat(appearance, " along with theme-color of %s"), /*#__PURE__*/function () {
|
|
198
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(theme) {
|
|
199
|
+
var _render7, asFragment;
|
|
200
|
+
|
|
201
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
202
|
+
while (1) {
|
|
203
|
+
switch (_context8.prev = _context8.next) {
|
|
204
|
+
case 0:
|
|
205
|
+
_render7 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
206
|
+
themeAppearance: appearance,
|
|
207
|
+
themeColor: theme,
|
|
208
|
+
themeAppearanceAttr: "data-desk-mode",
|
|
209
|
+
themeColorAttr: "data-desk-theme"
|
|
210
|
+
})), asFragment = _render7.asFragment;
|
|
211
|
+
_context8.next = 3;
|
|
212
|
+
return (0, _react2.waitFor)(function () {});
|
|
213
|
+
|
|
214
|
+
case 3:
|
|
215
|
+
expect(asFragment()).toMatchSnapshot();
|
|
216
|
+
|
|
217
|
+
case 4:
|
|
218
|
+
case "end":
|
|
219
|
+
return _context8.stop();
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}, _callee8);
|
|
223
|
+
}));
|
|
224
|
+
|
|
225
|
+
return function (_x2) {
|
|
226
|
+
return _ref8.apply(this, arguments);
|
|
227
|
+
};
|
|
228
|
+
}());
|
|
229
|
+
});
|
|
230
|
+
test.each(BASE_ZOOM_UNIT)("rendering the baseZoomUnit props of %s", /*#__PURE__*/function () {
|
|
231
|
+
var _ref9 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(zoom) {
|
|
232
|
+
var _render8, asFragment;
|
|
233
|
+
|
|
234
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
235
|
+
while (1) {
|
|
236
|
+
switch (_context9.prev = _context9.next) {
|
|
237
|
+
case 0:
|
|
238
|
+
_render8 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
239
|
+
baseZoomUnit: zoom
|
|
240
|
+
})), asFragment = _render8.asFragment;
|
|
241
|
+
_context9.next = 3;
|
|
242
|
+
return (0, _react2.waitFor)(function () {});
|
|
243
|
+
|
|
244
|
+
case 3:
|
|
245
|
+
expect(asFragment()).toMatchSnapshot();
|
|
246
|
+
|
|
247
|
+
case 4:
|
|
248
|
+
case "end":
|
|
249
|
+
return _context9.stop();
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}, _callee9);
|
|
253
|
+
}));
|
|
254
|
+
|
|
255
|
+
return function (_x3) {
|
|
256
|
+
return _ref9.apply(this, arguments);
|
|
257
|
+
};
|
|
258
|
+
}());
|
|
259
|
+
test.each(BASE_FONT_UNIT)("rendering the baseFontUnit props of %s", /*#__PURE__*/function () {
|
|
260
|
+
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(font) {
|
|
261
|
+
var _render9, asFragment;
|
|
262
|
+
|
|
263
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
264
|
+
while (1) {
|
|
265
|
+
switch (_context10.prev = _context10.next) {
|
|
266
|
+
case 0:
|
|
267
|
+
_render9 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
268
|
+
baseFontUnit: font
|
|
269
|
+
})), asFragment = _render9.asFragment;
|
|
270
|
+
_context10.next = 3;
|
|
271
|
+
return (0, _react2.waitFor)(function () {});
|
|
272
|
+
|
|
273
|
+
case 3:
|
|
274
|
+
expect(asFragment()).toMatchSnapshot();
|
|
275
|
+
|
|
276
|
+
case 4:
|
|
277
|
+
case "end":
|
|
278
|
+
return _context10.stop();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}, _callee10);
|
|
282
|
+
}));
|
|
283
|
+
|
|
284
|
+
return function (_x4) {
|
|
285
|
+
return _ref10.apply(this, arguments);
|
|
286
|
+
};
|
|
287
|
+
}());
|
|
288
|
+
test('rendering the zoomUnitVariable prop along with baseZoomUnit props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
289
|
+
var _render10, asFragment;
|
|
290
|
+
|
|
291
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
292
|
+
while (1) {
|
|
293
|
+
switch (_context11.prev = _context11.next) {
|
|
294
|
+
case 0:
|
|
295
|
+
_render10 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
296
|
+
baseZoomUnit: "1.1",
|
|
297
|
+
zoomUnitVariable: "--gc_baseUnit"
|
|
298
|
+
}, "This is a DotProvider component")), asFragment = _render10.asFragment;
|
|
299
|
+
_context11.next = 3;
|
|
300
|
+
return (0, _react2.waitFor)(function () {});
|
|
301
|
+
|
|
302
|
+
case 3:
|
|
303
|
+
expect(asFragment()).toMatchSnapshot();
|
|
304
|
+
|
|
305
|
+
case 4:
|
|
306
|
+
case "end":
|
|
307
|
+
return _context11.stop();
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
}, _callee11);
|
|
311
|
+
})));
|
|
312
|
+
test('rendering the fontUnitVariable prop along with baseFontUnit props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
313
|
+
var _render11, asFragment;
|
|
314
|
+
|
|
315
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
316
|
+
while (1) {
|
|
317
|
+
switch (_context12.prev = _context12.next) {
|
|
318
|
+
case 0:
|
|
319
|
+
_render11 = (0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
320
|
+
baseFontUnit: "14px",
|
|
321
|
+
fontUnitVariable: "--gc_baseFontUnit"
|
|
322
|
+
}, "This is a DotProvider component")), asFragment = _render11.asFragment;
|
|
323
|
+
_context12.next = 3;
|
|
324
|
+
return (0, _react2.waitFor)(function () {});
|
|
325
|
+
|
|
326
|
+
case 3:
|
|
327
|
+
expect(asFragment()).toMatchSnapshot();
|
|
328
|
+
|
|
329
|
+
case 4:
|
|
330
|
+
case "end":
|
|
331
|
+
return _context12.stop();
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}, _callee12);
|
|
335
|
+
})));
|
|
336
|
+
}); // unit test cases
|
|
337
|
+
|
|
338
|
+
describe('DotProvider Unit-Test', function () {
|
|
339
|
+
test('rendering the ref function type props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee13() {
|
|
340
|
+
var mockFunctionRef, dotProviderElement;
|
|
341
|
+
return _regeneratorRuntime().wrap(function _callee13$(_context13) {
|
|
342
|
+
while (1) {
|
|
343
|
+
switch (_context13.prev = _context13.next) {
|
|
344
|
+
case 0:
|
|
345
|
+
mockFunctionRef = jest.fn();
|
|
346
|
+
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
347
|
+
id: "dot-provider",
|
|
348
|
+
ref: mockFunctionRef
|
|
349
|
+
}, "This is a DotProvider component"));
|
|
350
|
+
_context13.next = 4;
|
|
351
|
+
return (0, _react2.waitFor)(function () {});
|
|
352
|
+
|
|
353
|
+
case 4:
|
|
354
|
+
dotProviderElement = document.getElementById('dot-provider');
|
|
355
|
+
expect(mockFunctionRef).toHaveBeenCalledWith(dotProviderElement);
|
|
356
|
+
|
|
357
|
+
case 6:
|
|
358
|
+
case "end":
|
|
359
|
+
return _context13.stop();
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
}, _callee13);
|
|
363
|
+
})));
|
|
364
|
+
test('rendering the ref object type props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee14() {
|
|
365
|
+
var mockObjectRef, dotProviderElement;
|
|
366
|
+
return _regeneratorRuntime().wrap(function _callee14$(_context14) {
|
|
367
|
+
while (1) {
|
|
368
|
+
switch (_context14.prev = _context14.next) {
|
|
369
|
+
case 0:
|
|
370
|
+
mockObjectRef = /*#__PURE__*/_react["default"].createRef();
|
|
371
|
+
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
372
|
+
id: "dot-provider",
|
|
373
|
+
ref: mockObjectRef
|
|
374
|
+
}, "This is a DotProvider component"));
|
|
375
|
+
_context14.next = 4;
|
|
376
|
+
return (0, _react2.waitFor)(function () {});
|
|
377
|
+
|
|
378
|
+
case 4:
|
|
379
|
+
dotProviderElement = document.getElementById('dot-provider');
|
|
380
|
+
expect(mockObjectRef.current).toBe(dotProviderElement);
|
|
381
|
+
|
|
382
|
+
case 6:
|
|
383
|
+
case "end":
|
|
384
|
+
return _context14.stop();
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
}, _callee14);
|
|
388
|
+
})));
|
|
389
|
+
test('rendering the onAssetsDownloadSuccess props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee15() {
|
|
390
|
+
var mockFunc;
|
|
391
|
+
return _regeneratorRuntime().wrap(function _callee15$(_context15) {
|
|
392
|
+
while (1) {
|
|
393
|
+
switch (_context15.prev = _context15.next) {
|
|
394
|
+
case 0:
|
|
395
|
+
mockFunc = jest.fn();
|
|
396
|
+
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
397
|
+
onAssetsDownloadSuccess: mockFunc
|
|
398
|
+
}, "This is a DotProvider component"));
|
|
399
|
+
_context15.next = 4;
|
|
400
|
+
return (0, _react2.waitFor)(function () {});
|
|
401
|
+
|
|
402
|
+
case 4:
|
|
403
|
+
expect(mockFunc).toHaveBeenCalled();
|
|
404
|
+
|
|
405
|
+
case 5:
|
|
406
|
+
case "end":
|
|
407
|
+
return _context15.stop();
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
}, _callee15);
|
|
411
|
+
})));
|
|
412
|
+
test('rendering the getAssetsPromises props', /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee16() {
|
|
413
|
+
var mockFunc;
|
|
414
|
+
return _regeneratorRuntime().wrap(function _callee16$(_context16) {
|
|
415
|
+
while (1) {
|
|
416
|
+
switch (_context16.prev = _context16.next) {
|
|
417
|
+
case 0:
|
|
418
|
+
mockFunc = jest.fn();
|
|
419
|
+
(0, _react2.render)( /*#__PURE__*/_react["default"].createElement(_DotProvider["default"], {
|
|
420
|
+
getAssetsPromises: mockFunc
|
|
421
|
+
}, "This is a DotProvider component"));
|
|
422
|
+
_context16.next = 4;
|
|
423
|
+
return (0, _react2.waitFor)(function () {});
|
|
424
|
+
|
|
425
|
+
case 4:
|
|
426
|
+
expect(mockFunc).toHaveBeenCalledWith(expect.objectContaining({
|
|
427
|
+
fontSizePromise: expect.any(Promise),
|
|
428
|
+
themeAppearancePromise: expect.arrayContaining([expect.any(Promise)]),
|
|
429
|
+
themeColorPromise: expect.arrayContaining([expect.any(Promise)]),
|
|
430
|
+
zoomSizePromise: expect.any(Promise)
|
|
431
|
+
}));
|
|
432
|
+
|
|
433
|
+
case 5:
|
|
434
|
+
case "end":
|
|
435
|
+
return _context16.stop();
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
}, _callee16);
|
|
439
|
+
})));
|
|
440
|
+
}); // need to check error handling cases
|
|
441
|
+
// onAssetsDownloadSuccess not called verification
|