@atlaskit/media-test-helpers 30.1.1 → 30.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/cjs/I18nWrapper.js +8 -24
- package/dist/cjs/MockGlobalImage.js +0 -16
- package/dist/cjs/authProvider.js +0 -18
- package/dist/cjs/await-error.js +0 -10
- package/dist/cjs/clipboardEventMocks.js +6 -39
- package/dist/cjs/createMouseEvent.js +4 -8
- package/dist/cjs/createTouchEvent.js +0 -2
- package/dist/cjs/docs-content-tabs.js +1 -14
- package/dist/cjs/example-mediaFeatureFlags.js +0 -7
- package/dist/cjs/exampleMediaItems.js +6 -7
- package/dist/cjs/fakeI18n.js +2 -4
- package/dist/cjs/fakeMediaClient.js +5 -18
- package/dist/cjs/featureFlagsWrapper/dropdown.js +12 -46
- package/dist/cjs/featureFlagsWrapper/helpers.js +0 -14
- package/dist/cjs/featureFlagsWrapper/index.js +5 -19
- package/dist/cjs/fileReader.js +0 -28
- package/dist/cjs/fileStateFactory/createFileState.js +9 -27
- package/dist/cjs/fileStateFactory/factory.js +7 -44
- package/dist/cjs/fileStateFactory/helpers.js +10 -23
- package/dist/cjs/fileStateFactory/index.js +0 -3
- package/dist/cjs/flushPromises.js +0 -2
- package/dist/cjs/getAuthFromContextProvider.js +0 -9
- package/dist/cjs/getJest.js +3 -5
- package/dist/cjs/globalEventEmitterListeners.js +0 -8
- package/dist/cjs/images.js +0 -6
- package/dist/cjs/index.js +0 -42
- package/dist/cjs/jestHelpers.js +0 -20
- package/dist/cjs/keyboardEventWithKeyCode.js +0 -18
- package/dist/cjs/mediaClientErrors.js +0 -11
- package/dist/cjs/mediaClientProvider.js +1 -17
- package/dist/cjs/mediaPickerAuthProvider.js +5 -21
- package/dist/cjs/mockCanvas.js +0 -4
- package/dist/cjs/mockData/handlers/copyWithToken.js +0 -14
- package/dist/cjs/mockData/handlers/getFile.js +0 -8
- package/dist/cjs/mockData/handlers/getFileImage.js +0 -9
- package/dist/cjs/mockData/handlers/index.js +0 -5
- package/dist/cjs/mockData/handlers/tenantAuth.js +0 -6
- package/dist/cjs/mockData/handlers/userCollectionFetch.js +0 -11
- package/dist/cjs/mockData/index.js +0 -9
- package/dist/cjs/mockData/matchers.js +0 -11
- package/dist/cjs/mockData/utils.js +10 -10
- package/dist/cjs/mockLoadImage.js +2 -14
- package/dist/cjs/mocks/database/chunk.js +0 -3
- package/dist/cjs/mocks/database/collection-item.js +14 -23
- package/dist/cjs/mocks/database/collection.js +0 -2
- package/dist/cjs/mocks/database/index.js +5 -23
- package/dist/cjs/mocks/database/upload.js +0 -6
- package/dist/cjs/mocks/fileAndDirectoriesUtils.js +12 -20
- package/dist/cjs/mocks/media-mock.js +14 -45
- package/dist/cjs/mocks/routers/api-router.js +78 -162
- package/dist/cjs/mocks/routers/index.js +0 -2
- package/dist/cjs/mocks/routers/media-playground-router.js +0 -3
- package/dist/cjs/mocks/websockets/index.js +0 -1
- package/dist/cjs/mocks/websockets/messages.js +0 -9
- package/dist/cjs/mocks/websockets/remote-upload-server.js +19 -45
- package/dist/cjs/mountWithIntlContext.js +9 -27
- package/dist/cjs/nextTick.js +0 -4
- package/dist/cjs/renderWithIntl.js +0 -6
- package/dist/cjs/story-list.js +4 -22
- package/dist/cjs/story-styles.js +0 -6
- package/dist/cjs/styled.js +0 -6
- package/dist/cjs/timeoutPromise.js +0 -1
- package/dist/cjs/ufoLogger.js +0 -7
- package/dist/cjs/utils/index.js +2 -11
- package/dist/cjs/utils/logging.js +11 -12
- package/dist/cjs/utils/mockData.js +5 -19
- package/dist/cjs/version.json +1 -1
- package/dist/cjs/waitUntil.js +2 -10
- package/dist/es2019/I18nWrapper.js +2 -4
- package/dist/es2019/MockGlobalImage.js +0 -3
- package/dist/es2019/authProvider.js +2 -5
- package/dist/es2019/clipboardEventMocks.js +12 -26
- package/dist/es2019/createMouseEvent.js +0 -2
- package/dist/es2019/docs-content-tabs.js +1 -3
- package/dist/es2019/example-mediaFeatureFlags.js +3 -2
- package/dist/es2019/exampleMediaItems.js +8 -3
- package/dist/es2019/fakeI18n.js +2 -1
- package/dist/es2019/fakeMediaClient.js +0 -1
- package/dist/es2019/featureFlagsWrapper/dropdown.js +0 -10
- package/dist/es2019/featureFlagsWrapper/helpers.js +2 -1
- package/dist/es2019/featureFlagsWrapper/index.js +2 -7
- package/dist/es2019/fileReader.js +0 -17
- package/dist/es2019/fileStateFactory/createFileState.js +6 -14
- package/dist/es2019/fileStateFactory/factory.js +4 -15
- package/dist/es2019/fileStateFactory/helpers.js +2 -7
- package/dist/es2019/getJest.js +3 -6
- package/dist/es2019/globalEventEmitterListeners.js +0 -3
- package/dist/es2019/images.js +2 -1
- package/dist/es2019/keyboardEventWithKeyCode.js +0 -5
- package/dist/es2019/mediaClientErrors.js +2 -1
- package/dist/es2019/mediaClientProvider.js +1 -1
- package/dist/es2019/mediaPickerAuthProvider.js +2 -5
- package/dist/es2019/mockData/handlers/copyWithToken.js +0 -2
- package/dist/es2019/mockData/handlers/getFile.js +0 -3
- package/dist/es2019/mockData/handlers/getFileImage.js +0 -3
- package/dist/es2019/mockData/handlers/tenantAuth.js +0 -2
- package/dist/es2019/mockData/handlers/userCollectionFetch.js +0 -2
- package/dist/es2019/mockData/index.js +0 -2
- package/dist/es2019/mockData/utils.js +10 -6
- package/dist/es2019/mockLoadImage.js +4 -2
- package/dist/es2019/mocks/database/index.js +0 -2
- package/dist/es2019/mocks/fileAndDirectoriesUtils.js +20 -14
- package/dist/es2019/mocks/media-mock.js +4 -16
- package/dist/es2019/mocks/routers/api-router.js +13 -45
- package/dist/es2019/mocks/websockets/remote-upload-server.js +11 -14
- package/dist/es2019/mountWithIntlContext.js +4 -4
- package/dist/es2019/story-list.js +0 -1
- package/dist/es2019/ufoLogger.js +0 -1
- package/dist/es2019/utils/index.js +0 -2
- package/dist/es2019/utils/logging.js +4 -4
- package/dist/es2019/utils/mockData.js +5 -3
- package/dist/es2019/version.json +1 -1
- package/dist/es2019/waitUntil.js +0 -1
- package/dist/esm/I18nWrapper.js +8 -12
- package/dist/esm/MockGlobalImage.js +0 -10
- package/dist/esm/authProvider.js +0 -10
- package/dist/esm/await-error.js +0 -6
- package/dist/esm/clipboardEventMocks.js +15 -39
- package/dist/esm/createMouseEvent.js +4 -6
- package/dist/esm/docs-content-tabs.js +2 -5
- package/dist/esm/example-mediaFeatureFlags.js +0 -3
- package/dist/esm/exampleMediaItems.js +8 -3
- package/dist/esm/fakeI18n.js +2 -1
- package/dist/esm/fakeMediaClient.js +5 -8
- package/dist/esm/featureFlagsWrapper/dropdown.js +12 -30
- package/dist/esm/featureFlagsWrapper/helpers.js +0 -3
- package/dist/esm/featureFlagsWrapper/index.js +5 -12
- package/dist/esm/fileReader.js +0 -28
- package/dist/esm/fileStateFactory/createFileState.js +9 -22
- package/dist/esm/fileStateFactory/factory.js +7 -41
- package/dist/esm/fileStateFactory/helpers.js +10 -18
- package/dist/esm/getAuthFromContextProvider.js +0 -3
- package/dist/esm/getJest.js +3 -3
- package/dist/esm/globalEventEmitterListeners.js +0 -3
- package/dist/esm/images.js +2 -1
- package/dist/esm/jestHelpers.js +0 -2
- package/dist/esm/keyboardEventWithKeyCode.js +0 -10
- package/dist/esm/mediaClientErrors.js +0 -3
- package/dist/esm/mediaClientProvider.js +1 -1
- package/dist/esm/mediaPickerAuthProvider.js +5 -12
- package/dist/esm/mockData/handlers/copyWithToken.js +0 -4
- package/dist/esm/mockData/handlers/getFile.js +0 -3
- package/dist/esm/mockData/handlers/getFileImage.js +0 -3
- package/dist/esm/mockData/handlers/tenantAuth.js +0 -2
- package/dist/esm/mockData/handlers/userCollectionFetch.js +0 -5
- package/dist/esm/mockData/index.js +0 -2
- package/dist/esm/mockData/utils.js +10 -6
- package/dist/esm/mockLoadImage.js +2 -4
- package/dist/esm/mocks/database/collection-item.js +14 -15
- package/dist/esm/mocks/database/index.js +5 -7
- package/dist/esm/mocks/fileAndDirectoriesUtils.js +12 -13
- package/dist/esm/mocks/media-mock.js +14 -26
- package/dist/esm/mocks/routers/api-router.js +78 -144
- package/dist/esm/mocks/websockets/remote-upload-server.js +19 -24
- package/dist/esm/mountWithIntlContext.js +9 -17
- package/dist/esm/story-list.js +4 -12
- package/dist/esm/story-styles.js +0 -2
- package/dist/esm/styled.js +0 -2
- package/dist/esm/ufoLogger.js +0 -4
- package/dist/esm/utils/index.js +2 -5
- package/dist/esm/utils/logging.js +11 -11
- package/dist/esm/utils/mockData.js +5 -3
- package/dist/esm/version.json +1 -1
- package/dist/esm/waitUntil.js +2 -6
- package/package.json +4 -4
|
@@ -2,7 +2,7 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck";
|
|
|
2
2
|
import _createClass from "@babel/runtime/helpers/createClass";
|
|
3
3
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
4
4
|
var _excluded = ["type"],
|
|
5
|
-
|
|
5
|
+
_excluded2 = ["type"];
|
|
6
6
|
import { Server } from 'mock-socket';
|
|
7
7
|
import { Observable } from 'rxjs/Observable';
|
|
8
8
|
import { from } from 'rxjs/observable/from';
|
|
@@ -25,7 +25,6 @@ import { getFakeFileSize } from '../../utils/mockData';
|
|
|
25
25
|
var DELAY_MESSAGS_MS = 200;
|
|
26
26
|
var DELAY_MESSAGES_SLOW_MS = 1000;
|
|
27
27
|
var DELAY_MESSAGES_VARIATION = 500;
|
|
28
|
-
|
|
29
28
|
/**
|
|
30
29
|
* Returns an Observable emitting messages coming from a mocked websocket server.
|
|
31
30
|
* Only listens to the latest connection and maps all non-empty messages to JSON.
|
|
@@ -43,10 +42,12 @@ function getUpstreamMessages(wsServer) {
|
|
|
43
42
|
return socket.on('message', function (data) {
|
|
44
43
|
return observer.next(data);
|
|
45
44
|
});
|
|
46
|
-
}).pipe(
|
|
45
|
+
}).pipe(
|
|
46
|
+
// ignore empty messages
|
|
47
47
|
filter(function (data) {
|
|
48
48
|
return typeof data === 'string' && data.length > 0;
|
|
49
|
-
}),
|
|
49
|
+
}),
|
|
50
|
+
// parse messages as JSON
|
|
50
51
|
map(function (data) {
|
|
51
52
|
return {
|
|
52
53
|
socket: socket,
|
|
@@ -55,9 +56,9 @@ function getUpstreamMessages(wsServer) {
|
|
|
55
56
|
}));
|
|
56
57
|
}));
|
|
57
58
|
}
|
|
58
|
-
|
|
59
59
|
function createUserFile(database, fileId, name, collection) {
|
|
60
|
-
database.push('collectionItem',
|
|
60
|
+
database.push('collectionItem',
|
|
61
|
+
// backend initially creates cloud files
|
|
61
62
|
// having mediaType=unknown and mimeType=binary/octet-stream
|
|
62
63
|
createCollectionItem({
|
|
63
64
|
name: name,
|
|
@@ -69,12 +70,11 @@ function createUserFile(database, fileId, name, collection) {
|
|
|
69
70
|
processingStatus: 'pending'
|
|
70
71
|
}));
|
|
71
72
|
}
|
|
72
|
-
|
|
73
73
|
function sendDownstreamMessage(wsUrl, socket, database, message) {
|
|
74
74
|
var type = message.type,
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
payload = _objectWithoutProperties(message, _excluded);
|
|
77
76
|
|
|
77
|
+
// logs every message in console
|
|
78
78
|
logWsMessage({
|
|
79
79
|
url: wsUrl,
|
|
80
80
|
dir: WsDirection.Downstream,
|
|
@@ -84,6 +84,7 @@ function sendDownstreamMessage(wsUrl, socket, database, message) {
|
|
|
84
84
|
});
|
|
85
85
|
socket.send(JSON.stringify(message));
|
|
86
86
|
}
|
|
87
|
+
|
|
87
88
|
/**
|
|
88
89
|
* Given an Observable of websocket upstream messages, generates the corresponding downstream messages as follow:
|
|
89
90
|
* 1. NotifyMetadata
|
|
@@ -97,8 +98,6 @@ function sendDownstreamMessage(wsUrl, socket, database, message) {
|
|
|
97
98
|
* @param database Kakapo database
|
|
98
99
|
* @param isSlowServer boolean to set to true to simulate a slower websocket server
|
|
99
100
|
*/
|
|
100
|
-
|
|
101
|
-
|
|
102
101
|
function generateDownstreamMessages(wsUrl, database, isSlowServer) {
|
|
103
102
|
var delayMessages = isSlowServer ? DELAY_MESSAGES_SLOW_MS : DELAY_MESSAGS_MS;
|
|
104
103
|
return function (messages) {
|
|
@@ -107,14 +106,15 @@ function generateDownstreamMessages(wsUrl, database, isSlowServer) {
|
|
|
107
106
|
return type === 'fetchFile';
|
|
108
107
|
}), mergeMap(function (_ref2) {
|
|
109
108
|
var socket = _ref2.socket,
|
|
110
|
-
|
|
109
|
+
message = _ref2.message;
|
|
111
110
|
var _message$params = message.params,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
fileName = _message$params.fileName,
|
|
112
|
+
collection = _message$params.collection,
|
|
113
|
+
tenantFileId = _message$params.jobId;
|
|
115
114
|
var userFileId = uuid();
|
|
116
|
-
var fileSize = getFakeFileSize();
|
|
115
|
+
var fileSize = getFakeFileSize();
|
|
117
116
|
|
|
117
|
+
// create user file in database
|
|
118
118
|
createUserFile(database, userFileId, fileName, collection);
|
|
119
119
|
return from([notifyMetadataPayload(tenantFileId, fileSize), remoteUploadStartPayload(tenantFileId), remoteUploadProgressPayload(tenantFileId, fileSize), remoteUploadEndPayload(tenantFileId, userFileId)]).pipe(concatMap(function (message) {
|
|
120
120
|
return of(message).pipe(tap(function (message) {
|
|
@@ -124,20 +124,17 @@ function generateDownstreamMessages(wsUrl, database, isSlowServer) {
|
|
|
124
124
|
}));
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
|
|
128
127
|
export var RemoteUploadActivityServer = /*#__PURE__*/function () {
|
|
129
128
|
function RemoteUploadActivityServer(params) {
|
|
130
129
|
_classCallCheck(this, RemoteUploadActivityServer);
|
|
131
|
-
|
|
132
130
|
var database = params.database,
|
|
133
|
-
|
|
131
|
+
isSlowServer = params.isSlowServer;
|
|
134
132
|
var wsUrl = getWsUrl(defaultBaseUrl, '/picker/ws/');
|
|
135
133
|
this.wsServer = new Server(wsUrl);
|
|
136
134
|
this.msgSubscription = getUpstreamMessages(this.wsServer).pipe(tap(function (_ref3) {
|
|
137
135
|
var _ref3$message = _ref3.message,
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
136
|
+
type = _ref3$message.type,
|
|
137
|
+
payload = _objectWithoutProperties(_ref3$message, _excluded2);
|
|
141
138
|
return logWsMessage({
|
|
142
139
|
url: wsUrl,
|
|
143
140
|
dir: WsDirection.Upstream,
|
|
@@ -147,7 +144,6 @@ export var RemoteUploadActivityServer = /*#__PURE__*/function () {
|
|
|
147
144
|
});
|
|
148
145
|
}), generateDownstreamMessages(wsUrl, database, isSlowServer)).subscribe();
|
|
149
146
|
}
|
|
150
|
-
|
|
151
147
|
_createClass(RemoteUploadActivityServer, [{
|
|
152
148
|
key: "start",
|
|
153
149
|
value: function start() {
|
|
@@ -160,6 +156,5 @@ export var RemoteUploadActivityServer = /*#__PURE__*/function () {
|
|
|
160
156
|
this.wsServer.stop();
|
|
161
157
|
}
|
|
162
158
|
}]);
|
|
163
|
-
|
|
164
159
|
return RemoteUploadActivityServer;
|
|
165
160
|
}();
|
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["context", "childContextTypes"],
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
_excluded2 = ["context"];
|
|
6
5
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
7
|
-
|
|
8
6
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
9
|
-
|
|
10
7
|
import React from 'react';
|
|
11
8
|
import { RawIntlProvider, createIntl, IntlProvider } from 'react-intl-next';
|
|
12
9
|
import { mount, shallow } from 'enzyme';
|
|
13
10
|
var mockIntl = createIntl({
|
|
14
11
|
locale: 'en'
|
|
15
12
|
});
|
|
13
|
+
|
|
16
14
|
/**
|
|
17
15
|
* When using React-Intl `injectIntl` on components, props.intl is required.
|
|
18
16
|
*/
|
|
19
|
-
|
|
20
17
|
function nodeWithIntlProp(node) {
|
|
21
18
|
var intl = !!node.props.intl ? node.props.intl : mockIntl;
|
|
22
19
|
return /*#__PURE__*/React.createElement(RawIntlProvider, {
|
|
@@ -25,22 +22,19 @@ function nodeWithIntlProp(node) {
|
|
|
25
22
|
intl: intl
|
|
26
23
|
}));
|
|
27
24
|
}
|
|
25
|
+
|
|
28
26
|
/* TODO: We are explicitly using the third arg of ReactWrapper to work around the following TS issue which prevents a d.ts from being generated
|
|
29
27
|
* and therefore fails the build:
|
|
30
28
|
* error TS2742: The inferred type of 'mountWithIntlContext' cannot be named without a reference to 'react-transition-group/node_modules/@types/react'. This is likely not portable. A type annotation is necessary.
|
|
31
29
|
* TS is resolving enzyme's usage of react to react-transition-group???
|
|
32
30
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
31
|
export var mountWithIntlContext = function mountWithIntlContext(node) {
|
|
36
32
|
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
37
|
-
|
|
38
33
|
var _ref$context = _ref.context,
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
34
|
+
context = _ref$context === void 0 ? {} : _ref$context,
|
|
35
|
+
_ref$childContextType = _ref.childContextTypes,
|
|
36
|
+
childContextTypes = _ref$childContextType === void 0 ? {} : _ref$childContextType,
|
|
37
|
+
additionalOptions = _objectWithoutProperties(_ref, _excluded);
|
|
44
38
|
var intl = !!node.props.intl ? node.props.intl : mockIntl;
|
|
45
39
|
return mount(nodeWithIntlProp(node), _objectSpread({
|
|
46
40
|
context: _objectSpread({
|
|
@@ -50,11 +44,9 @@ export var mountWithIntlContext = function mountWithIntlContext(node) {
|
|
|
50
44
|
};
|
|
51
45
|
export var shallowWithIntlContext = function shallowWithIntlContext(node) {
|
|
52
46
|
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
53
|
-
|
|
54
47
|
var _ref2$context = _ref2.context,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
context = _ref2$context === void 0 ? {} : _ref2$context,
|
|
49
|
+
additionalOptions = _objectWithoutProperties(_ref2, _excluded2);
|
|
58
50
|
var intl = !!node.props.intl ? node.props.intl : mockIntl;
|
|
59
51
|
return shallow(nodeWithIntlProp(node), _objectSpread({
|
|
60
52
|
context: _objectSpread({
|
package/dist/esm/story-list.js
CHANGED
|
@@ -3,11 +3,8 @@ import _createClass from "@babel/runtime/helpers/createClass";
|
|
|
3
3
|
import _inherits from "@babel/runtime/helpers/inherits";
|
|
4
4
|
import _possibleConstructorReturn from "@babel/runtime/helpers/possibleConstructorReturn";
|
|
5
5
|
import _getPrototypeOf from "@babel/runtime/helpers/getPrototypeOf";
|
|
6
|
-
|
|
7
6
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
8
|
-
|
|
9
7
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
10
|
-
|
|
11
8
|
// Simple component which wraps stories and creates a styled list out of it
|
|
12
9
|
import React from 'react';
|
|
13
10
|
import { Component } from 'react';
|
|
@@ -61,23 +58,19 @@ var styles = {
|
|
|
61
58
|
};
|
|
62
59
|
export var StoryList = /*#__PURE__*/function (_Component) {
|
|
63
60
|
_inherits(StoryList, _Component);
|
|
64
|
-
|
|
65
61
|
var _super = _createSuper(StoryList);
|
|
66
|
-
|
|
67
62
|
function StoryList() {
|
|
68
63
|
_classCallCheck(this, StoryList);
|
|
69
|
-
|
|
70
64
|
return _super.apply(this, arguments);
|
|
71
65
|
}
|
|
72
|
-
|
|
73
66
|
_createClass(StoryList, [{
|
|
74
67
|
key: "render",
|
|
75
68
|
value: function render() {
|
|
76
69
|
var _this$props = this.props,
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
70
|
+
_this$props$display = _this$props.display,
|
|
71
|
+
display = _this$props$display === void 0 ? 'row' : _this$props$display,
|
|
72
|
+
_this$props$children = _this$props.children,
|
|
73
|
+
children = _this$props$children === void 0 ? [] : _this$props$children;
|
|
81
74
|
var listStyles = display === 'column' ? styles.column : styles.row;
|
|
82
75
|
var listContent = children.map(function (child, index) {
|
|
83
76
|
return /*#__PURE__*/React.createElement("li", {
|
|
@@ -92,6 +85,5 @@ export var StoryList = /*#__PURE__*/function (_Component) {
|
|
|
92
85
|
}, listContent);
|
|
93
86
|
}
|
|
94
87
|
}]);
|
|
95
|
-
|
|
96
88
|
return StoryList;
|
|
97
89
|
}(Component);
|
package/dist/esm/story-styles.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
|
|
3
2
|
var _templateObject;
|
|
4
|
-
|
|
5
3
|
import styled from '@emotion/styled';
|
|
6
4
|
export var Matrix = styled.table(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n thead {\n td {\n text-align: center;\n font-weight: bold;\n font-size: 20px;\n }\n }\n\n tbody {\n td {\n padding: 25px 10px;\n }\n }\n\n td {\n margin: auto;\n text-align: center;\n vertical-align: middle;\n\n &:first-child {\n font-weight: bold;\n font-size: 20px;\n }\n\n > div {\n display: flex;\n justify-content: center;\n text-align: left;\n }\n }\n"])));
|
package/dist/esm/styled.js
CHANGED
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/taggedTemplateLiteral";
|
|
2
|
-
|
|
3
2
|
var _templateObject;
|
|
4
|
-
|
|
5
3
|
import styled from '@emotion/styled';
|
|
6
4
|
export var LocaleSelectorWrapper = styled.div(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: fixed;\n right: 20px;\n top: 20px;\n width: 200px;\n border: 1px solid ", ";\n padding: 10px;\n border-radius: 3px;\n background-color: ", ";\n\n h2 {\n margin-bottom: 10px;\n }\n"])), "var(--ds-border, #ccc)", "var(--ds-surface, white)");
|
package/dist/esm/ufoLogger.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
2
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4
|
-
|
|
5
3
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6
|
-
|
|
7
4
|
export var enableMediaUfoLogger = function enableMediaUfoLogger(ufoPayloadPublisher) {
|
|
8
5
|
var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9
6
|
// Added try catch as Performance is not mocked properly in the Ufo packages.
|
|
10
7
|
// By adding try catch test are successfully passing. Created ticket for the same - MEET-2652
|
|
11
8
|
var MEDIA_UFO_OPERATIONAL_EVENT = 'Media::UFO::sendOperationalEvent:';
|
|
12
|
-
|
|
13
9
|
try {
|
|
14
10
|
ufoPayloadPublisher.setup(_objectSpread({
|
|
15
11
|
product: 'examples',
|
package/dist/esm/utils/index.js
CHANGED
|
@@ -5,20 +5,17 @@ export function mapDataUriToBlob(dataUri) {
|
|
|
5
5
|
var bstr = atob(arr[1]);
|
|
6
6
|
var n = bstr.length;
|
|
7
7
|
var u8arr = new Uint8Array(n);
|
|
8
|
-
|
|
9
8
|
while (n--) {
|
|
10
9
|
u8arr[n] = bstr.charCodeAt(n);
|
|
11
10
|
}
|
|
12
|
-
|
|
13
11
|
return new Blob([u8arr], {
|
|
14
12
|
type: mime
|
|
15
13
|
});
|
|
16
14
|
}
|
|
17
15
|
export function getWsUrl(baseUrl, path) {
|
|
18
16
|
var _url$parse = url.parse(baseUrl),
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
protocol = _url$parse.protocol,
|
|
18
|
+
host = _url$parse.host;
|
|
22
19
|
var wsProtocol = protocol === 'http:' ? 'ws:' : 'wss:';
|
|
23
20
|
return "".concat(wsProtocol, "//").concat(host).concat(path);
|
|
24
21
|
}
|
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
export var WsDirection;
|
|
2
|
-
|
|
3
2
|
(function (WsDirection) {
|
|
4
3
|
WsDirection["Upstream"] = "UP";
|
|
5
4
|
WsDirection["Downstream"] = "DOWN";
|
|
6
5
|
})(WsDirection || (WsDirection = {}));
|
|
7
|
-
|
|
8
6
|
export function logRequest(params) {
|
|
9
7
|
var path = params.path,
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
method = params.method,
|
|
9
|
+
request = params.request,
|
|
10
|
+
response = params.response,
|
|
11
|
+
error = params.error,
|
|
12
|
+
database = params.database;
|
|
15
13
|
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
16
15
|
console.log('MOCK', path, {
|
|
17
16
|
method: method,
|
|
18
17
|
request: request,
|
|
@@ -23,11 +22,12 @@ export function logRequest(params) {
|
|
|
23
22
|
}
|
|
24
23
|
export function logWsMessage(params) {
|
|
25
24
|
var url = params.url,
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
25
|
+
dir = params.dir,
|
|
26
|
+
type = params.type,
|
|
27
|
+
payload = params.payload,
|
|
28
|
+
database = params.database;
|
|
30
29
|
|
|
30
|
+
// eslint-disable-next-line no-console
|
|
31
31
|
console.log("MOCK WS:".concat(dir), url, {
|
|
32
32
|
type: type,
|
|
33
33
|
payload: payload,
|
|
@@ -15,9 +15,10 @@ export var getFakeFileName = function getFakeFileName() {
|
|
|
15
15
|
export var getFakeFileSize = function getFakeFileSize() {
|
|
16
16
|
var maxSize = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 1e7;
|
|
17
17
|
return Math.round(Math.random() * maxSize);
|
|
18
|
-
};
|
|
19
|
-
// using the output exact call Faker.image.dataUri(320, 240)
|
|
18
|
+
};
|
|
20
19
|
|
|
20
|
+
// This fake image was generated using faker. It never changes so we are just
|
|
21
|
+
// using the output exact call Faker.image.dataUri(320, 240)
|
|
21
22
|
export var fakeImage = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZlcnNpb249IjEuMSIgYmFzZVByb2ZpbGU9ImZ1bGwiIHdpZHRoPSIzMjAiIGhlaWdodD0iMjQwIj4gPHJlY3Qgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgZmlsbD0iZ3JleSIvPiAgPHRleHQgeD0iMCIgeT0iMjAiIGZvbnQtc2l6ZT0iMjAiIHRleHQtYW5jaG9yPSJzdGFydCIgZmlsbD0id2hpdGUiPjMyMHgyNDA8L3RleHQ+IDwvc3ZnPg==';
|
|
22
23
|
export var getDateWithOffset = function getDateWithOffset(offset) {
|
|
23
24
|
var time = new Date();
|
|
@@ -31,8 +32,9 @@ export var getPastDate = function getPastDate() {
|
|
|
31
32
|
export var getFutureDate = function getFutureDate() {
|
|
32
33
|
var offset = 100000 + Math.round(Math.random() * 10000);
|
|
33
34
|
return getDateWithOffset(offset);
|
|
34
|
-
};
|
|
35
|
+
};
|
|
35
36
|
|
|
37
|
+
// This function is taken directly from Faker
|
|
36
38
|
export var mockDataUri = function mockDataUri(width, height) {
|
|
37
39
|
var rawPrefix = 'data:image/svg+xml;base64,';
|
|
38
40
|
var svgString = "<svg xmlns=\"http://www.w3.org/2000/svg\" version=\"1.1\" baseProfile=\"full\" width=\"".concat(width, "\" height=\"").concat(height, "\"> <rect width=\"100%\" height=\"100%\" fill=\"grey\"/> <text x=\"0\" y=\"20\" font-size=\"20\" text-anchor=\"start\" fill=\"white\">").concat(width, "x").concat(height, "</text> </svg>");
|
package/dist/esm/version.json
CHANGED
package/dist/esm/waitUntil.js
CHANGED
|
@@ -3,12 +3,11 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
|
3
3
|
export function waitUntil(_x) {
|
|
4
4
|
return _waitUntil.apply(this, arguments);
|
|
5
5
|
}
|
|
6
|
-
|
|
7
6
|
function _waitUntil() {
|
|
8
7
|
_waitUntil = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(predicate) {
|
|
9
8
|
var timeout,
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
maxRetries,
|
|
10
|
+
_args = arguments;
|
|
12
11
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
13
12
|
while (1) {
|
|
14
13
|
switch (_context.prev = _context.next) {
|
|
@@ -27,10 +26,8 @@ function _waitUntil() {
|
|
|
27
26
|
reject('timed out');
|
|
28
27
|
}
|
|
29
28
|
};
|
|
30
|
-
|
|
31
29
|
check(maxRetries);
|
|
32
30
|
}));
|
|
33
|
-
|
|
34
31
|
case 3:
|
|
35
32
|
case "end":
|
|
36
33
|
return _context.stop();
|
|
@@ -40,5 +37,4 @@ function _waitUntil() {
|
|
|
40
37
|
}));
|
|
41
38
|
return _waitUntil.apply(this, arguments);
|
|
42
39
|
}
|
|
43
|
-
|
|
44
40
|
export default waitUntil;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-test-helpers",
|
|
3
|
-
"version": "30.1.
|
|
3
|
+
"version": "30.1.2",
|
|
4
4
|
"description": "Collection of test helpers used in media component stories and specs",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -24,13 +24,13 @@
|
|
|
24
24
|
"@atlaskit/icon": "^21.11.0",
|
|
25
25
|
"@atlaskit/locale": "^2.1.0",
|
|
26
26
|
"@atlaskit/media-client": "^20.0.0",
|
|
27
|
-
"@atlaskit/media-common": "^2.
|
|
27
|
+
"@atlaskit/media-common": "^2.19.0",
|
|
28
28
|
"@atlaskit/media-core": "^34.0.0",
|
|
29
|
-
"@atlaskit/media-ui": "^22.
|
|
29
|
+
"@atlaskit/media-ui": "^22.3.0",
|
|
30
30
|
"@atlaskit/popup": "^1.5.0",
|
|
31
31
|
"@atlaskit/tabs": "^13.3.0",
|
|
32
32
|
"@atlaskit/textfield": "^5.3.0",
|
|
33
|
-
"@atlaskit/tokens": "^0.
|
|
33
|
+
"@atlaskit/tokens": "^1.0.0",
|
|
34
34
|
"@atlaskit/tooltip": "^17.6.0",
|
|
35
35
|
"@atlaskit/ufo": "^0.1.0",
|
|
36
36
|
"@babel/runtime": "^7.0.0",
|