@atlaskit/media-test-helpers 29.1.0 → 29.3.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/featureFlagsWrapper/dropdown.js +2 -2
- package/dist/cjs/fileStateFactory/factory.js +2 -2
- package/dist/cjs/mockData/matchers.js +4 -6
- package/dist/cjs/mocks/media-mock.js +1 -1
- package/dist/cjs/version.json +1 -1
- package/dist/es2019/featureFlagsWrapper/dropdown.js +1 -1
- package/dist/es2019/fileStateFactory/factory.js +3 -3
- package/dist/es2019/mockData/matchers.js +1 -1
- package/dist/es2019/mocks/media-mock.js +1 -1
- package/dist/es2019/version.json +1 -1
- package/dist/esm/featureFlagsWrapper/dropdown.js +1 -1
- package/dist/esm/fileStateFactory/factory.js +3 -3
- package/dist/esm/mockData/matchers.js +1 -1
- package/dist/esm/mocks/media-mock.js +1 -1
- package/dist/esm/version.json +1 -1
- package/package.json +9 -11
- package/typings/uuid.d.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,109 @@
|
|
|
1
1
|
# @atlaskit/media-test-helpers
|
|
2
2
|
|
|
3
|
+
## 29.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [`f862d5ae7aa`](https://bitbucket.org/atlassian/atlassian-frontend/commits/f862d5ae7aa) - remove RxJs peer dependency
|
|
8
|
+
- [`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).
|
|
9
|
+
It exposes subscribe method that is called with MediaObserver as an argument and returns MediaSubscription.
|
|
10
|
+
MediaSubscription exposes unsubscribe method.
|
|
11
|
+
|
|
12
|
+
getFileState:
|
|
13
|
+
The returned type of this function has changed from RxJs ReplaySubject to MediaSubscribable.
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
import { MediaClient, MediaObserver, MediaSubscribable, MediaSubscription } from '@atlaskit/media-client';
|
|
17
|
+
|
|
18
|
+
const mediaClient = new MediaClient({ authProvider });
|
|
19
|
+
|
|
20
|
+
const fileStateSubscribable: MediaSubscribable<FileState> = mediaClient.file.getFileState(id);
|
|
21
|
+
|
|
22
|
+
const mediaObserver: MediaObserver<FileState> = {
|
|
23
|
+
next: (fileState) => {
|
|
24
|
+
nextCallback(fileState)
|
|
25
|
+
},
|
|
26
|
+
error: (error) => {
|
|
27
|
+
errorCallback(error)
|
|
28
|
+
},
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const subscription: MediaSubscription = fileStateSubscribable.subscribe(mediaObserver);
|
|
32
|
+
|
|
33
|
+
subscription.unsubscribe();
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
upload:
|
|
37
|
+
The returned type of this function has changed from RxJs ReplaySubject to MediaSubscribable.
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
import { MediaClient, MediaObserver, MediaSubscribable, MediaSubscription } from '@atlaskit/media-client';
|
|
41
|
+
|
|
42
|
+
const mediaClient = new MediaClient({ authProvider });
|
|
43
|
+
|
|
44
|
+
const uploadFileSubscribable: MediaSubscribable<FileState> = mediaClient.file.upload(uploadableFile);
|
|
45
|
+
|
|
46
|
+
const mediaObserver: MediaObserver<FileState> = {
|
|
47
|
+
next: (fileState) => {
|
|
48
|
+
nextCallback(fileState)
|
|
49
|
+
},
|
|
50
|
+
error: (error) => {
|
|
51
|
+
errorCallback(error)
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
const subscription: MediaSubscription = uploadFileSubscribable.subscribe(mediaObserver);
|
|
56
|
+
|
|
57
|
+
subscription.unsubscribe();
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
getItems:
|
|
61
|
+
The returned type of this function has changed from RxJs ReplaySubject to MediaSubscribable.
|
|
62
|
+
|
|
63
|
+
```
|
|
64
|
+
import { MediaClient, MediaObserver, MediaSubscribable, MediaSubscription } from '@atlaskit/media-client';
|
|
65
|
+
|
|
66
|
+
const mediaClient = new MediaClient({ authProvider });
|
|
67
|
+
|
|
68
|
+
const collectionItemsSubscribable: MediaSubscribable<MediaCollectionItem[]> = mediaClient.collection.getItems(collectionName);
|
|
69
|
+
|
|
70
|
+
const mediaObserver: MediaObserver<MediaCollectionItem[]> = {
|
|
71
|
+
next: (items) => {
|
|
72
|
+
nextCallback(items)
|
|
73
|
+
},
|
|
74
|
+
error: (error) => {
|
|
75
|
+
errorCallback(error)
|
|
76
|
+
},
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const subscription: MediaSubscription = collectionItemsSubscribable.subscribe(mediaObserver);
|
|
80
|
+
|
|
81
|
+
subscription.unsubscribe();
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### Patch Changes
|
|
85
|
+
|
|
86
|
+
- Updated dependencies
|
|
87
|
+
|
|
88
|
+
## 29.2.1
|
|
89
|
+
|
|
90
|
+
### Patch Changes
|
|
91
|
+
|
|
92
|
+
- [`7b8ba79b71b`](https://bitbucket.org/atlassian/atlassian-frontend/commits/7b8ba79b71b) - use mimeType in MediaMock when provided
|
|
93
|
+
- Updated dependencies
|
|
94
|
+
|
|
95
|
+
## 29.2.0
|
|
96
|
+
|
|
97
|
+
### Minor Changes
|
|
98
|
+
|
|
99
|
+
- [`8bf4fdb8ed4`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8bf4fdb8ed4) - add renderWithIntl helper
|
|
100
|
+
- [`8742dbe70bd`](https://bitbucket.org/atlassian/atlassian-frontend/commits/8742dbe70bd) - MEX-1102 Removed lodash dependencies from media component and converted all to local functions (lightweight helpers)
|
|
101
|
+
- [`94539e589cc`](https://bitbucket.org/atlassian/atlassian-frontend/commits/94539e589cc) - MEX-1105 Migrated @atlaskit/button to @atlaskit/button/standard-button
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- Updated dependencies
|
|
106
|
+
|
|
3
107
|
## 29.1.0
|
|
4
108
|
|
|
5
109
|
### Minor Changes
|
|
@@ -37,7 +37,7 @@ var _popup = _interopRequireDefault(require("@atlaskit/popup"));
|
|
|
37
37
|
|
|
38
38
|
var _checkbox = require("@atlaskit/checkbox");
|
|
39
39
|
|
|
40
|
-
var
|
|
40
|
+
var _mediaCommon = require("@atlaskit/media-common");
|
|
41
41
|
|
|
42
42
|
var _templateObject;
|
|
43
43
|
|
|
@@ -83,7 +83,7 @@ var TextFieldItem = function TextFieldItem(_ref3) {
|
|
|
83
83
|
value = _ref3.value,
|
|
84
84
|
isNumber = _ref3.isNumber,
|
|
85
85
|
onChange = _ref3.onChange;
|
|
86
|
-
var fieldChanged = (0,
|
|
86
|
+
var fieldChanged = (0, _mediaCommon.debounce)(function (newValue) {
|
|
87
87
|
var formattedValue = isNumber ? isNaN(Number(newValue)) ? 0 : Number(newValue) : newValue;
|
|
88
88
|
(0, _helpers.setLocalFeatureFlag)(name, formattedValue);
|
|
89
89
|
onChange();
|
|
@@ -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;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
3
|
Object.defineProperty(exports, "__esModule", {
|
|
6
4
|
value: true
|
|
7
5
|
});
|
|
8
6
|
exports.matchMethod = exports.exactMatchUrl = exports.exactMatchHeaders = exports.exactMatchBody = exports.exactMatch = void 0;
|
|
9
7
|
|
|
10
|
-
var
|
|
8
|
+
var _mediaCommon = require("@atlaskit/media-common");
|
|
11
9
|
|
|
12
10
|
var matchMethod = function matchMethod(req, data) {
|
|
13
11
|
return data.method ? data.method === req.method() : true;
|
|
@@ -16,20 +14,20 @@ var matchMethod = function matchMethod(req, data) {
|
|
|
16
14
|
exports.matchMethod = matchMethod;
|
|
17
15
|
|
|
18
16
|
var exactMatchUrl = function exactMatchUrl(req, data) {
|
|
19
|
-
return data.url ? (0,
|
|
17
|
+
return data.url ? (0, _mediaCommon.matches)(data.url)(req.url()) : true;
|
|
20
18
|
};
|
|
21
19
|
|
|
22
20
|
exports.exactMatchUrl = exactMatchUrl;
|
|
23
21
|
|
|
24
22
|
var exactMatchHeaders = function exactMatchHeaders(req, data) {
|
|
25
|
-
return data.headers ? (0,
|
|
23
|
+
return data.headers ? (0, _mediaCommon.matches)(data.headers)(req.headers()) : true;
|
|
26
24
|
};
|
|
27
25
|
|
|
28
26
|
exports.exactMatchHeaders = exactMatchHeaders;
|
|
29
27
|
|
|
30
28
|
var exactMatchBody = function exactMatchBody(req, data) {
|
|
31
29
|
try {
|
|
32
|
-
return data.body ? (0,
|
|
30
|
+
return data.body ? (0, _mediaCommon.matches)(JSON.parse(data.body))(JSON.parse(req.body() || '{}')) : true;
|
|
33
31
|
} catch (e) {
|
|
34
32
|
return false;
|
|
35
33
|
}
|
|
@@ -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,
|
package/dist/cjs/version.json
CHANGED
|
@@ -9,7 +9,7 @@ import Tooltip from '@atlaskit/tooltip';
|
|
|
9
9
|
import styled from '@emotion/styled';
|
|
10
10
|
import Popup from '@atlaskit/popup';
|
|
11
11
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
12
|
-
import debounce from '
|
|
12
|
+
import { debounce } from '@atlaskit/media-common';
|
|
13
13
|
|
|
14
14
|
const camelCaseToSentenceCase = text => {
|
|
15
15
|
var result = text.replace(/([A-Z])/g, ' $1');
|
|
@@ -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/version.json
CHANGED
|
@@ -15,7 +15,7 @@ import Tooltip from '@atlaskit/tooltip';
|
|
|
15
15
|
import styled from '@emotion/styled';
|
|
16
16
|
import Popup from '@atlaskit/popup';
|
|
17
17
|
import { Checkbox } from '@atlaskit/checkbox';
|
|
18
|
-
import debounce from '
|
|
18
|
+
import { debounce } from '@atlaskit/media-common';
|
|
19
19
|
|
|
20
20
|
var camelCaseToSentenceCase = function camelCaseToSentenceCase(text) {
|
|
21
21
|
var result = text.replace(/([A-Z])/g, ' $1');
|
|
@@ -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
|
});
|
|
@@ -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,
|
package/dist/esm/version.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlaskit/media-test-helpers",
|
|
3
|
-
"version": "29.
|
|
3
|
+
"version": "29.3.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/"
|
|
@@ -19,15 +19,15 @@
|
|
|
19
19
|
"releaseModel": "scheduled"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@atlaskit/button": "^16.
|
|
22
|
+
"@atlaskit/button": "^16.2.0",
|
|
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-picker": "^
|
|
30
|
-
"@atlaskit/media-ui": "^
|
|
26
|
+
"@atlaskit/media-client": "^15.0.0",
|
|
27
|
+
"@atlaskit/media-common": "^2.11.0",
|
|
28
|
+
"@atlaskit/media-core": "^32.3.0",
|
|
29
|
+
"@atlaskit/media-picker": "^60.0.0",
|
|
30
|
+
"@atlaskit/media-ui": "^21.0.0",
|
|
31
31
|
"@atlaskit/popup": "^1.3.0",
|
|
32
32
|
"@atlaskit/textfield": "^5.0.1",
|
|
33
33
|
"@atlaskit/tooltip": "^17.5.0",
|
|
@@ -37,21 +37,19 @@
|
|
|
37
37
|
"enzyme": "^3.10.0",
|
|
38
38
|
"exenv": "^1.2.2",
|
|
39
39
|
"kakapo": "^4.0.6",
|
|
40
|
-
"lodash": "^4.17.21",
|
|
41
40
|
"mock-socket": "^9.0.3",
|
|
42
41
|
"react-intl-next": "npm:react-intl@^5.18.1",
|
|
43
42
|
"react-redux": "^5.1.2",
|
|
43
|
+
"rxjs": "^5.5.0",
|
|
44
44
|
"uuid": "^3.1.0",
|
|
45
45
|
"xhr-mock": "^2.4.0"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
|
-
"react": "^16.8.0"
|
|
49
|
-
"rxjs": "^5.5.0"
|
|
48
|
+
"react": "^16.8.0"
|
|
50
49
|
},
|
|
51
50
|
"devDependencies": {
|
|
52
51
|
"@atlassian/atlassian-frontend-prettier-config-1.0.1": "npm:@atlassian/atlassian-frontend-prettier-config@1.0.1",
|
|
53
52
|
"react-dom": "^16.8.0",
|
|
54
|
-
"rxjs": "^5.5.0",
|
|
55
53
|
"typescript": "3.9.6"
|
|
56
54
|
},
|
|
57
55
|
"af:exports": {
|
package/typings/uuid.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
declare module 'uuid/*';
|