creevey 0.9.0-non-webpack.0 → 0.9.0-non-webpack.1

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.
Files changed (56) hide show
  1. package/lib/cjs/client/addon/Manager.js +121 -275
  2. package/lib/cjs/client/addon/components/Addon.js +17 -38
  3. package/lib/cjs/client/addon/components/Icons.js +10 -6
  4. package/lib/cjs/client/addon/components/Panel.js +17 -13
  5. package/lib/cjs/client/addon/components/TestSelect.js +11 -9
  6. package/lib/cjs/client/addon/components/Tools.js +21 -40
  7. package/lib/cjs/client/addon/decorator.js +1 -1
  8. package/lib/cjs/client/addon/index.js +2 -2
  9. package/lib/cjs/client/addon/preset.js +11 -30
  10. package/lib/cjs/client/addon/register.js +45 -73
  11. package/lib/cjs/client/addon/utils.js +1 -1
  12. package/lib/cjs/client/addon/withCreevey.js +153 -360
  13. package/lib/cjs/client/shared/components/ImagesView/BlendView.js +23 -21
  14. package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +21 -17
  15. package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +42 -64
  16. package/lib/cjs/client/shared/components/ImagesView/SlideView.js +35 -48
  17. package/lib/cjs/client/shared/components/ImagesView/SwapView.js +24 -43
  18. package/lib/cjs/client/shared/components/ImagesView/index.js +5 -5
  19. package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +12 -8
  20. package/lib/cjs/client/shared/components/PageFooter/Paging.js +14 -18
  21. package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +22 -18
  22. package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +42 -67
  23. package/lib/cjs/client/shared/components/ResultsPage.js +38 -68
  24. package/lib/cjs/client/shared/creeveyClientApi.js +55 -86
  25. package/lib/cjs/client/shared/helpers.js +123 -194
  26. package/lib/cjs/client/shared/viewMode.js +4 -4
  27. package/lib/cjs/shared/index.js +26 -14
  28. package/lib/cjs/shared/serializeRegExp.js +5 -4
  29. package/lib/esm/client/addon/Manager.js +121 -275
  30. package/lib/esm/client/addon/components/Addon.js +15 -34
  31. package/lib/esm/client/addon/components/Icons.js +10 -6
  32. package/lib/esm/client/addon/components/Panel.js +17 -13
  33. package/lib/esm/client/addon/components/TestSelect.js +11 -9
  34. package/lib/esm/client/addon/components/Tools.js +19 -36
  35. package/lib/esm/client/addon/decorator.js +1 -1
  36. package/lib/esm/client/addon/preset.js +9 -24
  37. package/lib/esm/client/addon/register.js +42 -70
  38. package/lib/esm/client/addon/utils.js +1 -1
  39. package/lib/esm/client/addon/withCreevey.js +148 -357
  40. package/lib/esm/client/shared/components/ImagesView/BlendView.js +21 -17
  41. package/lib/esm/client/shared/components/ImagesView/ImagesView.js +21 -17
  42. package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +40 -60
  43. package/lib/esm/client/shared/components/ImagesView/SlideView.js +33 -44
  44. package/lib/esm/client/shared/components/ImagesView/SwapView.js +22 -39
  45. package/lib/esm/client/shared/components/PageFooter/PageFooter.js +12 -8
  46. package/lib/esm/client/shared/components/PageFooter/Paging.js +14 -18
  47. package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +22 -18
  48. package/lib/esm/client/shared/components/PageHeader/PageHeader.js +37 -60
  49. package/lib/esm/client/shared/components/ResultsPage.js +36 -64
  50. package/lib/esm/client/shared/creeveyClientApi.js +57 -88
  51. package/lib/esm/client/shared/helpers.js +123 -194
  52. package/lib/esm/client/shared/viewMode.js +4 -4
  53. package/lib/esm/shared/index.js +26 -14
  54. package/lib/esm/shared/serializeRegExp.js +5 -4
  55. package/package.json +1 -1
  56. package/preset.js +1 -1
