creevey 0.9.0-beta.2 → 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 (236) hide show
  1. package/AUTHORS +15 -15
  2. package/CHANGELOG.md +1275 -1275
  3. package/LICENSE +21 -21
  4. package/README.md +7 -0
  5. package/addon/README.md +3 -0
  6. package/addon/package.json +4 -0
  7. package/docs/config.md +212 -212
  8. package/docs/grid.md +10 -10
  9. package/docs/tests.md +63 -63
  10. package/jest.config.js +6 -0
  11. package/lib/cjs/client/addon/Manager.js +123 -271
  12. package/lib/cjs/client/addon/components/Addon.js +17 -38
  13. package/lib/cjs/client/addon/components/Icons.js +12 -8
  14. package/lib/cjs/client/addon/components/Panel.js +17 -13
  15. package/lib/cjs/client/addon/components/TestSelect.js +11 -9
  16. package/lib/cjs/client/addon/components/Tools.js +21 -40
  17. package/lib/cjs/client/addon/decorator.js +1 -1
  18. package/lib/cjs/client/addon/index.js +31 -0
  19. package/lib/cjs/client/addon/preset.js +13 -32
  20. package/lib/cjs/client/addon/register.js +46 -70
  21. package/lib/cjs/client/addon/utils.js +1 -1
  22. package/lib/cjs/client/addon/withCreevey.js +164 -344
  23. package/lib/cjs/client/shared/components/ImagesView/BlendView.js +23 -21
  24. package/lib/cjs/client/shared/components/ImagesView/ImagesView.js +22 -18
  25. package/lib/cjs/client/shared/components/ImagesView/SideBySideView.js +42 -64
  26. package/lib/cjs/client/shared/components/ImagesView/SlideView.js +35 -48
  27. package/lib/cjs/client/shared/components/ImagesView/SwapView.js +24 -43
  28. package/lib/cjs/client/shared/components/ImagesView/index.js +9 -9
  29. package/lib/cjs/client/shared/components/PageFooter/PageFooter.js +12 -8
  30. package/lib/cjs/client/shared/components/PageFooter/Paging.js +14 -18
  31. package/lib/cjs/client/shared/components/PageHeader/ImagePreview.js +22 -18
  32. package/lib/cjs/client/shared/components/PageHeader/PageHeader.js +42 -67
  33. package/lib/cjs/client/shared/components/ResultsPage.js +39 -69
  34. package/lib/cjs/client/shared/creeveyClientApi.js +55 -82
  35. package/lib/cjs/client/shared/helpers.js +143 -214
  36. package/lib/cjs/client/shared/viewMode.js +5 -5
  37. package/lib/cjs/client/web/142.js +2 -0
  38. package/lib/cjs/client/web/142.js.LICENSE.txt +12 -0
  39. package/lib/cjs/client/web/32.js +1 -0
  40. package/lib/cjs/client/web/551.js +1 -0
  41. package/lib/cjs/client/web/566.js +2 -0
  42. package/lib/cjs/client/web/566.js.LICENSE.txt +31 -0
  43. package/lib/cjs/client/web/691.js +2 -0
  44. package/lib/cjs/client/web/691.js.LICENSE.txt +8 -0
  45. package/lib/cjs/client/web/725.js +1 -0
  46. package/lib/cjs/client/web/index.html +19 -19
  47. package/lib/cjs/client/web/main.js +2 -38
  48. package/lib/cjs/client/web/main.js.LICENSE.txt +49 -0
  49. package/lib/cjs/creevey.js +3 -5
  50. package/lib/cjs/index.js +4 -4
  51. package/lib/cjs/server/config.js +1 -1
  52. package/lib/cjs/server/docker.js +3 -7
  53. package/lib/cjs/server/index.js +1 -1
  54. package/lib/cjs/server/loaders/babel/creevey-plugin.js +1 -3
  55. package/lib/cjs/server/loaders/babel/helpers.js +13 -23
  56. package/lib/cjs/server/loaders/babel/register.js +1 -3
  57. package/lib/cjs/server/loaders/webpack/compile.js +31 -24
  58. package/lib/cjs/server/loaders/webpack/creevey-loader.js +10 -5
  59. package/lib/cjs/server/loaders/webpack/dummy-hmr.js +2 -7
  60. package/lib/cjs/server/loaders/webpack/mdx-loader.js +1 -1
  61. package/lib/cjs/server/loaders/webpack/start.js +1 -1
  62. package/lib/cjs/server/logger.js +2 -1
  63. package/lib/cjs/server/master/index.js +2 -2
  64. package/lib/cjs/server/master/pool.js +9 -18
  65. package/lib/cjs/server/master/runner.js +53 -66
  66. package/lib/cjs/server/master/server.js +2 -2
  67. package/lib/cjs/server/messages.js +8 -10
  68. package/lib/cjs/server/selenium/browser.js +23 -31
  69. package/lib/cjs/server/selenium/selenoid.js +5 -7
  70. package/lib/cjs/server/stories.js +9 -20
  71. package/lib/cjs/server/storybook/entry.js +5 -3
  72. package/lib/cjs/server/storybook/helpers.js +15 -21
  73. package/lib/cjs/server/storybook/providers/browser.js +5 -9
  74. package/lib/cjs/server/storybook/providers/nodejs.js +4 -4
  75. package/lib/cjs/server/update.js +1 -5
  76. package/lib/cjs/server/utils.js +13 -15
  77. package/lib/cjs/server/worker/reporter.js +8 -20
  78. package/lib/cjs/server/worker/worker.js +6 -16
  79. package/lib/cjs/shared/index.js +101 -0
  80. package/lib/cjs/shared/serializeRegExp.js +42 -0
  81. package/lib/cjs/types.js +6 -6
  82. package/lib/esm/client/addon/Manager.js +123 -271
  83. package/lib/esm/client/addon/components/Addon.js +15 -34
  84. package/lib/esm/client/addon/components/Icons.js +11 -7
  85. package/lib/esm/client/addon/components/Panel.js +17 -13
  86. package/lib/esm/client/addon/components/TestSelect.js +11 -9
  87. package/lib/esm/client/addon/components/Tools.js +19 -36
  88. package/lib/esm/client/addon/decorator.js +1 -1
  89. package/lib/esm/client/addon/index.js +2 -0
  90. package/lib/esm/client/addon/preset.js +10 -25
  91. package/lib/esm/client/addon/register.js +42 -66
  92. package/lib/esm/client/addon/utils.js +1 -1
  93. package/lib/esm/client/addon/withCreevey.js +157 -341
  94. package/lib/esm/client/shared/components/ImagesView/BlendView.js +21 -17
  95. package/lib/esm/client/shared/components/ImagesView/ImagesView.js +21 -17
  96. package/lib/esm/client/shared/components/ImagesView/SideBySideView.js +40 -60
  97. package/lib/esm/client/shared/components/ImagesView/SlideView.js +33 -44
  98. package/lib/esm/client/shared/components/ImagesView/SwapView.js +22 -39
  99. package/lib/esm/client/shared/components/PageFooter/PageFooter.js +12 -8
  100. package/lib/esm/client/shared/components/PageFooter/Paging.js +14 -18
  101. package/lib/esm/client/shared/components/PageHeader/ImagePreview.js +22 -18
  102. package/lib/esm/client/shared/components/PageHeader/PageHeader.js +37 -60
  103. package/lib/esm/client/shared/components/ResultsPage.js +36 -64
  104. package/lib/esm/client/shared/creeveyClientApi.js +57 -84
  105. package/lib/esm/client/shared/helpers.js +127 -198
  106. package/lib/esm/client/shared/viewMode.js +4 -4
  107. package/lib/esm/creevey.js +3 -5
  108. package/lib/esm/index.js +1 -3
  109. package/lib/esm/server/docker.js +2 -2
  110. package/lib/esm/server/index.js +1 -1
  111. package/lib/esm/server/loaders/babel/creevey-plugin.js +1 -3
  112. package/lib/esm/server/loaders/babel/helpers.js +12 -22
  113. package/lib/esm/server/loaders/babel/register.js +1 -3
  114. package/lib/esm/server/loaders/webpack/compile.js +31 -24
  115. package/lib/esm/server/loaders/webpack/creevey-loader.js +9 -4
  116. package/lib/esm/server/loaders/webpack/dummy-hmr.js +2 -6
  117. package/lib/esm/server/loaders/webpack/start.js +1 -1
  118. package/lib/esm/server/master/index.js +2 -2
  119. package/lib/esm/server/master/pool.js +7 -18
  120. package/lib/esm/server/master/runner.js +53 -66
  121. package/lib/esm/server/master/server.js +2 -2
  122. package/lib/esm/server/messages.js +3 -5
  123. package/lib/esm/server/selenium/browser.js +20 -28
  124. package/lib/esm/server/selenium/selenoid.js +4 -6
  125. package/lib/esm/server/stories.js +9 -20
  126. package/lib/esm/server/storybook/entry.js +4 -2
  127. package/lib/esm/server/storybook/helpers.js +7 -15
  128. package/lib/esm/server/storybook/providers/browser.js +4 -5
  129. package/lib/esm/server/storybook/providers/nodejs.js +3 -3
  130. package/lib/esm/server/update.js +1 -5
  131. package/lib/esm/server/utils.js +5 -9
  132. package/lib/esm/server/worker/reporter.js +8 -20
  133. package/lib/esm/server/worker/worker.js +6 -16
  134. package/lib/esm/shared/index.js +78 -0
  135. package/lib/esm/shared/serializeRegExp.js +24 -0
  136. package/lib/types/cli.d.ts +1 -1
  137. package/lib/types/client/addon/Manager.d.ts +37 -37
  138. package/lib/types/client/addon/components/Addon.d.ts +8 -8
  139. package/lib/types/client/addon/components/Icons.d.ts +7 -7
  140. package/lib/types/client/addon/components/Panel.d.ts +9 -9
  141. package/lib/types/client/addon/components/TestSelect.d.ts +8 -9
  142. package/lib/types/client/addon/components/Tools.d.ts +6 -6
  143. package/lib/types/client/addon/decorator.d.ts +1 -1
  144. package/lib/types/client/addon/index.d.ts +2 -0
  145. package/lib/types/client/addon/preset.d.ts +23 -24
  146. package/lib/types/client/addon/readyForCapture.d.ts +6 -6
  147. package/lib/types/client/addon/register.d.ts +3 -3
  148. package/lib/types/client/addon/utils.d.ts +2 -2
  149. package/lib/types/client/addon/withCreevey.d.ts +24 -24
  150. package/lib/types/client/shared/components/ImagesView/BlendView.d.ts +3 -3
  151. package/lib/types/client/shared/components/ImagesView/ImagesView.d.ts +24 -25
  152. package/lib/types/client/shared/components/ImagesView/SideBySideView.d.ts +3 -3
  153. package/lib/types/client/shared/components/ImagesView/SlideView.d.ts +3 -3
  154. package/lib/types/client/shared/components/ImagesView/SwapView.d.ts +3 -3
  155. package/lib/types/client/shared/components/ImagesView/index.d.ts +5 -5
  156. package/lib/types/client/shared/components/PageFooter/PageFooter.d.ts +8 -9
  157. package/lib/types/client/shared/components/PageFooter/Paging.d.ts +7 -8
  158. package/lib/types/client/shared/components/PageHeader/ImagePreview.d.ts +12 -12
  159. package/lib/types/client/shared/components/PageHeader/PageHeader.d.ts +16 -17
  160. package/lib/types/client/shared/components/ResultsPage.d.ts +18 -18
  161. package/lib/types/client/shared/creeveyClientApi.d.ts +9 -9
  162. package/lib/types/client/shared/helpers.d.ts +46 -46
  163. package/lib/types/client/shared/viewMode.d.ts +4 -4
  164. package/lib/types/client/web/CreeveyApp.d.ts +11 -12
  165. package/lib/types/client/web/CreeveyContext.d.ts +11 -11
  166. package/lib/types/client/web/CreeveyLoader.d.ts +2 -3
  167. package/lib/types/client/web/CreeveyView/SideBar/Checkbox.d.ts +19 -19
  168. package/lib/types/client/web/CreeveyView/SideBar/Search.d.ts +6 -6
  169. package/lib/types/client/web/CreeveyView/SideBar/SideBar.d.ts +14 -14
  170. package/lib/types/client/web/CreeveyView/SideBar/SideBarHeader.d.ts +12 -13
  171. package/lib/types/client/web/CreeveyView/SideBar/SuiteLink.d.ts +33 -33
  172. package/lib/types/client/web/CreeveyView/SideBar/TestLink.d.ts +7 -8
  173. package/lib/types/client/web/CreeveyView/SideBar/TestStatusIcon.d.ts +10 -10
  174. package/lib/types/client/web/CreeveyView/SideBar/TestsStatus.d.ts +9 -9
  175. package/lib/types/client/web/CreeveyView/SideBar/Toggle.d.ts +6 -6
  176. package/lib/types/client/web/CreeveyView/SideBar/index.d.ts +1 -1
  177. package/lib/types/client/web/KeyboardEventsContext.d.ts +13 -13
  178. package/lib/types/client/web/index.d.ts +4 -4
  179. package/lib/types/creevey.d.ts +1 -1
  180. package/lib/types/index.d.ts +0 -1
  181. package/lib/types/server/config.d.ts +4 -4
  182. package/lib/types/server/docker.d.ts +7 -7
  183. package/lib/types/server/extract.d.ts +2 -2
  184. package/lib/types/server/index.d.ts +2 -2
  185. package/lib/types/server/loaders/babel/creevey-plugin.d.ts +1 -1
  186. package/lib/types/server/loaders/babel/helpers.d.ts +19 -19
  187. package/lib/types/server/loaders/babel/register.d.ts +5 -5
  188. package/lib/types/server/loaders/hooks/mdx.d.ts +1 -1
  189. package/lib/types/server/loaders/hooks/svelte.d.ts +1 -1
  190. package/lib/types/server/loaders/webpack/compile.d.ts +2 -2
  191. package/lib/types/server/loaders/webpack/creevey-loader.d.ts +4 -2
  192. package/lib/types/server/loaders/webpack/dummy-hmr.d.ts +10 -10
  193. package/lib/types/server/loaders/webpack/mdx-loader.d.ts +6 -6
  194. package/lib/types/server/loaders/webpack/start.d.ts +1 -1
  195. package/lib/types/server/logger.d.ts +10 -6
  196. package/lib/types/server/master/api.d.ts +7 -7
  197. package/lib/types/server/master/index.d.ts +3 -3
  198. package/lib/types/server/master/master.d.ts +7 -7
  199. package/lib/types/server/master/pool.d.ts +31 -31
  200. package/lib/types/server/master/runner.d.ts +26 -26
  201. package/lib/types/server/master/server.d.ts +2 -2
  202. package/lib/types/server/messages.d.ts +27 -27
  203. package/lib/types/server/selenium/browser.d.ts +17 -17
  204. package/lib/types/server/selenium/index.d.ts +2 -2
  205. package/lib/types/server/selenium/selenoid.d.ts +3 -3
  206. package/lib/types/server/stories.d.ts +8 -8
  207. package/lib/types/server/storybook/entry.d.ts +18 -18
  208. package/lib/types/server/storybook/helpers.d.ts +24 -24
  209. package/lib/types/server/storybook/providers/browser.d.ts +4 -4
  210. package/lib/types/server/storybook/providers/hybrid.d.ts +4 -4
  211. package/lib/types/server/storybook/providers/nodejs.d.ts +9 -9
  212. package/lib/types/server/testsFiles/parser.d.ts +12 -12
  213. package/lib/types/server/testsFiles/register.d.ts +2 -2
  214. package/lib/types/server/update.d.ts +2 -2
  215. package/lib/types/server/utils.d.ts +20 -20
  216. package/lib/types/server/worker/chai-image.d.ts +6 -6
  217. package/lib/types/server/worker/helpers.d.ts +8 -8
  218. package/lib/types/server/worker/index.d.ts +1 -1
  219. package/lib/types/server/worker/reporter.d.ts +8 -8
  220. package/lib/types/server/worker/worker.d.ts +4 -4
  221. package/lib/types/{shared.d.ts → shared/index.d.ts} +7 -16
  222. package/lib/types/shared/serializeRegExp.d.ts +9 -0
  223. package/lib/types/types.d.ts +490 -489
  224. package/package.json +115 -102
  225. package/preset.js +9 -9
  226. package/types/babel__register.d.ts +1 -1
  227. package/types/chai.d.ts +12 -12
  228. package/types/event-source-polyfill.d.ts +6 -6
  229. package/types/mdx.d.ts +3 -2
  230. package/types/mocha.d.ts +20 -20
  231. package/types/png.d.ts +4 -4
  232. package/lib/cjs/client/web/1.js +0 -13
  233. package/lib/cjs/client/web/2.js +0 -1
  234. package/lib/cjs/shared.js +0 -124
  235. package/lib/esm/shared.js +0 -93
  236. package/storybook-static/stories.json +0 -21
