@sprucelabs/heartwood-view-controllers 118.2.1 → 118.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { ViewController, Card, SimpleViewControllerFactory } from '../../types/heartwood.types';
|
|
1
|
+
import { ViewController, Card, SimpleViewControllerFactory, WebRtcCropPoint } from '../../types/heartwood.types';
|
|
2
2
|
import WebRtcPlayerViewController from '../../viewControllers/webRtcStreaming/WebRtcPlayer.vc';
|
|
3
3
|
declare const webRtcAssert: {
|
|
4
4
|
beforeEach: (views: SimpleViewControllerFactory) => void;
|
|
5
5
|
cardRendersPlayer: (vc: ViewController<Card>, id?: string) => WebRtcPlayerViewController;
|
|
6
|
-
actionCreatesOffer: (vc: WebRtcPlayerViewController, action: () => void | Promise<void>, expectedOptions?: RTCOfferOptions) => Promise<
|
|
6
|
+
actionCreatesOffer: (vc: WebRtcPlayerViewController, action: () => void | Promise<void>, expectedOptions?: RTCOfferOptions) => Promise<string>;
|
|
7
7
|
answerSet: (vc: WebRtcPlayerViewController, answerSdp?: string) => Promise<void>;
|
|
8
|
+
croppingIsEnabled: (vc: WebRtcPlayerViewController) => void;
|
|
9
|
+
croppingIsDisabled: (vc: WebRtcPlayerViewController) => void;
|
|
10
|
+
assertCropEquals: (vc: WebRtcPlayerViewController, expectedCrop?: WebRtcCropPoint) => void;
|
|
8
11
|
};
|
|
9
12
|
export default webRtcAssert;
|
|
10
13
|
export declare class AssertingWebRtcPlayerViewController extends WebRtcPlayerViewController {
|
|
11
14
|
private onCreateOfferHandler?;
|
|
12
15
|
private passedAnswer?;
|
|
16
|
+
static lastGeretateOfferSdp: string;
|
|
13
17
|
onCreateOffer(cb: (offerOptions: RTCOfferOptions) => void): void;
|
|
14
18
|
createOffer(offerOptions: RTCOfferOptions): Promise<string>;
|
|
15
19
|
setAnswer(answerSdp: string): Promise<void>;
|
|
@@ -44,13 +44,31 @@ const webRtcAssert = {
|
|
|
44
44
|
if (expectedOptions) {
|
|
45
45
|
assert.isEqualDeep(passedOptions, expectedOptions, `The options you passed to createOffer did not matching.`);
|
|
46
46
|
}
|
|
47
|
-
assert.isTrue(wasHit, `You did not create an offer. Try 'const offer = await this.
|
|
47
|
+
assert.isTrue(wasHit, `You did not create an offer. Try 'const offer = await this.playerVc.createOffer()'`);
|
|
48
|
+
return AssertingWebRtcPlayerViewController.lastGeretateOfferSdp;
|
|
48
49
|
}),
|
|
49
50
|
answerSet: (vc, answerSdp) => __awaiter(void 0, void 0, void 0, function* () {
|
|
50
51
|
assertOptions({ vc }, ['vc']);
|
|
51
52
|
const assertingVc = assertCalledBeforeEach(vc);
|
|
52
53
|
assertingVc.assertAnswerWasSet(answerSdp);
|
|
53
54
|
}),
|
|
55
|
+
croppingIsEnabled: (vc) => {
|
|
56
|
+
assertOptions({ vc }, ['vc']);
|
|
57
|
+
const model = renderUtil.render(vc);
|
|
58
|
+
const croppingEnabled = model.shouldAllowCropping;
|
|
59
|
+
assert.isTrue(croppingEnabled, `Cropping is not enabled. Make sure you call 'this.playerVc.enableCropping()'`);
|
|
60
|
+
},
|
|
61
|
+
croppingIsDisabled: (vc) => {
|
|
62
|
+
assertOptions({ vc }, ['vc']);
|
|
63
|
+
const model = renderUtil.render(vc);
|
|
64
|
+
const croppingEnabled = model.shouldAllowCropping;
|
|
65
|
+
assert.isFalsy(croppingEnabled, `Cropping is enabled. Make sure you call 'this.playerVc.disableCropping()'`);
|
|
66
|
+
},
|
|
67
|
+
assertCropEquals: (vc, expectedCrop) => {
|
|
68
|
+
assertOptions({ vc }, ['vc']);
|
|
69
|
+
const model = renderUtil.render(vc);
|
|
70
|
+
assert.isEqualDeep(model.crop, expectedCrop, `Crop does not match, make sure you're calling 'this.playerVc.setCrop(...)'`);
|
|
71
|
+
},
|
|
54
72
|
};
|
|
55
73
|
export default webRtcAssert;
|
|
56
74
|
export class AssertingWebRtcPlayerViewController extends WebRtcPlayerViewController {
|
|
@@ -61,7 +79,8 @@ export class AssertingWebRtcPlayerViewController extends WebRtcPlayerViewControl
|
|
|
61
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
62
80
|
var _a;
|
|
63
81
|
(_a = this.onCreateOfferHandler) === null || _a === void 0 ? void 0 : _a.call(this, offerOptions);
|
|
64
|
-
|
|
82
|
+
AssertingWebRtcPlayerViewController.lastGeretateOfferSdp = generateId();
|
|
83
|
+
return AssertingWebRtcPlayerViewController.lastGeretateOfferSdp;
|
|
65
84
|
});
|
|
66
85
|
}
|
|
67
86
|
setAnswer(answerSdp) {
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
-
import { ViewController, Card, SimpleViewControllerFactory } from '../../types/heartwood.types';
|
|
1
|
+
import { ViewController, Card, SimpleViewControllerFactory, WebRtcCropPoint } from '../../types/heartwood.types';
|
|
2
2
|
import WebRtcPlayerViewController from '../../viewControllers/webRtcStreaming/WebRtcPlayer.vc';
|
|
3
3
|
declare const webRtcAssert: {
|
|
4
4
|
beforeEach: (views: SimpleViewControllerFactory) => void;
|
|
5
5
|
cardRendersPlayer: (vc: ViewController<Card>, id?: string) => WebRtcPlayerViewController;
|
|
6
|
-
actionCreatesOffer: (vc: WebRtcPlayerViewController, action: () => void | Promise<void>, expectedOptions?: RTCOfferOptions) => Promise<
|
|
6
|
+
actionCreatesOffer: (vc: WebRtcPlayerViewController, action: () => void | Promise<void>, expectedOptions?: RTCOfferOptions) => Promise<string>;
|
|
7
7
|
answerSet: (vc: WebRtcPlayerViewController, answerSdp?: string) => Promise<void>;
|
|
8
|
+
croppingIsEnabled: (vc: WebRtcPlayerViewController) => void;
|
|
9
|
+
croppingIsDisabled: (vc: WebRtcPlayerViewController) => void;
|
|
10
|
+
assertCropEquals: (vc: WebRtcPlayerViewController, expectedCrop?: WebRtcCropPoint) => void;
|
|
8
11
|
};
|
|
9
12
|
export default webRtcAssert;
|
|
10
13
|
export declare class AssertingWebRtcPlayerViewController extends WebRtcPlayerViewController {
|
|
11
14
|
private onCreateOfferHandler?;
|
|
12
15
|
private passedAnswer?;
|
|
16
|
+
static lastGeretateOfferSdp: string;
|
|
13
17
|
onCreateOffer(cb: (offerOptions: RTCOfferOptions) => void): void;
|
|
14
18
|
createOffer(offerOptions: RTCOfferOptions): Promise<string>;
|
|
15
19
|
setAnswer(answerSdp: string): Promise<void>;
|
|
@@ -41,13 +41,31 @@ const webRtcAssert = {
|
|
|
41
41
|
if (expectedOptions) {
|
|
42
42
|
test_utils_1.assert.isEqualDeep(passedOptions, expectedOptions, `The options you passed to createOffer did not matching.`);
|
|
43
43
|
}
|
|
44
|
-
test_utils_1.assert.isTrue(wasHit, `You did not create an offer. Try 'const offer = await this.
|
|
44
|
+
test_utils_1.assert.isTrue(wasHit, `You did not create an offer. Try 'const offer = await this.playerVc.createOffer()'`);
|
|
45
|
+
return AssertingWebRtcPlayerViewController.lastGeretateOfferSdp;
|
|
45
46
|
},
|
|
46
47
|
answerSet: async (vc, answerSdp) => {
|
|
47
48
|
(0, schema_1.assertOptions)({ vc }, ['vc']);
|
|
48
49
|
const assertingVc = assertCalledBeforeEach(vc);
|
|
49
50
|
assertingVc.assertAnswerWasSet(answerSdp);
|
|
50
51
|
},
|
|
52
|
+
croppingIsEnabled: (vc) => {
|
|
53
|
+
(0, schema_1.assertOptions)({ vc }, ['vc']);
|
|
54
|
+
const model = render_utility_1.default.render(vc);
|
|
55
|
+
const croppingEnabled = model.shouldAllowCropping;
|
|
56
|
+
test_utils_1.assert.isTrue(croppingEnabled, `Cropping is not enabled. Make sure you call 'this.playerVc.enableCropping()'`);
|
|
57
|
+
},
|
|
58
|
+
croppingIsDisabled: (vc) => {
|
|
59
|
+
(0, schema_1.assertOptions)({ vc }, ['vc']);
|
|
60
|
+
const model = render_utility_1.default.render(vc);
|
|
61
|
+
const croppingEnabled = model.shouldAllowCropping;
|
|
62
|
+
test_utils_1.assert.isFalsy(croppingEnabled, `Cropping is enabled. Make sure you call 'this.playerVc.disableCropping()'`);
|
|
63
|
+
},
|
|
64
|
+
assertCropEquals: (vc, expectedCrop) => {
|
|
65
|
+
(0, schema_1.assertOptions)({ vc }, ['vc']);
|
|
66
|
+
const model = render_utility_1.default.render(vc);
|
|
67
|
+
test_utils_1.assert.isEqualDeep(model.crop, expectedCrop, `Crop does not match, make sure you're calling 'this.playerVc.setCrop(...)'`);
|
|
68
|
+
},
|
|
51
69
|
};
|
|
52
70
|
exports.default = webRtcAssert;
|
|
53
71
|
class AssertingWebRtcPlayerViewController extends WebRtcPlayer_vc_1.default {
|
|
@@ -56,7 +74,8 @@ class AssertingWebRtcPlayerViewController extends WebRtcPlayer_vc_1.default {
|
|
|
56
74
|
}
|
|
57
75
|
async createOffer(offerOptions) {
|
|
58
76
|
this.onCreateOfferHandler?.(offerOptions);
|
|
59
|
-
|
|
77
|
+
AssertingWebRtcPlayerViewController.lastGeretateOfferSdp = (0, test_utils_1.generateId)();
|
|
78
|
+
return AssertingWebRtcPlayerViewController.lastGeretateOfferSdp;
|
|
60
79
|
}
|
|
61
80
|
async setAnswer(answerSdp) {
|
|
62
81
|
this.passedAnswer = answerSdp;
|
package/package.json
CHANGED