@@ -1,7 +1,5 @@
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); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -21,46 +19,10 @@ var _register = require("./register");
21
19
 
22
20
  var _utils = require("./utils");
23
21
 
24
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
-
26
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
27
-
28
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
29
-
30
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
-
32
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
33
-
34
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
35
-
36
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
37
-
38
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
39
-
40
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
41
-
42
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
43
-
44
- 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; }
45
-
46
- 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); } }
47
-
48
- 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); }); }; }
49
-
50
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
51
-
52
- 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, descriptor.key, descriptor); } }
53
-
54
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
55
-
56
22
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
57
23
 
58
- var CreeveyManager = /*#__PURE__*/function () {
59
- function CreeveyManager(storybookApi) {
60
- var _this = this;
61
-
62
- _classCallCheck(this, CreeveyManager);
63
-
24
+ class CreeveyManager {
25
+ constructor(storybookApi) {
64
26
  _defineProperty(this, "storyId", '');
65
27
 
66
28
  _defineProperty(this, "activeBrowser", '');
@@ -83,60 +45,38 @@ var CreeveyManager = /*#__PURE__*/function () {
83
45
 
84
46
  _defineProperty(this, "changeTestListeners", []);
85
47
 
86
- _defineProperty(this, "initAll", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
87
- return _regeneratorRuntime().wrap(function _callee$(_context) {
88
- while (1) {
89
- switch (_context.prev = _context.next) {
90
- case 0:
91
- _this.storybookApi.on(_coreEvents.STORY_RENDERED, _this.onStoryRendered);
92
-
93
- _this.storybookApi.on(_coreEvents.SET_STORIES, _this.onSetStories);
94
-
95
- _context.next = 4;
96
- return (0, _creeveyClientApi.initCreeveyClientApi)();
97
-
98
- case 4:
99
- _this.creeveyApi = _context.sent;
100
-
101
- _this.creeveyApi.onUpdate(_this.handleCreeveyUpdate);
102
-
103
- _context.next = 8;
104
- return _this.creeveyApi.status;
105
-
106
- case 8:
107
- _this.status = _context.sent;
108
-
109
- case 9:
110
- case "end":
111
- return _context.stop();
112
- }
113
- }
114
- }, _callee);
115
- })));
48
+ _defineProperty(this, "initAll", async () => {
49
+ this.storybookApi.on(_coreEvents.STORY_RENDERED, this.onStoryRendered);
50
+ this.storybookApi.on(_coreEvents.SET_STORIES, this.onSetStories);
51
+ this.creeveyApi = await (0, _creeveyClientApi.initCreeveyClientApi)();
52
+ this.creeveyApi.onUpdate(this.handleCreeveyUpdate);
53
+ this.status = await this.creeveyApi.status;
54
+ });
116
55
 
117
- _defineProperty(this, "handleCreeveyUpdate", function (update) {
118
- var tests = update.tests,
119
- _update$removedTests = update.removedTests,
120
- removedTests = _update$removedTests === void 0 ? [] : _update$removedTests,
121
- isRunning = update.isRunning;
56
+ _defineProperty(this, "handleCreeveyUpdate", update => {
57
+ const {
58
+ tests,
59
+ removedTests = [],
60
+ isRunning
61
+ } = update;
122
62
 
123
63
  if ((0, _types.isDefined)(isRunning)) {
124
- _this.status.isRunning = isRunning;
64
+ this.status.isRunning = isRunning;
125
65
  }
126
66
 
127
67
  if ((0, _types.isDefined)(tests)) {
128
- var prevTests = _this.status.tests;
129
- var prevStories = _this.stories || {};
130
- Object.values(tests).filter(_types.isDefined).forEach(function (update) {
131
- var _test$results;
132
-
133
- var id = update.id,
134
- skip = update.skip,
135
- status = update.status,
136
- results = update.results,
137
- approved = update.approved,
138
- storyId = update.storyId;
139
- var test = prevTests[id];
68
+ const prevTests = this.status.tests;
69
+ const prevStories = this.stories || {};
70
+ Object.values(tests).filter(_types.isDefined).forEach(update => {
71
+ const {
72
+ id,
73
+ skip,
74
+ status,
75
+ results,
76
+ approved,
77
+ storyId
78
+ } = update;
79
+ const test = prevTests[id];
140
80
 
141
81
  if (!test) {
142
82
  return prevTests[id] = update;
@@ -148,271 +88,177 @@ var CreeveyManager = /*#__PURE__*/function () {
148
88
  test.status = status;
149
89
 
150
90
  if ((0, _types.isDefined)(storyId) && (0, _types.isDefined)(prevStories[storyId])) {
151
- var story = prevStories[storyId];
152
-
153
- var storyStatus = _this.getStoryTests(storyId);
154
-
155
- var oldStatus = storyStatus.map(function (x) {
156
- return x.id === id ? status : x.status;
157
- }).reduce(function (oldStatus, newStatus) {
158
- return (0, _helpers.calcStatus)(oldStatus, newStatus);
159
- }, undefined);
160
- story.name = _this.addStatusToStoryName(story.name, (0, _helpers.calcStatus)(oldStatus, status), skip || false);
91
+ const story = prevStories[storyId];
92
+ const storyStatus = this.getStoryTests(storyId);
93
+ const oldStatus = storyStatus.map(x => x.id === id ? status : x.status).reduce((oldStatus, newStatus) => (0, _helpers.calcStatus)(oldStatus, newStatus), undefined);
94
+ story.name = this.addStatusToStoryName(story.name, (0, _helpers.calcStatus)(oldStatus, status), skip || false);
161
95
  }
162
96
  }
163
97
 
164
- if ((0, _types.isDefined)(results)) test.results ? (_test$results = test.results).push.apply(_test$results, _toConsumableArray(results)) : test.results = results;
98
+ if ((0, _types.isDefined)(results)) test.results ? test.results.push(...results) : test.results = results;
165
99
 
166
100
  if ((0, _types.isDefined)(approved)) {
167
- Object.entries(approved).forEach(function (_ref2) {
168
- var _ref3 = _slicedToArray(_ref2, 2),
169
- image = _ref3[0],
170
- retry = _ref3[1];
171
-
101
+ Object.entries(approved).forEach(_ref => {
102
+ let [image, retry] = _ref;
172
103
  return retry !== undefined && test && ((test.approved = (test === null || test === void 0 ? void 0 : test.approved) || {})[image] = retry);
173
104
  });
174
105
  }
175
106
  });
176
- removedTests.forEach(function (_ref4) {
177
- var id = _ref4.id;
107
+ removedTests.forEach(_ref2 => {
108
+ let {
109
+ id
110
+ } = _ref2;
178
111
  return delete prevTests[id];
179
112
  });
180
- _this.status.tests = prevTests;
181
- _this.stories = prevStories;
182
-
183
- _this.setPanelsTitle();
184
-
185
- void _this.storybookApi.setStories(_this.stories);
113
+ this.status.tests = prevTests;
114
+ this.stories = prevStories;
115
+ this.setPanelsTitle();
116
+ void this.storybookApi.setStories(this.stories);
186
117
  }
187
118
 
188
- _this.updateStatusListeners.forEach(function (x) {
189
- return x(update);
190
- });
119
+ this.updateStatusListeners.forEach(x => x(update));
191
120
  });
192
121
 
193
- _defineProperty(this, "getCurrentTest", function () {
194
- return _this.status.tests[_this.selectedTestId];
122
+ _defineProperty(this, "getCurrentTest", () => {
123
+ return this.status.tests[this.selectedTestId];
195
124
  });
196
125
 
197
- _defineProperty(this, "onStoryRendered", function (storyId) {
198
- if (_this.storyId === '') void _this.addStatusesToSideBar();
126
+ _defineProperty(this, "onStoryRendered", storyId => {
127
+ if (this.storyId === '') void this.addStatusesToSideBar();
199
128
 
200
- if (_this.storyId !== storyId) {
129
+ if (this.storyId !== storyId) {
201
130
  var _this$getTestsByStory, _this$getTestsByStory2;
202
131
 
203
- _this.storyId = storyId;
204
- _this.selectedTestId = (_this$getTestsByStory = (_this$getTestsByStory2 = _this.getTestsByStoryIdAndBrowser(_this.activeBrowser)[0]) === null || _this$getTestsByStory2 === void 0 ? void 0 : _this$getTestsByStory2.id) !== null && _this$getTestsByStory !== void 0 ? _this$getTestsByStory : '';
205
-
206
- _this.setPanelsTitle();
207
-
208
- _this.changeTestListeners.forEach(function (x) {
209
- return x(_this.selectedTestId);
210
- });
132
+ this.storyId = storyId;
133
+ this.selectedTestId = (_this$getTestsByStory = (_this$getTestsByStory2 = this.getTestsByStoryIdAndBrowser(this.activeBrowser)[0]) === null || _this$getTestsByStory2 === void 0 ? void 0 : _this$getTestsByStory2.id) !== null && _this$getTestsByStory !== void 0 ? _this$getTestsByStory : '';
134
+ this.setPanelsTitle();
135
+ this.changeTestListeners.forEach(x => x(this.selectedTestId));
211
136
  }
212
137
  });
213
138
 
214
- _defineProperty(this, "onStart", function () {
139
+ _defineProperty(this, "onStart", () => {
215
140
  var _this$creeveyApi;
216
141
 
217
- (_this$creeveyApi = _this.creeveyApi) === null || _this$creeveyApi === void 0 ? void 0 : _this$creeveyApi.start([_this.selectedTestId]);
142
+ (_this$creeveyApi = this.creeveyApi) === null || _this$creeveyApi === void 0 ? void 0 : _this$creeveyApi.start([this.selectedTestId]);
218
143
  });
219
144
 
220
- _defineProperty(this, "onStop", function () {
145
+ _defineProperty(this, "onStop", () => {
221
146
  var _this$creeveyApi2;
222
147
 
223
- (_this$creeveyApi2 = _this.creeveyApi) === null || _this$creeveyApi2 === void 0 ? void 0 : _this$creeveyApi2.stop();
148
+ (_this$creeveyApi2 = this.creeveyApi) === null || _this$creeveyApi2 === void 0 ? void 0 : _this$creeveyApi2.stop();
224
149
  });
225
150
 
226
- _defineProperty(this, "onImageApprove", function (id, retry, image) {
151
+ _defineProperty(this, "onImageApprove", (id, retry, image) => {
227
152
  var _this$creeveyApi3;
228
153
 
229
- return (_this$creeveyApi3 = _this.creeveyApi) === null || _this$creeveyApi3 === void 0 ? void 0 : _this$creeveyApi3.approve(id, retry, image);
154
+ return (_this$creeveyApi3 = this.creeveyApi) === null || _this$creeveyApi3 === void 0 ? void 0 : _this$creeveyApi3.approve(id, retry, image);
230
155
  });
231
156
 
232
- _defineProperty(this, "onStartAllStoryTests", function () {
157
+ _defineProperty(this, "onStartAllStoryTests", () => {
233
158
  var _this$creeveyApi4;
234
159
 
235
- var ids = Object.values(_this.status.tests).filter(_types.isDefined).filter(function (x) {
236
- return x.storyId === _this.storyId;
237
- }).map(function (x) {
238
- return x.id;
239
- });
240
- (_this$creeveyApi4 = _this.creeveyApi) === null || _this$creeveyApi4 === void 0 ? void 0 : _this$creeveyApi4.start(ids);
160
+ const ids = Object.values(this.status.tests).filter(_types.isDefined).filter(x => x.storyId === this.storyId).map(x => x.id);
161
+ (_this$creeveyApi4 = this.creeveyApi) === null || _this$creeveyApi4 === void 0 ? void 0 : _this$creeveyApi4.start(ids);
241
162
  });
242
163
 
243
- _defineProperty(this, "onStartAllTests", function () {
164
+ _defineProperty(this, "onStartAllTests", () => {
244
165
  var _this$creeveyApi5;
245
166
 
246
- var ids = Object.values(_this.status.tests).filter(_types.isDefined).map(function (x) {
247
- return x.id;
248
- });
249
- (_this$creeveyApi5 = _this.creeveyApi) === null || _this$creeveyApi5 === void 0 ? void 0 : _this$creeveyApi5.start(ids);
167
+ const ids = Object.values(this.status.tests).filter(_types.isDefined).map(x => x.id);
168
+ (_this$creeveyApi5 = this.creeveyApi) === null || _this$creeveyApi5 === void 0 ? void 0 : _this$creeveyApi5.start(ids);
250
169
  });
251
170
 
252
- _defineProperty(this, "onSetStories", function (data) {
253
- var stories = data.v ? (0, _shared.denormalizeStoryParameters)(data) : data.stories;
254
- _this.stories = stories;
171
+ _defineProperty(this, "onSetStories", data => {
172
+ const stories = data.v ? (0, _shared.denormalizeStoryParameters)(data) : data.stories;
173
+ this.stories = stories;
255
174
  });
256
175
 
257
- _defineProperty(this, "setActiveBrowser", function (browser) {
176
+ _defineProperty(this, "setActiveBrowser", browser => {
258
177
  var _this$getTestsByStory3, _this$getTestsByStory4;
259
178
 
260
- _this.activeBrowser = browser;
261
- _this.selectedTestId = (_this$getTestsByStory3 = (_this$getTestsByStory4 = _this.getTestsByStoryIdAndBrowser(_this.activeBrowser)[0]) === null || _this$getTestsByStory4 === void 0 ? void 0 : _this$getTestsByStory4.id) !== null && _this$getTestsByStory3 !== void 0 ? _this$getTestsByStory3 : '';
262
-
263
- _this.changeTestListeners.forEach(function (x) {
264
- return x(_this.selectedTestId);
265
- });
179
+ this.activeBrowser = browser;
180
+ this.selectedTestId = (_this$getTestsByStory3 = (_this$getTestsByStory4 = this.getTestsByStoryIdAndBrowser(this.activeBrowser)[0]) === null || _this$getTestsByStory4 === void 0 ? void 0 : _this$getTestsByStory4.id) !== null && _this$getTestsByStory3 !== void 0 ? _this$getTestsByStory3 : '';
181
+ this.changeTestListeners.forEach(x => x(this.selectedTestId));
266
182
  });
267
183
 
268
- _defineProperty(this, "setSelectedTestId", function (testId) {
269
- _this.selectedTestId = testId;
270
-
271
- _this.changeTestListeners.forEach(function (x) {
272
- return x(_this.selectedTestId);
273
- });
184
+ _defineProperty(this, "setSelectedTestId", testId => {
185
+ this.selectedTestId = testId;
186
+ this.changeTestListeners.forEach(x => x(this.selectedTestId));
274
187
  });
275
188
 
276
- _defineProperty(this, "getStoryTests", function (storyId) {
277
- if (!_this.status || !_this.status.tests) return [];
278
- return Object.values(_this.status.tests).filter(function (result) {
279
- return (result === null || result === void 0 ? void 0 : result.storyId) === storyId;
280
- }).filter(_types.isDefined);
189
+ _defineProperty(this, "getStoryTests", storyId => {
190
+ if (!this.status || !this.status.tests) return [];
191
+ return Object.values(this.status.tests).filter(result => (result === null || result === void 0 ? void 0 : result.storyId) === storyId).filter(_types.isDefined);
281
192
  });
282
193
 
283
- _defineProperty(this, "getBrowsers", function () {
284
- return _this.status.browsers;
194
+ _defineProperty(this, "getBrowsers", () => {
195
+ return this.status.browsers;
285
196
  });
286
197
 
287
- _defineProperty(this, "getTestsByStoryIdAndBrowser", function (browser) {
288
- return Object.values(_this.status.tests).filter(function (x) {
289
- return (x === null || x === void 0 ? void 0 : x.browser) === browser && x.storyId === _this.storyId;
290
- }).filter(_types.isDefined);
198
+ _defineProperty(this, "getTestsByStoryIdAndBrowser", browser => {
199
+ return Object.values(this.status.tests).filter(x => (x === null || x === void 0 ? void 0 : x.browser) === browser && x.storyId === this.storyId).filter(_types.isDefined);
291
200
  });
292
201
 
293
- _defineProperty(this, "getTabTitle", function (browser) {
294
- var tests = _this.getTestsByStoryIdAndBrowser(browser);
295
-
296
- var browserStatus = tests.map(function (x) {
297
- return x && x.status;
298
- }).reduce(function (oldStatus, newStatus) {
299
- return (0, _helpers.calcStatus)(oldStatus, newStatus);
300
- }, undefined);
301
- var browserSkip = tests.length > 0 ? tests.every(function (x) {
302
- return x && x.skip;
303
- }) : false;
304
- var emojiStatus = (0, _utils.getEmojiByTestStatus)(browserStatus, browserSkip);
202
+ _defineProperty(this, "getTabTitle", browser => {
203
+ const tests = this.getTestsByStoryIdAndBrowser(browser);
204
+ const browserStatus = tests.map(x => x && x.status).reduce((oldStatus, newStatus) => (0, _helpers.calcStatus)(oldStatus, newStatus), undefined);
205
+ const browserSkip = tests.length > 0 ? tests.every(x => x && x.skip) : false;
206
+ const emojiStatus = (0, _utils.getEmojiByTestStatus)(browserStatus, browserSkip);
305
207
  return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', "Creevey/").concat(browser);
306
208
  });
307
209
 
308
- _defineProperty(this, "setPanelsTitle", function () {
210
+ _defineProperty(this, "setPanelsTitle", () => {
309
211
  var _this$storybookApi;
310
212
 
311
- var panels = (_this$storybookApi = _this.storybookApi) === null || _this$storybookApi === void 0 ? void 0 : _this$storybookApi.getPanels();
213
+ const panels = (_this$storybookApi = this.storybookApi) === null || _this$storybookApi === void 0 ? void 0 : _this$storybookApi.getPanels();
312
214
  if (!panels) return;
313
- var firstPanelBrowser = _this.activeBrowser;
215
+ let firstPanelBrowser = this.activeBrowser;
314
216
 
315
- for (var p in panels) {
217
+ for (const p in panels) {
316
218
  var _panel$id;
317
219
 
318
- var panel = panels[p];
220
+ const panel = panels[p];
319
221
 
320
222
  if (((_panel$id = panel.id) === null || _panel$id === void 0 ? void 0 : _panel$id.indexOf(_register.ADDON_ID)) === 0 && panel.paramKey) {
321
- panel.title = _this.getTabTitle(panel.paramKey);
223
+ panel.title = this.getTabTitle(panel.paramKey);
322
224
  if (!firstPanelBrowser) firstPanelBrowser = panel.paramKey;
323
225
  }
324
226
  }
325
227
 
326
- _this.storybookApi.setSelectedPanel("".concat(_register.ADDON_ID, "/panel/").concat(firstPanelBrowser));
228
+ this.storybookApi.setSelectedPanel("".concat(_register.ADDON_ID, "/panel/").concat(firstPanelBrowser));
327
229
  });
328
230
 
329
231
  this.storybookApi = storybookApi;
330
232
  }
331
233
 
332
- _createClass(CreeveyManager, [{
333
- key: "onUpdateStatus",
334
- value: function onUpdateStatus(listener) {
335
- var _this2 = this;
336
-
337
- this.updateStatusListeners.push(listener);
338
- return function () {
339
- return void (_this2.updateStatusListeners = _this2.updateStatusListeners.filter(function (x) {
340
- return x != listener;
341
- }));
342
- };
343
- }
344
- }, {
345
- key: "onChangeTest",
346
- value: function onChangeTest(listener) {
347
- var _this3 = this;
348
-
349
- this.changeTestListeners.push(listener);
350
- return function () {
351
- return void (_this3.changeTestListeners = _this3.changeTestListeners.filter(function (x) {
352
- return x != listener;
353
- }));
354
- };
355
- }
356
- }, {
357
- key: "addStatusesToSideBar",
358
- value: function () {
359
- var _addStatusesToSideBar = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
360
- var _this4 = this;
361
-
362
- var stories;
363
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
364
- while (1) {
365
- switch (_context2.prev = _context2.next) {
366
- case 0:
367
- if (Object.keys(this.stories).length) {
368
- _context2.next = 2;
369
- break;
370
- }
371
-
372
- return _context2.abrupt("return");
373
-
374
- case 2:
375
- stories = this.stories;
376
- Object.keys(this.stories).forEach(function (storyId) {
377
- var storyStatus = _this4.getStoryTests(storyId);
378
-
379
- var status = storyStatus.map(function (x) {
380
- return x.status;
381
- }).reduce(function (oldStatus, newStatus) {
382
- return (0, _helpers.calcStatus)(oldStatus, newStatus);
383
- }, undefined);
384
- var skip = storyStatus.length > 0 ? storyStatus.every(function (x) {
385
- return x.skip;
386
- }) : false;
387
- _this4.stories[storyId].name = _this4.addStatusToStoryName(stories[storyId].name, status, skip);
388
- });
389
- _context2.next = 6;
390
- return this.storybookApi.setStories(this.stories);
391
-
392
- case 6:
393
- case "end":
394
- return _context2.stop();
395
- }
396
- }
397
- }, _callee2, this);
398
- }));
234
+ onUpdateStatus(listener) {
235
+ this.updateStatusListeners.push(listener);
236
+ return () => void (this.updateStatusListeners = this.updateStatusListeners.filter(x => x != listener));
237
+ }
399
238
 
400
- function addStatusesToSideBar() {
401
- return _addStatusesToSideBar.apply(this, arguments);
402
- }
239
+ onChangeTest(listener) {
240
+ this.changeTestListeners.push(listener);
241
+ return () => void (this.changeTestListeners = this.changeTestListeners.filter(x => x != listener));
242
+ }
243
+
244
+ async addStatusesToSideBar() {
245
+ if (!Object.keys(this.stories).length) return;
246
+ const stories = this.stories;
247
+ Object.keys(this.stories).forEach(storyId => {
248
+ const storyStatus = this.getStoryTests(storyId);
249
+ const status = storyStatus.map(x => x.status).reduce((oldStatus, newStatus) => (0, _helpers.calcStatus)(oldStatus, newStatus), undefined);
250
+ const skip = storyStatus.length > 0 ? storyStatus.every(x => x.skip) : false;
251
+ this.stories[storyId].name = this.addStatusToStoryName(stories[storyId].name, status, skip);
252
+ });
253
+ await this.storybookApi.setStories(this.stories);
254
+ }
255
+
256
+ addStatusToStoryName(name, status, skip) {
257
+ name = name.replace(/^(❌|✔|🟡|🕗|⏸) /, '');
258
+ const emojiStatus = (0, _utils.getEmojiByTestStatus)(status, skip);
259
+ return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', " ").concat(name);
260
+ }
403
261
 
404
- return addStatusesToSideBar;
405
- }()
406
- }, {
407
- key: "addStatusToStoryName",
408
- value: function addStatusToStoryName(name, status, skip) {
409
- name = name.replace(/^(❌|✔|🟡|🕗|⏸) /, '');
410
- var emojiStatus = (0, _utils.getEmojiByTestStatus)(status, skip);
411
- return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', " ").concat(name);
412
- }
413
- }]);
414
-
415
- return CreeveyManager;
416
- }();
262
+ }
417
263
 
418
264
  exports.CreeveyManager = CreeveyManager;
@@ -1,7 +1,5 @@
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); }
4
-
5
3
  Object.defineProperty(exports, "__esModule", {
6
4
  value: true
7
5
  });
@@ -13,54 +11,35 @@ var _react = _interopRequireWildcard(require("react"));
13
11
 
14
12
  var _Panel = require("./Panel");
15
13
 
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
21
-
22
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
23
-
24
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
25
-
26
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
27
-
28
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
29
-
30
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
31
-
32
- var Addon = function Addon(_ref) {
33
- var active = _ref.active,
34
- browser = _ref.browser,
35
- manager = _ref.manager;
36
-
37
- var _useState = (0, _react.useState)([]),
38
- _useState2 = _slicedToArray(_useState, 2),
39
- tests = _useState2[0],
40
- setTests = _useState2[1];
14
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
41
15
 
42
- var _useState3 = (0, _react.useState)(manager.selectedTestId),
43
- _useState4 = _slicedToArray(_useState3, 2),
44
- selectedTestId = _useState4[0],
45
- setSelectedTestId = _useState4[1];
16
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
46
17
 
47
- (0, _react.useEffect)(function () {
18
+ const Addon = _ref => {
19
+ let {
20
+ active,
21
+ browser,
22
+ manager
23
+ } = _ref;
24
+ const [tests, setTests] = (0, _react.useState)([]);
25
+ const [selectedTestId, setSelectedTestId] = (0, _react.useState)(manager.selectedTestId);
26
+ (0, _react.useEffect)(() => {
48
27
  if (active) {
49
28
  manager.setActiveBrowser(browser);
50
- var browserTests = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
29
+ const browserTests = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
51
30
  setTests(browserTests);
52
31
  }
53
32
  }, [active, browser, manager]);
54
- (0, _react.useEffect)(function () {
55
- var unsubscribe = manager.onChangeTest(function (testId) {
33
+ (0, _react.useEffect)(() => {
34
+ const unsubscribe = manager.onChangeTest(testId => {
56
35
  setSelectedTestId(testId);
57
- var status = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
36
+ const status = manager.getTestsByStoryIdAndBrowser(manager.activeBrowser);
58
37
  setTests(status);
59
38
  });
60
39
  return unsubscribe;
61
40
  }, [manager]);
62
- (0, _react.useEffect)(function () {
63
- var unsubscribe = manager.onUpdateStatus(function () {
41
+ (0, _react.useEffect)(() => {
42
+ const unsubscribe = manager.onUpdateStatus(() => {
64
43
  setTests(manager.getTestsByStoryIdAndBrowser(manager.activeBrowser));
65
44
  });
66
45
  return unsubscribe;
@@ -9,9 +9,11 @@ var _react = _interopRequireDefault(require("react"));
9
9
 
10
10
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
11
 
12
- var NextIcon = function NextIcon(_ref) {
13
- var width = _ref.width,
14
- height = _ref.height;
12
+ const NextIcon = _ref => {
13
+ let {
14
+ width,
15
+ height
16
+ } = _ref;
15
17
  return /*#__PURE__*/_react.default.createElement("svg", {
16
18
  version: "1.1",
17
19
  width: width,
@@ -25,9 +27,11 @@ var NextIcon = function NextIcon(_ref) {
25
27
 
26
28
  exports.NextIcon = NextIcon;
27
29
 
28
- var ForwardIcon = function ForwardIcon(_ref2) {
29
- var width = _ref2.width,
30
- height = _ref2.height;
30
+ const ForwardIcon = _ref2 => {
31
+ let {
32
+ width,
33
+ height
34
+ } = _ref2;
31
35
  return /*#__PURE__*/_react.default.createElement("svg", {
32
36
  version: "1.1",
33
37
  width: width,