@@ -19,44 +19,10 @@ var _register = require("./register");
19
19
 
20
20
  var _utils = require("./utils");
21
21
 
22
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
23
-
24
- 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."); }
25
-
26
- 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; }
27
-
28
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
-
30
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
31
-
32
- 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."); }
33
-
34
- 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); }
35
-
36
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
37
-
38
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
39
-
40
- 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; }
41
-
42
- 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); } }
43
-
44
- 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); }); }; }
45
-
46
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
47
-
48
- 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); } }
49
-
50
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
51
-
52
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; }
53
23
 
54
- var CreeveyManager = /*#__PURE__*/function () {
55
- function CreeveyManager(storybookApi) {
56
- var _this = this;
57
-
58
- _classCallCheck(this, CreeveyManager);
59
-
24
+ class CreeveyManager {
25
+ constructor(storybookApi) {
60
26
  _defineProperty(this, "storyId", '');
61
27
 
62
28
  _defineProperty(this, "activeBrowser", '');
@@ -71,66 +37,46 @@ var CreeveyManager = /*#__PURE__*/function () {
71
37
 
72
38
  _defineProperty(this, "creeveyApi", null);
73
39
 
40
+ _defineProperty(this, "storybookApi", void 0);
41
+
74
42
  _defineProperty(this, "stories", {});
75
43
 
76
44
  _defineProperty(this, "updateStatusListeners", []);
77
45
 
78
46
  _defineProperty(this, "changeTestListeners", []);
79
47
 
80
- _defineProperty(this, "initAll", /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
81
- return regeneratorRuntime.wrap(function _callee$(_context) {
82
- while (1) {
83
- switch (_context.prev = _context.next) {
84
- case 0:
85
- _this.storybookApi.on(_coreEvents.STORY_RENDERED, _this.onStoryRendered);
86
-
87
- _this.storybookApi.on(_coreEvents.SET_STORIES, _this.onSetStories);
88
-
89
- _context.next = 4;
90
- return (0, _creeveyClientApi.initCreeveyClientApi)();
91
-
92
- case 4:
93
- _this.creeveyApi = _context.sent;
94
-
95
- _this.creeveyApi.onUpdate(_this.handleCreeveyUpdate);
96
-
97
- _context.next = 8;
98
- return _this.creeveyApi.status;
99
-
100
- case 8:
101
- _this.status = _context.sent;
102
-
103
- case 9:
104
- case "end":
105
- return _context.stop();
106
- }
107
- }
108
- }, _callee);
109
- })));
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
+ });
110
55
 
