@atlaskit/media-test-helpers 29.2.0 → 29.4.0
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 +104 -0
- package/dist/cjs/fileStateFactory/factory.js +2 -2
- package/dist/cjs/index.js +8 -50
- package/dist/cjs/mocks/media-mock.js +1 -1
- package/dist/cjs/ufoLogger.js +43 -0
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/fileStateFactory/factory.js +3 -3
- package/dist/es2019/index.js +1 -1
- package/dist/es2019/mocks/media-mock.js +1 -1
- package/dist/es2019/ufoLogger.js +26 -0
- package/dist/es2019/version.json +1 -1
- package/dist/esm/fileStateFactory/factory.js +3 -3
- package/dist/esm/index.js +1 -1
- package/dist/esm/mocks/media-mock.js +1 -1
- package/dist/esm/ufoLogger.js +32 -0
- package/dist/esm/version.json +1 -1
- package/dist/types/index.d.ts +1 -2
- package/dist/types/story-styles.d.ts +1 -1
- package/dist/types/styled.d.ts +1 -1
- package/dist/types/ufoLogger.d.ts +5 -0
- package/package.json +9 -11
- package/dist/cjs/mediaPickerMocks.js +0 -142
- package/dist/es2019/mediaPickerMocks.js +0 -101
- package/dist/esm/mediaPickerMocks.js +0 -117
- package/dist/types/mediaPickerMocks.d.ts +0 -45
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,109 @@
|
|
|
1
1
|
# @atlaskit/media-test-helpers
|
|
2
2
|
|
|
3
|
+
## 29.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`eaf810b0560`](https://bitbucket.org/atlassian/atlassian-frontend/commits/eaf810b0560) - [MEX-1398] Remove PopUp implementation from Media-picker
|
|
8
|
+
- [`8f86bfe1961`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8f86bfe1961) - [MEX-1389] Remove types & interfaces related to media-picker popup
|
|
9
|
+
- [`a44c7c42fa7`](https://bitbucket.org/atlassian/atlassian-frontend/commits/a44c7c42fa7) - Added payload publisher wrapper for logging ufo events in examples
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies
|
|
14
|
+
|
|
15
|
+
## 29.3.0
|
|
16
|
+
|
|
17
|
+
### Minor Changes
|
|
18
|
+
|
|
19
|
+
- [`f862d5ae7aa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f862d5ae7aa) - remove RxJs peer dependency
|
|
20
|
+
- [`118f3af101f`](https://bitbucket.org/atlassian/atlassian-frontend/commits/118f3af101f) - Media Client APIs has been updated to use MediaSubscribable which provides subscription functionality (similar to RxJs observables).
|
|
21
|
+
It exposes subscribe method that is called with MediaObserver as an argument and returns MediaSubscription.
|
|
22
|
+
MediaSubscription exposes unsubscribe method.
|
|
23
|
+
|
|
24
|
+
getFileState:
|
|
25
|
+
The returned type of this function has changed from RxJs ReplaySubject to MediaSubscribable.
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
import { MediaClient, MediaObserver, MediaSubscribable, MediaSubscription } from '@atlaskit/media-client';
|
|
29
|
+
|
|
30
|
+
const mediaClient = new MediaClient({ authProvider });
|
|
31
|
+
|
|
32
|
+
const fileStateSubscribable: MediaSubscribable<FileState> = mediaClient.file.getFileState(id);
|
|
33
|
+
|
|
34
|
+
const mediaObserver: MediaObserver<FileState> = {
|
|
35
|
+
next: (fileState) => {
|
|
36
|
+
nextCallback(fileState)
|
|
37
|
+
},
|
|
38
|
+
error: (error) => {
|
|
39
|
+
errorCallback(error)
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const subscription: MediaSubscription = fileStateSubscribable.subscribe(mediaObserver);
|
|
44
|
+
|
|
45
|
+
subscription.unsubscribe();
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
upload:
|
|
49
|
+
The returned type of this function has changed from RxJs ReplaySubject to MediaSubscribable.
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
import { MediaClient, MediaObserver, MediaSubscribable, MediaSubscription } from '@atlaskit/media-client';
|
|
53
|
+
|
|
54
|
+
const mediaClient = new MediaClient({ authProvider });
|
|
55
|
+
|
|
56
|
+
const uploadFileSubscribable: MediaSubscribable<FileState> = mediaClient.file.upload(uploadableFile);
|
|
57
|
+
|
|
58
|
+
const mediaObserver: MediaObserver<FileState> = {
|
|
59
|
+
next: (fileState) => {
|
|
60
|
+
nextCallback(fileState)
|
|
61
|
+
},
|
|
62
|
+
error: (error) => {
|
|
63
|
+
errorCallback(error)
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const subscription: MediaSubscription = uploadFileSubscribable.subscribe(mediaObserver);
|
|
68
|
+
|
|
69
|
+
subscription.unsubscribe();
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
getItems:
|
|
73
|
+
The returned type of this function has changed from RxJs ReplaySubject to MediaSubscribable.
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
import { MediaClient, MediaObserver, MediaSubscribable, MediaSubscription } from '@atlaskit/media-client';
|
|
77
|
+
|
|
78
|
+
const mediaClient = new MediaClient({ authProvider });
|
|
79
|
+
|
|
80
|
+
const collectionItemsSubscribable: MediaSubscribable<MediaCollectionItem[]> = mediaClient.collection.getItems(collectionName);
|
|
81
|
+
|
|
82
|
+
const mediaObserver: MediaObserver<MediaCollectionItem[]> = {
|
|
83
|
+
next: (items) => {
|
|
84
|
+
nextCallback(items)
|
|
85
|
+
},
|
|
86
|
+
error: (error) => {
|
|
87
|
+
errorCallback(error)
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
const subscription: MediaSubscription = collectionItemsSubscribable.subscribe(mediaObserver);
|
|
92
|
+
|
|
93
|
+
subscription.unsubscribe();
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Patch Changes
|
|
97
|
+
|
|
98
|
+
- Updated dependencies
|
|
99
|
+
|
|
100
|
+
## 29.2.1
|
|
101
|
+
|
|
102
|
+
### Patch Changes
|
|
103
|
+
|
|
104
|
+
- [`7b8ba79b71b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7b8ba79b71b) - use mimeType in MediaMock when provided
|
|
105
|
+
- Updated dependencies
|
|
106
|
+
|
|
3
107
|
## 29.2.0
|
|
4
108
|
|
|
5
109
|
### Minor Changes
|
|
@@ -143,7 +143,7 @@ var FileStateFactory = /*#__PURE__*/(0, _createClass2.default)(function FileStat
|
|
|
143
143
|
(0, _defineProperty2.default)(this, "updateIdentifier", function (identifier, fileDetails) {
|
|
144
144
|
_this2.identifier = identifier;
|
|
145
145
|
_this2.fileDetails = fileDetails || (0, _helpers.createFileDetails)(_this2.identifier.id);
|
|
146
|
-
_this2.observable = (0, _mediaClient.
|
|
146
|
+
_this2.observable = (0, _mediaClient.createMediaSubject)();
|
|
147
147
|
|
|
148
148
|
_this2.mediaClient.updateObserbable(_this2.observable);
|
|
149
149
|
});
|
|
@@ -168,7 +168,7 @@ var FileStateFactory = /*#__PURE__*/(0, _createClass2.default)(function FileStat
|
|
|
168
168
|
});
|
|
169
169
|
this.identifier = identifier;
|
|
170
170
|
this.fileDetails = _fileDetails || (0, _helpers.createFileDetails)(this.identifier.id);
|
|
171
|
-
this.observable = (0, _mediaClient.
|
|
171
|
+
this.observable = (0, _mediaClient.createMediaSubject)();
|
|
172
172
|
this.mediaClient = new MediaClientMock(this.observable, mediaClientConfig, featureFlags, mediaClientMockOptions);
|
|
173
173
|
});
|
|
174
174
|
exports.FileStateFactory = FileStateFactory;
|
package/dist/cjs/index.js
CHANGED
|
@@ -329,6 +329,12 @@ Object.defineProperty(exports, "emptyImageFileId", {
|
|
|
329
329
|
return _exampleMediaItems.emptyImageFileId;
|
|
330
330
|
}
|
|
331
331
|
});
|
|
332
|
+
Object.defineProperty(exports, "enableMediaUfoLogger", {
|
|
333
|
+
enumerable: true,
|
|
334
|
+
get: function get() {
|
|
335
|
+
return _ufoLogger.enableMediaUfoLogger;
|
|
336
|
+
}
|
|
337
|
+
});
|
|
332
338
|
Object.defineProperty(exports, "enableMockGlobalImage", {
|
|
333
339
|
enumerable: true,
|
|
334
340
|
get: function get() {
|
|
@@ -443,12 +449,6 @@ Object.defineProperty(exports, "getAuthFromContextProvider", {
|
|
|
443
449
|
return _getAuthFromContextProvider.getAuthFromContextProvider;
|
|
444
450
|
}
|
|
445
451
|
});
|
|
446
|
-
Object.defineProperty(exports, "getComponentClassWithStore", {
|
|
447
|
-
enumerable: true,
|
|
448
|
-
get: function get() {
|
|
449
|
-
return _mediaPickerMocks.getComponentClassWithStore;
|
|
450
|
-
}
|
|
451
|
-
});
|
|
452
452
|
Object.defineProperty(exports, "getDefaultMediaClientConfig", {
|
|
453
453
|
enumerable: true,
|
|
454
454
|
get: function get() {
|
|
@@ -533,18 +533,6 @@ Object.defineProperty(exports, "mockCanvas", {
|
|
|
533
533
|
return _mockCanvas.mockCanvas;
|
|
534
534
|
}
|
|
535
535
|
});
|
|
536
|
-
Object.defineProperty(exports, "mockEventEmiter", {
|
|
537
|
-
enumerable: true,
|
|
538
|
-
get: function get() {
|
|
539
|
-
return _mediaPickerMocks.mockEventEmiter;
|
|
540
|
-
}
|
|
541
|
-
});
|
|
542
|
-
Object.defineProperty(exports, "mockFetcher", {
|
|
543
|
-
enumerable: true,
|
|
544
|
-
get: function get() {
|
|
545
|
-
return _mediaPickerMocks.mockFetcher;
|
|
546
|
-
}
|
|
547
|
-
});
|
|
548
536
|
Object.defineProperty(exports, "mockFileReader", {
|
|
549
537
|
enumerable: true,
|
|
550
538
|
get: function get() {
|
|
@@ -563,12 +551,6 @@ Object.defineProperty(exports, "mockFileReaderWithError", {
|
|
|
563
551
|
return _fileReader.mockFileReaderWithError;
|
|
564
552
|
}
|
|
565
553
|
});
|
|
566
|
-
Object.defineProperty(exports, "mockIsWebGLNotAvailable", {
|
|
567
|
-
enumerable: true,
|
|
568
|
-
get: function get() {
|
|
569
|
-
return _mediaPickerMocks.mockIsWebGLNotAvailable;
|
|
570
|
-
}
|
|
571
|
-
});
|
|
572
554
|
Object.defineProperty(exports, "mockLoadImage", {
|
|
573
555
|
enumerable: true,
|
|
574
556
|
get: function get() {
|
|
@@ -581,30 +563,6 @@ Object.defineProperty(exports, "mockLoadImageError", {
|
|
|
581
563
|
return _mockLoadImage.mockLoadImageError;
|
|
582
564
|
}
|
|
583
565
|
});
|
|
584
|
-
Object.defineProperty(exports, "mockPopupUploadEventEmitter", {
|
|
585
|
-
enumerable: true,
|
|
586
|
-
get: function get() {
|
|
587
|
-
return _mediaPickerMocks.mockPopupUploadEventEmitter;
|
|
588
|
-
}
|
|
589
|
-
});
|
|
590
|
-
Object.defineProperty(exports, "mockState", {
|
|
591
|
-
enumerable: true,
|
|
592
|
-
get: function get() {
|
|
593
|
-
return _mediaPickerMocks.mockState;
|
|
594
|
-
}
|
|
595
|
-
});
|
|
596
|
-
Object.defineProperty(exports, "mockStore", {
|
|
597
|
-
enumerable: true,
|
|
598
|
-
get: function get() {
|
|
599
|
-
return _mediaPickerMocks.mockStore;
|
|
600
|
-
}
|
|
601
|
-
});
|
|
602
|
-
Object.defineProperty(exports, "mockWsConnectionHolder", {
|
|
603
|
-
enumerable: true,
|
|
604
|
-
get: function get() {
|
|
605
|
-
return _mediaPickerMocks.mockWsConnectionHolder;
|
|
606
|
-
}
|
|
607
|
-
});
|
|
608
566
|
Object.defineProperty(exports, "mountWithIntlContext", {
|
|
609
567
|
enumerable: true,
|
|
610
568
|
get: function get() {
|
|
@@ -904,8 +862,6 @@ var _fileReader = require("./fileReader");
|
|
|
904
862
|
|
|
905
863
|
var _mockLoadImage = require("./mockLoadImage");
|
|
906
864
|
|
|
907
|
-
var _mediaPickerMocks = require("./mediaPickerMocks");
|
|
908
|
-
|
|
909
865
|
var _clipboardEventMocks = require("./clipboardEventMocks");
|
|
910
866
|
|
|
911
867
|
var _getAuthFromContextProvider = require("./getAuthFromContextProvider");
|
|
@@ -914,6 +870,8 @@ var _globalEventEmitterListeners = require("./globalEventEmitterListeners");
|
|
|
914
870
|
|
|
915
871
|
var _mockData = require("./utils/mockData");
|
|
916
872
|
|
|
873
|
+
var _ufoLogger = require("./ufoLogger");
|
|
874
|
+
|
|
917
875
|
var _MockGlobalImage = require("./MockGlobalImage");
|
|
918
876
|
|
|
919
877
|
var _exampleMediaFeatureFlags = require("./example-mediaFeatureFlags");
|
|
@@ -127,7 +127,7 @@ function generateFilesFromTestData(files) {
|
|
|
127
127
|
return {
|
|
128
128
|
id: id,
|
|
129
129
|
blob: blob,
|
|
130
|
-
mimeType: blob && blob.type || 'inode/x-empty',
|
|
130
|
+
mimeType: blob && blob.type || file.mimeType || 'inode/x-empty',
|
|
131
131
|
mediaType: mediaType,
|
|
132
132
|
name: name,
|
|
133
133
|
size: blob && blob.size || 0,
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.enableMediaUfoLogger = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
11
|
+
|
|
12
|
+
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; }
|
|
13
|
+
|
|
14
|
+
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) { (0, _defineProperty2.default)(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; }
|
|
15
|
+
|
|
16
|
+
var enableMediaUfoLogger = function enableMediaUfoLogger(ufoPayloadPublisher) {
|
|
17
|
+
var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
18
|
+
// Added try catch as Performance is not mocked properly in the Ufo packages.
|
|
19
|
+
// By adding try catch test are successfully passing. Created ticket for the same - MEET-2652
|
|
20
|
+
var MEDIA_UFO_OPERATIONAL_EVENT = 'Media::UFO::sendOperationalEvent:';
|
|
21
|
+
|
|
22
|
+
try {
|
|
23
|
+
ufoPayloadPublisher.setup(_objectSpread({
|
|
24
|
+
product: 'examples',
|
|
25
|
+
gasv3: {
|
|
26
|
+
sendOperationalEvent: function sendOperationalEvent(event) {
|
|
27
|
+
// eslint-disable-next-line
|
|
28
|
+
console.log(MEDIA_UFO_OPERATIONAL_EVENT, event);
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
app: {
|
|
32
|
+
version: {
|
|
33
|
+
web: 'unknown'
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}, properties));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
// eslint-disable-next-line
|
|
39
|
+
console.log("".concat(MEDIA_UFO_OPERATIONAL_EVENT, "Error:"), e);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
exports.enableMediaUfoLogger = enableMediaUfoLogger;
|
package/dist/cjs/version.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
2
|
import { tallImage, dataURItoBlob } from '..';
|
|
3
|
-
import { MediaClient,
|
|
3
|
+
import { MediaClient, createMediaSubject } from '@atlaskit/media-client';
|
|
4
4
|
import { createFileState } from './createFileState';
|
|
5
5
|
import { createFileDetails } from './helpers';
|
|
6
6
|
import { sleep } from '../nextTick';
|
|
@@ -53,7 +53,7 @@ export class FileStateFactory {
|
|
|
53
53
|
_defineProperty(this, "updateIdentifier", (identifier, fileDetails) => {
|
|
54
54
|
this.identifier = identifier;
|
|
55
55
|
this.fileDetails = fileDetails || createFileDetails(this.identifier.id);
|
|
56
|
-
this.observable =
|
|
56
|
+
this.observable = createMediaSubject();
|
|
57
57
|
this.mediaClient.updateObserbable(this.observable);
|
|
58
58
|
});
|
|
59
59
|
|
|
@@ -80,7 +80,7 @@ export class FileStateFactory {
|
|
|
80
80
|
|
|
81
81
|
this.identifier = identifier;
|
|
82
82
|
this.fileDetails = _fileDetails || createFileDetails(this.identifier.id);
|
|
83
|
-
this.observable =
|
|
83
|
+
this.observable = createMediaSubject();
|
|
84
84
|
this.mediaClient = new MediaClientMock(this.observable, mediaClientConfig, featureFlags, mediaClientMockOptions);
|
|
85
85
|
}
|
|
86
86
|
|
package/dist/es2019/index.js
CHANGED
|
@@ -27,11 +27,11 @@ export { mockCanvas } from './mockCanvas';
|
|
|
27
27
|
export { default as KeyboardEventWithKeyCode } from './keyboardEventWithKeyCode';
|
|
28
28
|
export { mockFileReader, mockFileReaderError, mockFileReaderWithError, unmockFileReader } from './fileReader';
|
|
29
29
|
export { loadImageMockSetup, mockLoadImage, mockLoadImageError, unMockLoadImage } from './mockLoadImage';
|
|
30
|
-
export { getComponentClassWithStore, mockEventEmiter, mockFetcher, mockIsWebGLNotAvailable, mockPopupUploadEventEmitter, mockState, mockStore, mockWsConnectionHolder } from './mediaPickerMocks';
|
|
31
30
|
export { ClipboardMockFile, MockDataTransfer, MockDragEvent, MockFileList, getMockClipboardEvent } from './clipboardEventMocks';
|
|
32
31
|
export { getAuthFromContextProvider } from './getAuthFromContextProvider';
|
|
33
32
|
export { addGlobalEventEmitterListeners } from './globalEventEmitterListeners';
|
|
34
33
|
export { fakeImage } from './utils/mockData';
|
|
34
|
+
export { enableMediaUfoLogger } from './ufoLogger';
|
|
35
35
|
export { enableMockGlobalImage, disableMockGlobalImage } from './MockGlobalImage';
|
|
36
36
|
export { exampleMediaFeatureFlags } from './example-mediaFeatureFlags';
|
|
37
37
|
export { dataURItoBlob } from './mockData/utils';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export const enableMediaUfoLogger = (ufoPayloadPublisher, properties = {}) => {
|
|
2
|
+
// Added try catch as Performance is not mocked properly in the Ufo packages.
|
|
3
|
+
// By adding try catch test are successfully passing. Created ticket for the same - MEET-2652
|
|
4
|
+
const MEDIA_UFO_OPERATIONAL_EVENT = 'Media::UFO::sendOperationalEvent:';
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
ufoPayloadPublisher.setup({
|
|
8
|
+
product: 'examples',
|
|
9
|
+
gasv3: {
|
|
10
|
+
sendOperationalEvent: event => {
|
|
11
|
+
// eslint-disable-next-line
|
|
12
|
+
console.log(MEDIA_UFO_OPERATIONAL_EVENT, event);
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
app: {
|
|
16
|
+
version: {
|
|
17
|
+
web: 'unknown'
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
...properties
|
|
21
|
+
});
|
|
22
|
+
} catch (e) {
|
|
23
|
+
// eslint-disable-next-line
|
|
24
|
+
console.log(`${MEDIA_UFO_OPERATIONAL_EVENT}Error:`, e);
|
|
25
|
+
}
|
|
26
|
+
};
|
package/dist/es2019/version.json
CHANGED
|
@@ -17,7 +17,7 @@ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflec
|
|
|
17
17
|
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; } }
|
|
18
18
|
|
|
19
19
|
import { tallImage, dataURItoBlob } from '..';
|
|
20
|
-
import { MediaClient,
|
|
20
|
+
import { MediaClient, createMediaSubject } from '@atlaskit/media-client';
|
|
21
21
|
import { createFileState } from './createFileState';
|
|
22
22
|
import { createFileDetails } from './helpers';
|
|
23
23
|
import { sleep } from '../nextTick';
|
|
@@ -126,7 +126,7 @@ export var FileStateFactory = /*#__PURE__*/_createClass(function FileStateFactor
|
|
|
126
126
|
_defineProperty(this, "updateIdentifier", function (identifier, fileDetails) {
|
|
127
127
|
_this2.identifier = identifier;
|
|
128
128
|
_this2.fileDetails = fileDetails || createFileDetails(_this2.identifier.id);
|
|
129
|
-
_this2.observable =
|
|
129
|
+
_this2.observable = createMediaSubject();
|
|
130
130
|
|
|
131
131
|
_this2.mediaClient.updateObserbable(_this2.observable);
|
|
132
132
|
});
|
|
@@ -156,6 +156,6 @@ export var FileStateFactory = /*#__PURE__*/_createClass(function FileStateFactor
|
|
|
156
156
|
|
|
157
157
|
this.identifier = identifier;
|
|
158
158
|
this.fileDetails = _fileDetails || createFileDetails(this.identifier.id);
|
|
159
|
-
this.observable =
|
|
159
|
+
this.observable = createMediaSubject();
|
|
160
160
|
this.mediaClient = new MediaClientMock(this.observable, mediaClientConfig, featureFlags, mediaClientMockOptions);
|
|
161
161
|
});
|
package/dist/esm/index.js
CHANGED
|
@@ -27,11 +27,11 @@ export { mockCanvas } from './mockCanvas';
|
|
|
27
27
|
export { default as KeyboardEventWithKeyCode } from './keyboardEventWithKeyCode';
|
|
28
28
|
export { mockFileReader, mockFileReaderError, mockFileReaderWithError, unmockFileReader } from './fileReader';
|
|
29
29
|
export { loadImageMockSetup, mockLoadImage, mockLoadImageError, unMockLoadImage } from './mockLoadImage';
|
|
30
|
-
export { getComponentClassWithStore, mockEventEmiter, mockFetcher, mockIsWebGLNotAvailable, mockPopupUploadEventEmitter, mockState, mockStore, mockWsConnectionHolder } from './mediaPickerMocks';
|
|
31
30
|
export { ClipboardMockFile, MockDataTransfer, MockDragEvent, MockFileList, getMockClipboardEvent } from './clipboardEventMocks';
|
|
32
31
|
export { getAuthFromContextProvider } from './getAuthFromContextProvider';
|
|
33
32
|
export { addGlobalEventEmitterListeners } from './globalEventEmitterListeners';
|
|
34
33
|
export { fakeImage } from './utils/mockData';
|
|
34
|
+
export { enableMediaUfoLogger } from './ufoLogger';
|
|
35
35
|
export { enableMockGlobalImage, disableMockGlobalImage } from './MockGlobalImage';
|
|
36
36
|
export { exampleMediaFeatureFlags } from './example-mediaFeatureFlags';
|
|
37
37
|
export { dataURItoBlob } from './mockData/utils';
|
|
@@ -98,7 +98,7 @@ export function generateFilesFromTestData(files) {
|
|
|
98
98
|
return {
|
|
99
99
|
id: id,
|
|
100
100
|
blob: blob,
|
|
101
|
-
mimeType: blob && blob.type || 'inode/x-empty',
|
|
101
|
+
mimeType: blob && blob.type || file.mimeType || 'inode/x-empty',
|
|
102
102
|
mediaType: mediaType,
|
|
103
103
|
name: name,
|
|
104
104
|
size: blob && blob.size || 0,
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
+
|
|
3
|
+
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
|
+
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
|
+
export var enableMediaUfoLogger = function enableMediaUfoLogger(ufoPayloadPublisher) {
|
|
8
|
+
var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
9
|
+
// Added try catch as Performance is not mocked properly in the Ufo packages.
|
|
10
|
+
// By adding try catch test are successfully passing. Created ticket for the same - MEET-2652
|
|
11
|
+
var MEDIA_UFO_OPERATIONAL_EVENT = 'Media::UFO::sendOperationalEvent:';
|
|
12
|
+
|
|
13
|
+
try {
|
|
14
|
+
ufoPayloadPublisher.setup(_objectSpread({
|
|
15
|
+
product: 'examples',
|
|
16
|
+
gasv3: {
|
|
17
|
+
sendOperationalEvent: function sendOperationalEvent(event) {
|
|
18
|
+
// eslint-disable-next-line
|
|
19
|
+
console.log(MEDIA_UFO_OPERATIONAL_EVENT, event);
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
app: {
|
|
23
|
+
version: {
|
|
24
|
+
web: 'unknown'
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}, properties));
|
|
28
|
+
} catch (e) {
|
|
29
|
+
// eslint-disable-next-line
|
|
30
|
+
console.log("".concat(MEDIA_UFO_OPERATIONAL_EVENT, "Error:"), e);
|
|
31
|
+
}
|
|
32
|
+
};
|
package/dist/esm/version.json
CHANGED
package/dist/types/index.d.ts
CHANGED
|
@@ -33,12 +33,11 @@ export { mockCanvas } from './mockCanvas';
|
|
|
33
33
|
export { default as KeyboardEventWithKeyCode } from './keyboardEventWithKeyCode';
|
|
34
34
|
export { mockFileReader, mockFileReaderError, mockFileReaderWithError, unmockFileReader, } from './fileReader';
|
|
35
35
|
export { loadImageMockSetup, mockLoadImage, mockLoadImageError, unMockLoadImage, } from './mockLoadImage';
|
|
36
|
-
export { getComponentClassWithStore, mockEventEmiter, mockFetcher, mockIsWebGLNotAvailable, mockPopupUploadEventEmitter, mockState, mockStore, mockWsConnectionHolder, } from './mediaPickerMocks';
|
|
37
|
-
export type { PropsWithStore } from './mediaPickerMocks';
|
|
38
36
|
export { ClipboardMockFile, MockDataTransfer, MockDragEvent, MockFileList, getMockClipboardEvent, } from './clipboardEventMocks';
|
|
39
37
|
export { getAuthFromContextProvider } from './getAuthFromContextProvider';
|
|
40
38
|
export { addGlobalEventEmitterListeners } from './globalEventEmitterListeners';
|
|
41
39
|
export { fakeImage } from './utils/mockData';
|
|
40
|
+
export { enableMediaUfoLogger } from './ufoLogger';
|
|
42
41
|
export { enableMockGlobalImage, disableMockGlobalImage, } from './MockGlobalImage';
|
|
43
42
|
export { exampleMediaFeatureFlags } from './example-mediaFeatureFlags';
|
|
44
43
|
export { dataURItoBlob } from './mockData/utils';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const Matrix: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, Pick<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "
|
|
2
|
+
export declare const Matrix: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, Pick<import("react").DetailedHTMLProps<import("react").TableHTMLAttributes<HTMLTableElement>, HTMLTableElement>, "color" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css" | "summary" | "cellPadding" | "cellSpacing">, any>;
|
package/dist/types/styled.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const LocaleSelectorWrapper: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "
|
|
2
|
+
export declare const LocaleSelectorWrapper: import("@emotion/styled-base").StyledComponent<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "color" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "slot" | "spellCheck" | "style" | "tabIndex" | "title" | "inputMode" | "is" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "css">, any>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-test-helpers",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.4.0",
|
|
4
4
|
"description": "Collection of test helpers used in media component stories and specs",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/"
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"@atlaskit/checkbox": "^12.2.0",
|
|
24
24
|
"@atlaskit/icon": "^21.10.0",
|
|
25
25
|
"@atlaskit/locale": "^2.1.0",
|
|
26
|
-
"@atlaskit/media-client": "^
|
|
27
|
-
"@atlaskit/media-common": "^2.
|
|
28
|
-
"@atlaskit/media-core": "^32.
|
|
29
|
-
"@atlaskit/media-
|
|
30
|
-
"@atlaskit/media-ui": "^20.0.0",
|
|
26
|
+
"@atlaskit/media-client": "^15.0.0",
|
|
27
|
+
"@atlaskit/media-common": "^2.12.0",
|
|
28
|
+
"@atlaskit/media-core": "^32.3.0",
|
|
29
|
+
"@atlaskit/media-ui": "^21.1.0",
|
|
31
30
|
"@atlaskit/popup": "^1.3.0",
|
|
32
31
|
"@atlaskit/textfield": "^5.0.1",
|
|
33
32
|
"@atlaskit/tooltip": "^17.5.0",
|
|
33
|
+
"@atlaskit/ufo": "^0.1.0",
|
|
34
34
|
"@babel/runtime": "^7.0.0",
|
|
35
35
|
"@emotion/styled": "^10.0.7",
|
|
36
36
|
"@testing-library/react": "^8.0.1",
|
|
@@ -39,19 +39,17 @@
|
|
|
39
39
|
"kakapo": "^4.0.6",
|
|
40
40
|
"mock-socket": "^9.0.3",
|
|
41
41
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
42
|
-
"
|
|
42
|
+
"rxjs": "^5.5.0",
|
|
43
43
|
"uuid": "^3.1.0",
|
|
44
44
|
"xhr-mock": "^2.4.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
|
-
"react": "^16.8.0"
|
|
48
|
-
"rxjs": "^5.5.0"
|
|
47
|
+
"react": "^16.8.0"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
50
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
52
51
|
"react-dom": "^16.8.0",
|
|
53
|
-
"
|
|
54
|
-
"typescript": "3.9.6"
|
|
52
|
+
"typescript": "3.9.10"
|
|
55
53
|
},
|
|
56
54
|
"af:exports": {
|
|
57
55
|
"./renderWithIntl": "./src/renderWithIntl.tsx",
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
Object.defineProperty(exports, "__esModule", {
|
|
6
|
-
value: true
|
|
7
|
-
});
|
|
8
|
-
exports.getComponentClassWithStore = getComponentClassWithStore;
|
|
9
|
-
exports.mockWsConnectionHolder = exports.mockStore = exports.mockState = exports.mockPopupUploadEventEmitter = exports.mockIsWebGLNotAvailable = exports.mockFetcher = exports.mockEventEmiter = void 0;
|
|
10
|
-
|
|
11
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
12
|
-
|
|
13
|
-
var _fakeMediaClient = require("./fakeMediaClient");
|
|
14
|
-
|
|
15
|
-
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; }
|
|
16
|
-
|
|
17
|
-
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) { (0, _defineProperty2.default)(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; }
|
|
18
|
-
|
|
19
|
-
var mockState = {
|
|
20
|
-
redirectUrl: 'some-redirect-url',
|
|
21
|
-
view: {
|
|
22
|
-
isVisible: true,
|
|
23
|
-
items: [],
|
|
24
|
-
isLoading: false,
|
|
25
|
-
hasError: false,
|
|
26
|
-
path: [],
|
|
27
|
-
service: {
|
|
28
|
-
accountId: 'some-view-service-account-id',
|
|
29
|
-
name: 'google'
|
|
30
|
-
},
|
|
31
|
-
isUploading: false,
|
|
32
|
-
isCancelling: false
|
|
33
|
-
},
|
|
34
|
-
accounts: Promise.resolve([]),
|
|
35
|
-
recents: {
|
|
36
|
-
items: []
|
|
37
|
-
},
|
|
38
|
-
selectedItems: [],
|
|
39
|
-
lastUploadIndex: 0,
|
|
40
|
-
uploads: {},
|
|
41
|
-
remoteUploads: {},
|
|
42
|
-
isCancelling: false,
|
|
43
|
-
isUploading: false,
|
|
44
|
-
giphy: {
|
|
45
|
-
imageCardModels: [],
|
|
46
|
-
totalResultCount: 100
|
|
47
|
-
},
|
|
48
|
-
onCancelUpload: jest.fn(),
|
|
49
|
-
tenantMediaClient: (0, _fakeMediaClient.fakeMediaClient)(),
|
|
50
|
-
userMediaClient: (0, _fakeMediaClient.fakeMediaClient)(),
|
|
51
|
-
config: {}
|
|
52
|
-
};
|
|
53
|
-
exports.mockState = mockState;
|
|
54
|
-
|
|
55
|
-
var mockStore = function mockStore(state) {
|
|
56
|
-
return {
|
|
57
|
-
dispatch: jest.fn().mockImplementation(function (action) {
|
|
58
|
-
return action;
|
|
59
|
-
}),
|
|
60
|
-
getState: jest.fn().mockReturnValue(_objectSpread(_objectSpread({}, mockState), state)),
|
|
61
|
-
subscribe: jest.fn(),
|
|
62
|
-
replaceReducer: jest.fn()
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
exports.mockStore = mockStore;
|
|
67
|
-
|
|
68
|
-
var mockFetcher = function mockFetcher() {
|
|
69
|
-
return {
|
|
70
|
-
fetchCloudAccountFolder: jest.fn(),
|
|
71
|
-
pollFile: jest.fn(),
|
|
72
|
-
getPreview: jest.fn(),
|
|
73
|
-
getImage: jest.fn(),
|
|
74
|
-
getServiceList: jest.fn(),
|
|
75
|
-
getRecentFiles: jest.fn(),
|
|
76
|
-
unlinkCloudAccount: jest.fn(),
|
|
77
|
-
fetchCloudAccountFile: jest.fn(),
|
|
78
|
-
copyFile: jest.fn(),
|
|
79
|
-
fetchTrendingGifs: jest.fn(),
|
|
80
|
-
fetchGifsRelevantToSearch: jest.fn()
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
exports.mockFetcher = mockFetcher;
|
|
85
|
-
|
|
86
|
-
var mockIsWebGLNotAvailable = function mockIsWebGLNotAvailable() {
|
|
87
|
-
jest.mock('@atlaskit/media-picker/src/popup/tools/webgl', function () {
|
|
88
|
-
return {
|
|
89
|
-
isWebGLAvailable: jest.fn(function () {
|
|
90
|
-
return false;
|
|
91
|
-
})
|
|
92
|
-
};
|
|
93
|
-
});
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
exports.mockIsWebGLNotAvailable = mockIsWebGLNotAvailable;
|
|
97
|
-
|
|
98
|
-
var mockWsConnectionHolder = function mockWsConnectionHolder() {
|
|
99
|
-
return {
|
|
100
|
-
openConnection: jest.fn(),
|
|
101
|
-
send: jest.fn()
|
|
102
|
-
};
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
exports.mockWsConnectionHolder = mockWsConnectionHolder;
|
|
106
|
-
|
|
107
|
-
var mockEventEmiter = function mockEventEmiter() {
|
|
108
|
-
return {
|
|
109
|
-
once: jest.fn(),
|
|
110
|
-
on: jest.fn(),
|
|
111
|
-
onAny: jest.fn(),
|
|
112
|
-
addListener: jest.fn(),
|
|
113
|
-
off: jest.fn(),
|
|
114
|
-
removeListener: jest.fn(),
|
|
115
|
-
removeAllListeners: jest.fn(),
|
|
116
|
-
emit: jest.fn()
|
|
117
|
-
};
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
exports.mockEventEmiter = mockEventEmiter;
|
|
121
|
-
|
|
122
|
-
var mockPopupUploadEventEmitter = function mockPopupUploadEventEmitter() {
|
|
123
|
-
return {
|
|
124
|
-
emitPluginItemsInserted: jest.fn(),
|
|
125
|
-
emitClosed: jest.fn(),
|
|
126
|
-
emitUploadsStart: jest.fn(),
|
|
127
|
-
emitUploadPreviewUpdate: jest.fn(),
|
|
128
|
-
emitUploadEnd: jest.fn(),
|
|
129
|
-
emitUploadError: jest.fn()
|
|
130
|
-
};
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
exports.mockPopupUploadEventEmitter = mockPopupUploadEventEmitter;
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* Connected (react-redux) components allow to provide "store" as prop directly (without specifying
|
|
137
|
-
* store Provider wrapper). But current type definition doesn't allow for that.
|
|
138
|
-
* This function takes React Component class and return one identical, but with additional store prop)
|
|
139
|
-
*/
|
|
140
|
-
function getComponentClassWithStore(componentClass) {
|
|
141
|
-
return componentClass;
|
|
142
|
-
}
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
// AFP-2532 TODO: Fix automatic suppressions below
|
|
2
|
-
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
3
|
-
// AFP-2532 TODO: Fix automatic suppressions below
|
|
4
|
-
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
5
|
-
//TODO: Remove access to src directly. Can move these to media-picker or add special "internal" entrypoint
|
|
6
|
-
import { fakeMediaClient } from './fakeMediaClient';
|
|
7
|
-
export const mockState = {
|
|
8
|
-
redirectUrl: 'some-redirect-url',
|
|
9
|
-
view: {
|
|
10
|
-
isVisible: true,
|
|
11
|
-
items: [],
|
|
12
|
-
isLoading: false,
|
|
13
|
-
hasError: false,
|
|
14
|
-
path: [],
|
|
15
|
-
service: {
|
|
16
|
-
accountId: 'some-view-service-account-id',
|
|
17
|
-
name: 'google'
|
|
18
|
-
},
|
|
19
|
-
isUploading: false,
|
|
20
|
-
isCancelling: false
|
|
21
|
-
},
|
|
22
|
-
accounts: Promise.resolve([]),
|
|
23
|
-
recents: {
|
|
24
|
-
items: []
|
|
25
|
-
},
|
|
26
|
-
selectedItems: [],
|
|
27
|
-
lastUploadIndex: 0,
|
|
28
|
-
uploads: {},
|
|
29
|
-
remoteUploads: {},
|
|
30
|
-
isCancelling: false,
|
|
31
|
-
isUploading: false,
|
|
32
|
-
giphy: {
|
|
33
|
-
imageCardModels: [],
|
|
34
|
-
totalResultCount: 100
|
|
35
|
-
},
|
|
36
|
-
onCancelUpload: jest.fn(),
|
|
37
|
-
tenantMediaClient: fakeMediaClient(),
|
|
38
|
-
userMediaClient: fakeMediaClient(),
|
|
39
|
-
config: {}
|
|
40
|
-
};
|
|
41
|
-
export const mockStore = state => ({
|
|
42
|
-
dispatch: jest.fn().mockImplementation(action => action),
|
|
43
|
-
getState: jest.fn().mockReturnValue({ ...mockState,
|
|
44
|
-
...state
|
|
45
|
-
}),
|
|
46
|
-
subscribe: jest.fn(),
|
|
47
|
-
replaceReducer: jest.fn()
|
|
48
|
-
});
|
|
49
|
-
export const mockFetcher = () => ({
|
|
50
|
-
fetchCloudAccountFolder: jest.fn(),
|
|
51
|
-
pollFile: jest.fn(),
|
|
52
|
-
getPreview: jest.fn(),
|
|
53
|
-
getImage: jest.fn(),
|
|
54
|
-
getServiceList: jest.fn(),
|
|
55
|
-
getRecentFiles: jest.fn(),
|
|
56
|
-
unlinkCloudAccount: jest.fn(),
|
|
57
|
-
fetchCloudAccountFile: jest.fn(),
|
|
58
|
-
copyFile: jest.fn(),
|
|
59
|
-
fetchTrendingGifs: jest.fn(),
|
|
60
|
-
fetchGifsRelevantToSearch: jest.fn()
|
|
61
|
-
});
|
|
62
|
-
export const mockIsWebGLNotAvailable = () => {
|
|
63
|
-
jest.mock('@atlaskit/media-picker/src/popup/tools/webgl', () => {
|
|
64
|
-
return {
|
|
65
|
-
isWebGLAvailable: jest.fn(() => {
|
|
66
|
-
return false;
|
|
67
|
-
})
|
|
68
|
-
};
|
|
69
|
-
});
|
|
70
|
-
};
|
|
71
|
-
export const mockWsConnectionHolder = () => ({
|
|
72
|
-
openConnection: jest.fn(),
|
|
73
|
-
send: jest.fn()
|
|
74
|
-
});
|
|
75
|
-
export const mockEventEmiter = () => ({
|
|
76
|
-
once: jest.fn(),
|
|
77
|
-
on: jest.fn(),
|
|
78
|
-
onAny: jest.fn(),
|
|
79
|
-
addListener: jest.fn(),
|
|
80
|
-
off: jest.fn(),
|
|
81
|
-
removeListener: jest.fn(),
|
|
82
|
-
removeAllListeners: jest.fn(),
|
|
83
|
-
emit: jest.fn()
|
|
84
|
-
});
|
|
85
|
-
export const mockPopupUploadEventEmitter = () => ({
|
|
86
|
-
emitPluginItemsInserted: jest.fn(),
|
|
87
|
-
emitClosed: jest.fn(),
|
|
88
|
-
emitUploadsStart: jest.fn(),
|
|
89
|
-
emitUploadPreviewUpdate: jest.fn(),
|
|
90
|
-
emitUploadEnd: jest.fn(),
|
|
91
|
-
emitUploadError: jest.fn()
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Connected (react-redux) components allow to provide "store" as prop directly (without specifying
|
|
96
|
-
* store Provider wrapper). But current type definition doesn't allow for that.
|
|
97
|
-
* This function takes React Component class and return one identical, but with additional store prop)
|
|
98
|
-
*/
|
|
99
|
-
export function getComponentClassWithStore(componentClass) {
|
|
100
|
-
return componentClass;
|
|
101
|
-
}
|
|
@@ -1,117 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/defineProperty";
|
|
2
|
-
|
|
3
|
-
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
|
-
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
|
-
// AFP-2532 TODO: Fix automatic suppressions below
|
|
8
|
-
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
9
|
-
// AFP-2532 TODO: Fix automatic suppressions below
|
|
10
|
-
// eslint-disable-next-line @atlassian/tangerine/import/entry-points
|
|
11
|
-
//TODO: Remove access to src directly. Can move these to media-picker or add special "internal" entrypoint
|
|
12
|
-
import { fakeMediaClient } from './fakeMediaClient';
|
|
13
|
-
export var mockState = {
|
|
14
|
-
redirectUrl: 'some-redirect-url',
|
|
15
|
-
view: {
|
|
16
|
-
isVisible: true,
|
|
17
|
-
items: [],
|
|
18
|
-
isLoading: false,
|
|
19
|
-
hasError: false,
|
|
20
|
-
path: [],
|
|
21
|
-
service: {
|
|
22
|
-
accountId: 'some-view-service-account-id',
|
|
23
|
-
name: 'google'
|
|
24
|
-
},
|
|
25
|
-
isUploading: false,
|
|
26
|
-
isCancelling: false
|
|
27
|
-
},
|
|
28
|
-
accounts: Promise.resolve([]),
|
|
29
|
-
recents: {
|
|
30
|
-
items: []
|
|
31
|
-
},
|
|
32
|
-
selectedItems: [],
|
|
33
|
-
lastUploadIndex: 0,
|
|
34
|
-
uploads: {},
|
|
35
|
-
remoteUploads: {},
|
|
36
|
-
isCancelling: false,
|
|
37
|
-
isUploading: false,
|
|
38
|
-
giphy: {
|
|
39
|
-
imageCardModels: [],
|
|
40
|
-
totalResultCount: 100
|
|
41
|
-
},
|
|
42
|
-
onCancelUpload: jest.fn(),
|
|
43
|
-
tenantMediaClient: fakeMediaClient(),
|
|
44
|
-
userMediaClient: fakeMediaClient(),
|
|
45
|
-
config: {}
|
|
46
|
-
};
|
|
47
|
-
export var mockStore = function mockStore(state) {
|
|
48
|
-
return {
|
|
49
|
-
dispatch: jest.fn().mockImplementation(function (action) {
|
|
50
|
-
return action;
|
|
51
|
-
}),
|
|
52
|
-
getState: jest.fn().mockReturnValue(_objectSpread(_objectSpread({}, mockState), state)),
|
|
53
|
-
subscribe: jest.fn(),
|
|
54
|
-
replaceReducer: jest.fn()
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
export var mockFetcher = function mockFetcher() {
|
|
58
|
-
return {
|
|
59
|
-
fetchCloudAccountFolder: jest.fn(),
|
|
60
|
-
pollFile: jest.fn(),
|
|
61
|
-
getPreview: jest.fn(),
|
|
62
|
-
getImage: jest.fn(),
|
|
63
|
-
getServiceList: jest.fn(),
|
|
64
|
-
getRecentFiles: jest.fn(),
|
|
65
|
-
unlinkCloudAccount: jest.fn(),
|
|
66
|
-
fetchCloudAccountFile: jest.fn(),
|
|
67
|
-
copyFile: jest.fn(),
|
|
68
|
-
fetchTrendingGifs: jest.fn(),
|
|
69
|
-
fetchGifsRelevantToSearch: jest.fn()
|
|
70
|
-
};
|
|
71
|
-
};
|
|
72
|
-
export var mockIsWebGLNotAvailable = function mockIsWebGLNotAvailable() {
|
|
73
|
-
jest.mock('@atlaskit/media-picker/src/popup/tools/webgl', function () {
|
|
74
|
-
return {
|
|
75
|
-
isWebGLAvailable: jest.fn(function () {
|
|
76
|
-
return false;
|
|
77
|
-
})
|
|
78
|
-
};
|
|
79
|
-
});
|
|
80
|
-
};
|
|
81
|
-
export var mockWsConnectionHolder = function mockWsConnectionHolder() {
|
|
82
|
-
return {
|
|
83
|
-
openConnection: jest.fn(),
|
|
84
|
-
send: jest.fn()
|
|
85
|
-
};
|
|
86
|
-
};
|
|
87
|
-
export var mockEventEmiter = function mockEventEmiter() {
|
|
88
|
-
return {
|
|
89
|
-
once: jest.fn(),
|
|
90
|
-
on: jest.fn(),
|
|
91
|
-
onAny: jest.fn(),
|
|
92
|
-
addListener: jest.fn(),
|
|
93
|
-
off: jest.fn(),
|
|
94
|
-
removeListener: jest.fn(),
|
|
95
|
-
removeAllListeners: jest.fn(),
|
|
96
|
-
emit: jest.fn()
|
|
97
|
-
};
|
|
98
|
-
};
|
|
99
|
-
export var mockPopupUploadEventEmitter = function mockPopupUploadEventEmitter() {
|
|
100
|
-
return {
|
|
101
|
-
emitPluginItemsInserted: jest.fn(),
|
|
102
|
-
emitClosed: jest.fn(),
|
|
103
|
-
emitUploadsStart: jest.fn(),
|
|
104
|
-
emitUploadPreviewUpdate: jest.fn(),
|
|
105
|
-
emitUploadEnd: jest.fn(),
|
|
106
|
-
emitUploadError: jest.fn()
|
|
107
|
-
};
|
|
108
|
-
};
|
|
109
|
-
|
|
110
|
-
/**
|
|
111
|
-
* Connected (react-redux) components allow to provide "store" as prop directly (without specifying
|
|
112
|
-
* store Provider wrapper). But current type definition doesn't allow for that.
|
|
113
|
-
* This function takes React Component class and return one identical, but with additional store prop)
|
|
114
|
-
*/
|
|
115
|
-
export function getComponentClassWithStore(componentClass) {
|
|
116
|
-
return componentClass;
|
|
117
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
|
-
/// <reference types="react" />
|
|
3
|
-
import { State } from '@atlaskit/media-picker/src/popup/domain';
|
|
4
|
-
import { PopupUploadEventEmitter } from '@atlaskit/media-picker/src/components/types';
|
|
5
|
-
import { Store } from 'react-redux';
|
|
6
|
-
export declare const mockState: State;
|
|
7
|
-
export declare const mockStore: (state?: Partial<State> | undefined) => jest.Mocked<Store<State>>;
|
|
8
|
-
export declare const mockFetcher: () => {
|
|
9
|
-
fetchCloudAccountFolder: jest.Mock<any, any>;
|
|
10
|
-
pollFile: jest.Mock<any, any>;
|
|
11
|
-
getPreview: jest.Mock<any, any>;
|
|
12
|
-
getImage: jest.Mock<any, any>;
|
|
13
|
-
getServiceList: jest.Mock<any, any>;
|
|
14
|
-
getRecentFiles: jest.Mock<any, any>;
|
|
15
|
-
unlinkCloudAccount: jest.Mock<any, any>;
|
|
16
|
-
fetchCloudAccountFile: jest.Mock<any, any>;
|
|
17
|
-
copyFile: jest.Mock<any, any>;
|
|
18
|
-
fetchTrendingGifs: jest.Mock<any, any>;
|
|
19
|
-
fetchGifsRelevantToSearch: jest.Mock<any, any>;
|
|
20
|
-
};
|
|
21
|
-
export declare const mockIsWebGLNotAvailable: () => void;
|
|
22
|
-
export declare const mockWsConnectionHolder: () => {
|
|
23
|
-
openConnection: jest.Mock<any, any>;
|
|
24
|
-
send: jest.Mock<any, any>;
|
|
25
|
-
};
|
|
26
|
-
export declare const mockEventEmiter: () => {
|
|
27
|
-
once: jest.Mock<any, any>;
|
|
28
|
-
on: jest.Mock<any, any>;
|
|
29
|
-
onAny: jest.Mock<any, any>;
|
|
30
|
-
addListener: jest.Mock<any, any>;
|
|
31
|
-
off: jest.Mock<any, any>;
|
|
32
|
-
removeListener: jest.Mock<any, any>;
|
|
33
|
-
removeAllListeners: jest.Mock<any, any>;
|
|
34
|
-
emit: jest.Mock<any, any>;
|
|
35
|
-
};
|
|
36
|
-
export declare const mockPopupUploadEventEmitter: () => jest.Mocked<PopupUploadEventEmitter>;
|
|
37
|
-
export interface PropsWithStore {
|
|
38
|
-
store?: Store<any>;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Connected (react-redux) components allow to provide "store" as prop directly (without specifying
|
|
42
|
-
* store Provider wrapper). But current type definition doesn't allow for that.
|
|
43
|
-
* This function takes React Component class and return one identical, but with additional store prop)
|
|
44
|
-
*/
|
|
45
|
-
export declare function getComponentClassWithStore<P>(componentClass: React.ComponentClass<P>): React.ComponentClass<P & PropsWithStore>;
|