creevey 0.8.1-sb7.2 → 0.8.1-sb7.3
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.
@@ -10,8 +10,6 @@ var Events = _interopRequireWildcard(require("@storybook/core-events"));
|
|
10
10
|
|
11
11
|
var polyfill = _interopRequireWildcard(require("event-source-polyfill"));
|
12
12
|
|
13
|
-
var _testingLibrary = require("@storybook/testing-library");
|
14
|
-
|
15
13
|
var _addons = require("@storybook/addons");
|
16
14
|
|
17
15
|
var _types = require("../../types");
|
@@ -20,8 +18,6 @@ var _shared = require("../../shared");
|
|
20
18
|
|
21
19
|
var _helpers = require("../shared/helpers");
|
22
20
|
|
23
|
-
var _utils = require("./utils");
|
24
|
-
|
25
21
|
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); }
|
26
22
|
|
27
23
|
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; }
|
@@ -30,6 +26,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
30
26
|
// @ts-nocheck
|
31
27
|
|
32
28
|
/* eslint-disable */
|
29
|
+
// import { buildQueries, within } from '@storybook/testing-library';
|
33
30
|
if (typeof process != 'object' || typeof process.version != 'string') {
|
34
31
|
// NOTE If you don't use babel-polyfill or any other polyfills that add EventSource for IE11
|
35
32
|
// You don't get hot reload in IE11. So put polyfill for that to better UX
|
@@ -289,48 +286,48 @@ function withCreevey() {
|
|
289
286
|
|
290
287
|
const getMultipleError = (_, query) => "Found multiple elements by query: ".concat(query);
|
291
288
|
|
292
|
-
const getMissingError = (_, query) => "Unable to find an element by query: ".concat(query);
|
289
|
+
const getMissingError = (_, query) => "Unable to find an element by query: ".concat(query); // const [queryByQuery, getAllByQuery, getByQuery, findAllByQuery, findByQuery] = buildQueries(
|
290
|
+
// queryAllByQuery,
|
291
|
+
// getMultipleError,
|
292
|
+
// getMissingError,
|
293
|
+
// );
|
294
|
+
// const queries = {
|
295
|
+
// queryByQuery,
|
296
|
+
// getAllByQuery,
|
297
|
+
// getByQuery,
|
298
|
+
// findAllByQuery,
|
299
|
+
// findByQuery,
|
300
|
+
// };
|
301
|
+
|
293
302
|
|
294
|
-
const [queryByQuery, getAllByQuery, getByQuery, findAllByQuery, findByQuery] = (0, _testingLibrary.buildQueries)(queryAllByQuery, getMultipleError, getMissingError);
|
295
|
-
const queries = {
|
296
|
-
queryByQuery,
|
297
|
-
getAllByQuery,
|
298
|
-
getByQuery,
|
299
|
-
findAllByQuery,
|
300
|
-
findByQuery
|
301
|
-
};
|
302
303
|
return (0, _addons.makeDecorator)({
|
303
304
|
name: 'withCreevey',
|
304
305
|
parameterName: 'creevey',
|
305
306
|
wrapper: (getStory, context) => {
|
306
|
-
var _ref2;
|
307
|
-
|
308
307
|
// TODO Define proper types, like captureElement is a promise
|
309
|
-
const {
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
configurable: true
|
333
|
-
});
|
308
|
+
// const { captureElement } = (context.parameters.creevey =
|
309
|
+
// (context.parameters.creevey as CreeveyStoryParams) ?? {});
|
310
|
+
// Object.defineProperty(context.parameters.creevey, 'captureElement', {
|
311
|
+
// get() {
|
312
|
+
// switch (true) {
|
313
|
+
// case captureElement === undefined:
|
314
|
+
// return Promise.resolve(context.canvasElement);
|
315
|
+
// case captureElement === null:
|
316
|
+
// return Promise.resolve(document.documentElement);
|
317
|
+
// case typeof captureElement == 'string':
|
318
|
+
// return isInternetExplorer // some code from testing-library makes IE hang
|
319
|
+
// ? Promise.resolve(context.canvasElement.querySelector(captureElement as string))
|
320
|
+
// : within<typeof queries>(context.canvasElement, queries).findByQuery(captureElement as string);
|
321
|
+
// case typeof captureElement == 'function':
|
322
|
+
// // TODO Define type for it
|
323
|
+
// return Promise.resolve(
|
324
|
+
// (captureElement as unknown as (ctx: typeof context) => Promise<HTMLElement> | HTMLElement)(context),
|
325
|
+
// );
|
326
|
+
// }
|
327
|
+
// },
|
328
|
+
// enumerable: true,
|
329
|
+
// configurable: true,
|
330
|
+
// });
|
334
331
|
return getStory(context);
|
335
332
|
}
|
336
333
|
});
|
@@ -4,12 +4,11 @@
|
|
4
4
|
/* eslint-disable */
|
5
5
|
import * as Events from '@storybook/core-events';
|
6
6
|
import * as polyfill from 'event-source-polyfill';
|
7
|
-
import { buildQueries, within } from '@storybook/testing-library';
|
7
|
+
// import { buildQueries, within } from '@storybook/testing-library';
|
8
8
|
import { addons, makeDecorator } from '@storybook/addons';
|
9
9
|
import { isObject, noop } from '../../types';
|
10
10
|
import { denormalizeStoryParameters, serializeRawStories } from '../../shared';
|
11
11
|
import { getConnectionUrl } from '../shared/helpers';
|
12
|
-
import { isInternetExplorer } from './utils';
|
13
12
|
|
14
13
|
if (typeof process != 'object' || typeof process.version != 'string') {
|
15
14
|
// NOTE If you don't use babel-polyfill or any other polyfills that add EventSource for IE11
|
@@ -263,48 +262,48 @@ export function withCreevey() {
|
|
263
262
|
|
264
263
|
const getMultipleError = (_, query) => "Found multiple elements by query: ".concat(query);
|
265
264
|
|
266
|
-
const getMissingError = (_, query) => "Unable to find an element by query: ".concat(query);
|
265
|
+
const getMissingError = (_, query) => "Unable to find an element by query: ".concat(query); // const [queryByQuery, getAllByQuery, getByQuery, findAllByQuery, findByQuery] = buildQueries(
|
266
|
+
// queryAllByQuery,
|
267
|
+
// getMultipleError,
|
268
|
+
// getMissingError,
|
269
|
+
// );
|
270
|
+
// const queries = {
|
271
|
+
// queryByQuery,
|
272
|
+
// getAllByQuery,
|
273
|
+
// getByQuery,
|
274
|
+
// findAllByQuery,
|
275
|
+
// findByQuery,
|
276
|
+
// };
|
277
|
+
|
267
278
|
|
268
|
-
const [queryByQuery, getAllByQuery, getByQuery, findAllByQuery, findByQuery] = buildQueries(queryAllByQuery, getMultipleError, getMissingError);
|
269
|
-
const queries = {
|
270
|
-
queryByQuery,
|
271
|
-
getAllByQuery,
|
272
|
-
getByQuery,
|
273
|
-
findAllByQuery,
|
274
|
-
findByQuery
|
275
|
-
};
|
276
279
|
return makeDecorator({
|
277
280
|
name: 'withCreevey',
|
278
281
|
parameterName: 'creevey',
|
279
282
|
wrapper: (getStory, context) => {
|
280
|
-
var _ref2;
|
281
|
-
|
282
283
|
// TODO Define proper types, like captureElement is a promise
|
283
|
-
const {
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
configurable: true
|
307
|
-
});
|
284
|
+
// const { captureElement } = (context.parameters.creevey =
|
285
|
+
// (context.parameters.creevey as CreeveyStoryParams) ?? {});
|
286
|
+
// Object.defineProperty(context.parameters.creevey, 'captureElement', {
|
287
|
+
// get() {
|
288
|
+
// switch (true) {
|
289
|
+
// case captureElement === undefined:
|
290
|
+
// return Promise.resolve(context.canvasElement);
|
291
|
+
// case captureElement === null:
|
292
|
+
// return Promise.resolve(document.documentElement);
|
293
|
+
// case typeof captureElement == 'string':
|
294
|
+
// return isInternetExplorer // some code from testing-library makes IE hang
|
295
|
+
// ? Promise.resolve(context.canvasElement.querySelector(captureElement as string))
|
296
|
+
// : within<typeof queries>(context.canvasElement, queries).findByQuery(captureElement as string);
|
297
|
+
// case typeof captureElement == 'function':
|
298
|
+
// // TODO Define type for it
|
299
|
+
// return Promise.resolve(
|
300
|
+
// (captureElement as unknown as (ctx: typeof context) => Promise<HTMLElement> | HTMLElement)(context),
|
301
|
+
// );
|
302
|
+
// }
|
303
|
+
// },
|
304
|
+
// enumerable: true,
|
305
|
+
// configurable: true,
|
306
|
+
// });
|
308
307
|
return getStory(context);
|
309
308
|
}
|
310
309
|
});
|