111
- _defineProperty(this, "handleCreeveyUpdate", function (update) {
112
- var tests = update.tests,
113
- _update$removedTests = update.removedTests,
114
- removedTests = _update$removedTests === void 0 ? [] : _update$removedTests,
115
- isRunning = update.isRunning;
56
+ _defineProperty(this, "handleCreeveyUpdate", update => {
57
+ const {
58
+ tests,
59
+ removedTests = [],
60
+ isRunning
61
+ } = update;
116
62
 
117
63
  if ((0, _types.isDefined)(isRunning)) {
118
- _this.status.isRunning = isRunning;
64
+ this.status.isRunning = isRunning;
119
65
  }
120
66
 
121
67
  if ((0, _types.isDefined)(tests)) {
122
- var prevTests = _this.status.tests;
123
- var prevStories = _this.stories || {};
124
- Object.values(tests).filter(_types.isDefined).forEach(function (update) {
125
- var _test$results;
126
-
127
- var id = update.id,
128
- skip = update.skip,
129
- status = update.status,
130
- results = update.results,
131
- approved = update.approved,
132
- storyId = update.storyId;
133
- 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];
134
80
 
135
81
  if (!test) {
136
82
  return prevTests[id] = update;
@@ -142,271 +88,177 @@ var CreeveyManager = /*#__PURE__*/function () {
142
88
  test.status = status;
143
89
 
144
90
  if ((0, _types.isDefined)(storyId) && (0, _types.isDefined)(prevStories[storyId])) {
145
- var story = prevStories[storyId];
146
-
147
- var storyStatus = _this.getStoryTests(storyId);
148
-
149
- var oldStatus = storyStatus.map(function (x) {
150
- return x.id === id ? status : x.status;
151
- }).reduce(function (oldStatus, newStatus) {
152
- return (0, _helpers.calcStatus)(oldStatus, newStatus);
153
- }, undefined);
154
- 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);
155
95
  }
156
96
  }
157
97
 
158
- 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;
159
99
 
160
100
  if ((0, _types.isDefined)(approved)) {
161
- Object.entries(approved).forEach(function (_ref2) {
162
- var _ref3 = _slicedToArray(_ref2, 2),
163
- image = _ref3[0],
164
- retry = _ref3[1];
165
-
101
+ Object.entries(approved).forEach(_ref => {
102
+ let [image, retry] = _ref;
166
103
  return retry !== undefined && test && ((test.approved = (test === null || test === void 0 ? void 0 : test.approved) || {})[image] = retry);
167
104
  });
168
105
  }
169
106
  });
170
- removedTests.forEach(function (_ref4) {
171
- var id = _ref4.id;
107
+ removedTests.forEach(_ref2 => {
108
+ let {
109
+ id
110
+ } = _ref2;
172
111
  return delete prevTests[id];
173
112
  });
174
- _this.status.tests = prevTests;
175
- _this.stories = prevStories;
176
-
177
- _this.setPanelsTitle();
178
-
179
- 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);
180
117
  }
181
118
 
182
- _this.updateStatusListeners.forEach(function (x) {
183
- return x(update);
184
- });
119
+ this.updateStatusListeners.forEach(x => x(update));
185
120
  });
186
121
 
187
- _defineProperty(this, "getCurrentTest", function () {
188
- return _this.status.tests[_this.selectedTestId];
122
+ _defineProperty(this, "getCurrentTest", () => {
123
+ return this.status.tests[this.selectedTestId];
189
124
  });
190
125
 
191
- _defineProperty(this, "onStoryRendered", function (storyId) {
192
- if (_this.storyId === '') void _this.addStatusesToSideBar();
126
+ _defineProperty(this, "onStoryRendered", storyId => {
127
+ if (this.storyId === '') void this.addStatusesToSideBar();
193
128
 
194
- if (_this.storyId !== storyId) {
129
+ if (this.storyId !== storyId) {
195
130
  var _this$getTestsByStory, _this$getTestsByStory2;
196
131
 
197
- _this.storyId = storyId;
198
- _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 : '';
199
-
200
- _this.setPanelsTitle();
201
-
202
- _this.changeTestListeners.forEach(function (x) {
203
- return x(_this.selectedTestId);
204
- });
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));
205
136
  }
206
137
  });
207
138
 
208
- _defineProperty(this, "onStart", function () {
139
+ _defineProperty(this, "onStart", () => {
209
140
  var _this$creeveyApi;
210
141
 
211
- (_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]);
212
143
  });
213
144
 
214
- _defineProperty(this, "onStop", function () {
145
+ _defineProperty(this, "onStop", () => {
215
146
  var _this$creeveyApi2;
216
147
 
217
- (_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();
218
149
  });
219
150
 
220
- _defineProperty(this, "onImageApprove", function (id, retry, image) {
151
+ _defineProperty(this, "onImageApprove", (id, retry, image) => {
221
152
  var _this$creeveyApi3;
222
153
 
223
- 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);
224
155
  });
225
156
 
226
- _defineProperty(this, "onStartAllStoryTests", function () {
157
+ _defineProperty(this, "onStartAllStoryTests", () => {
227
158
  var _this$creeveyApi4;
228
159
 
229
- var ids = Object.values(_this.status.tests).filter(_types.isDefined).filter(function (x) {
230
- return x.storyId === _this.storyId;
231
- }).map(function (x) {
232
- return x.id;
233
- });
234
- (_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);
235
162
  });
236
163
 
237
- _defineProperty(this, "onStartAllTests", function () {
164
+ _defineProperty(this, "onStartAllTests", () => {
238
165
  var _this$creeveyApi5;
239
166
 
240
- var ids = Object.values(_this.status.tests).filter(_types.isDefined).map(function (x) {
241
- return x.id;
242
- });
243
- (_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);
244
169
  });
245
170
 
246
- _defineProperty(this, "onSetStories", function (data) {
247
- var stories = data.v ? (0, _shared.denormalizeStoryParameters)(data) : data.stories;
248
- _this.stories = stories;
171
+ _defineProperty(this, "onSetStories", data => {
172
+ const stories = data.v ? (0, _shared.denormalizeStoryParameters)(data) : data.stories;
173
+ this.stories = stories;
249
174
  });
250
175
 
251
- _defineProperty(this, "setActiveBrowser", function (browser) {
176
+ _defineProperty(this, "setActiveBrowser", browser => {
252
177
  var _this$getTestsByStory3, _this$getTestsByStory4;
253
178
 
254
- _this.activeBrowser = browser;
255
- _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 : '';
256
-
257
- _this.changeTestListeners.forEach(function (x) {
258
- return x(_this.selectedTestId);
259
- });
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));
260
182
  });
261
183
 
262
- _defineProperty(this, "setSelectedTestId", function (testId) {
263
- _this.selectedTestId = testId;
264
-
265
- _this.changeTestListeners.forEach(function (x) {
266
- return x(_this.selectedTestId);
267
- });
184
+ _defineProperty(this, "setSelectedTestId", testId => {
185
+ this.selectedTestId = testId;
186
+ this.changeTestListeners.forEach(x => x(this.selectedTestId));
268
187
  });
269
188
 
270
- _defineProperty(this, "getStoryTests", function (storyId) {
271
- if (!_this.status || !_this.status.tests) return [];
272
- return Object.values(_this.status.tests).filter(function (result) {
273
- return (result === null || result === void 0 ? void 0 : result.storyId) === storyId;
274
- }).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);
275
192
  });
276
193
 
277
- _defineProperty(this, "getBrowsers", function () {
278
- return _this.status.browsers;
194
+ _defineProperty(this, "getBrowsers", () => {
195
+ return this.status.browsers;
279
196
  });
280
197
 
281
- _defineProperty(this, "getTestsByStoryIdAndBrowser", function (browser) {
282
- return Object.values(_this.status.tests).filter(function (x) {
283
- return (x === null || x === void 0 ? void 0 : x.browser) === browser && x.storyId === _this.storyId;
284
- }).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);
285
200
  });
286
201
 
287
- _defineProperty(this, "getTabTitle", function (browser) {
288
- var tests = _this.getTestsByStoryIdAndBrowser(browser);
289
-
290
- var browserStatus = tests.map(function (x) {
291
- return x && x.status;
292
- }).reduce(function (oldStatus, newStatus) {
293
- return (0, _helpers.calcStatus)(oldStatus, newStatus);
294
- }, undefined);
295
- var browserSkip = tests.length > 0 ? tests.every(function (x) {
296
- return x && x.skip;
297
- }) : false;
298
- 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);
299
207
  return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', "Creevey/").concat(browser);
300
208
  });
301
209
 
302
- _defineProperty(this, "setPanelsTitle", function () {
210
+ _defineProperty(this, "setPanelsTitle", () => {
303
211
  var _this$storybookApi;
304
212
 
305
- 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();
306
214
  if (!panels) return;
307
- var firstPanelBrowser = _this.activeBrowser;
215
+ let firstPanelBrowser = this.activeBrowser;
308
216
 
309
- for (var p in panels) {
217
+ for (const p in panels) {
310
218
  var _panel$id;
311
219
 
312
- var panel = panels[p];
220
+ const panel = panels[p];
313
221
 
314
222
  if (((_panel$id = panel.id) === null || _panel$id === void 0 ? void 0 : _panel$id.indexOf(_register.ADDON_ID)) === 0 && panel.paramKey) {
315
- panel.title = _this.getTabTitle(panel.paramKey);
223
+ panel.title = this.getTabTitle(panel.paramKey);
316
224
  if (!firstPanelBrowser) firstPanelBrowser = panel.paramKey;
317
225
  }
318
226
  }
319
227
 
320
- _this.storybookApi.setSelectedPanel("".concat(_register.ADDON_ID, "/panel/").concat(firstPanelBrowser));
228
+ this.storybookApi.setSelectedPanel("".concat(_register.ADDON_ID, "/panel/").concat(firstPanelBrowser));
321
229
  });
322
230
 
323
231
  this.storybookApi = storybookApi;
324
232
  }
325
233
 
326
- _createClass(CreeveyManager, [{
327
- key: "onUpdateStatus",
328
- value: function onUpdateStatus(listener) {
329
- var _this2 = this;
330
-
331
- this.updateStatusListeners.push(listener);
332
- return function () {
333
- return void (_this2.updateStatusListeners = _this2.updateStatusListeners.filter(function (x) {
334
- return x != listener;
335
- }));
336
- };
337
- }
338
- }, {
339
- key: "onChangeTest",
340
- value: function onChangeTest(listener) {
341
- var _this3 = this;
342
-
343
- this.changeTestListeners.push(listener);
344
- return function () {
345
- return void (_this3.changeTestListeners = _this3.changeTestListeners.filter(function (x) {
346
- return x != listener;
347
- }));
348
- };
349
- }
350
- }, {
351
- key: "addStatusesToSideBar",
352
- value: function () {
353
- var _addStatusesToSideBar = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
354
- var _this4 = this;
355
-
356
- var stories;
357
- return regeneratorRuntime.wrap(function _callee2$(_context2) {
358
- while (1) {
359
- switch (_context2.prev = _context2.next) {
360
- case 0:
361
- if (Object.keys(this.stories).length) {
362
- _context2.next = 2;
363
- break;
364
- }
365
-
366
- return _context2.abrupt("return");
367
-
368
- case 2:
369
- stories = this.stories;
370
- Object.keys(this.stories).forEach(function (storyId) {
371
- var storyStatus = _this4.getStoryTests(storyId);
372
-
373
- var status = storyStatus.map(function (x) {
374
- return x.status;
375
- }).reduce(function (oldStatus, newStatus) {
376
- return (0, _helpers.calcStatus)(oldStatus, newStatus);
377
- }, undefined);
378
- var skip = storyStatus.length > 0 ? storyStatus.every(function (x) {
379
- return x.skip;
380
- }) : false;
381
- _this4.stories[storyId].name = _this4.addStatusToStoryName(stories[storyId].name, status, skip);
382
- });
383
- _context2.next = 6;
384
- return this.storybookApi.setStories(this.stories);
385
-
386
- case 6:
387
- case "end":
388
- return _context2.stop();
389
- }
390
- }
391
- }, _callee2, this);
392
- }));
234
+ onUpdateStatus(listener) {
235
+ this.updateStatusListeners.push(listener);
236
+ return () => void (this.updateStatusListeners = this.updateStatusListeners.filter(x => x != listener));
237
+ }
393
238
 
394
- function addStatusesToSideBar() {
395
- return _addStatusesToSideBar.apply(this, arguments);
396
- }
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
+ }
397
261
 
398
- return addStatusesToSideBar;
399
- }()
400
- }, {
401
- key: "addStatusToStoryName",
402
- value: function addStatusToStoryName(name, status, skip) {
403
- name = name.replace(/^(❌|✔|🟡|🕗|⏸) /, '');
404
- var emojiStatus = (0, _utils.getEmojiByTestStatus)(status, skip);
405
- return "".concat(emojiStatus ? "".concat(emojiStatus, " ") : '', " ").concat(name);
406
- }
407
- }]);
408
-
409
- return CreeveyManager;
410
- }();
262
+ }
411
263
 
412
264
  exports.CreeveyManager = CreeveyManager;
@@ -1,7 +1,5 @@
1
1
  "use strict";
2
2
 
3
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _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;
@@ -3,15 +3,17 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ForwardIcon = exports.NextIcon = void 0;
6
+ exports.NextIcon = exports.ForwardIcon = void 0;
7
7
 
8
8
  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,
@@ -35,7 +39,7 @@ var ForwardIcon = function ForwardIcon(_ref2) {
35
39
  viewBox: "0 0 512 512"
36
40
  }, /*#__PURE__*/_react.default.createElement("path", {
37
41
  fill: "currentColor",
38
- d: "M460.9,246.8l-209-164.2c-7.8-6.1-19.2-0.6-19.2,9.2v328.4c0,9.8,11.4,15.3,19.2,9.2l209-164.2c5.1-4,6-11.4,2-16.5 C462.4,248,461.7,247.3,460.9,246.8L460.9,246.8z M228.2,246.8L19.2,82.5C11.4,76.4,0,82,0,91.8v328.4c0,9.8,11.4,15.3,19.2,9.2 l209-164.2c3-2.3,4.5-5.8,4.5-9.2C232.7,252.6,231.2,249.1,228.2,246.8z M507.3,64h-37.2c-2.5,0-4.7,2-4.7,4.4v375.3 c0,2.4,2.1,4.4,4.7,4.4h37.2c2.5,0,4.7-2,4.7-4.4V68.4C512,66,509.9,64,507.3,64z"
42
+ d: "M460.9,246.8l-209-164.2c-7.8-6.1-19.2-0.6-19.2,9.2v328.4c0,9.8,11.4,15.3,19.2,9.2l209-164.2c5.1-4,6-11.4,2-16.5\r C462.4,248,461.7,247.3,460.9,246.8L460.9,246.8z M228.2,246.8L19.2,82.5C11.4,76.4,0,82,0,91.8v328.4c0,9.8,11.4,15.3,19.2,9.2\r l209-164.2c3-2.3,4.5-5.8,4.5-9.2C232.7,252.6,231.2,249.1,228.2,246.8z M507.3,64h-37.2c-2.5,0-4.7,2-4.7,4.4v375.3\r c0,2.4,2.1,4.4,4.7,4.4h37.2c2.5,0,4.7-2,4.7-4.4V68.4C512,66,509.9,64,507.3,64z"
39
43
  }));
40
44
  };
41
45