remotion 3.3.55 → 3.3.56
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/dist/cjs/audio/Audio.d.ts +1 -1
- package/dist/cjs/index.d.ts +1 -0
- package/dist/cjs/internals.d.ts +1 -1
- package/dist/cjs/use-video.d.ts +1 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/version.mjs +1 -1
- package/dist/tsconfig-esm.tsbuildinfo +1 -0
- package/package.json +3 -3
- package/tsconfig-esm.json +12 -0
- package/dist/esm/AbsoluteFill.js +0 -25
- package/dist/esm/CanUseRemotionHooks.js +0 -6
- package/dist/esm/Clipper.js +0 -20
- package/dist/esm/Composition.js +0 -112
- package/dist/esm/CompositionManager.js +0 -137
- package/dist/esm/Folder.js +0 -33
- package/dist/esm/IFrame.js +0 -25
- package/dist/esm/Img.js +0 -53
- package/dist/esm/NativeLayers.js +0 -25
- package/dist/esm/Null.js +0 -21
- package/dist/esm/RemotionRoot.js +0 -69
- package/dist/esm/Sequence.js +0 -128
- package/dist/esm/SequenceContext.js +0 -2
- package/dist/esm/Still.js +0 -9
- package/dist/esm/absolute-src.js +0 -3
- package/dist/esm/asset-types.js +0 -1
- package/dist/esm/audio/Audio.js +0 -53
- package/dist/esm/audio/AudioForDevelopment.js +0 -91
- package/dist/esm/audio/AudioForRendering.js +0 -108
- package/dist/esm/audio/index.js +0 -2
- package/dist/esm/audio/props.js +0 -1
- package/dist/esm/audio/shared-audio-tags.js +0 -194
- package/dist/esm/audio/use-audio-frame.js +0 -18
- package/dist/esm/bezier.js +0 -110
- package/dist/esm/cancel-render.js +0 -43
- package/dist/esm/config/input-props.js +0 -27
- package/dist/esm/config.js +0 -17
- package/dist/esm/default-css.js +0 -44
- package/dist/esm/delay-render.js +0 -72
- package/dist/esm/easing.js +0 -77
- package/dist/esm/freeze.js +0 -34
- package/dist/esm/get-asset-file-name.js +0 -10
- package/dist/esm/get-environment.js +0 -29
- package/dist/esm/get-preview-dom-element.js +0 -3
- package/dist/esm/get-static-files.js +0 -31
- package/dist/esm/get-timeline-clip-name.js +0 -21
- package/dist/esm/index.js +0 -49
- package/dist/esm/internals.js +0 -75
- package/dist/esm/interpolate-colors.js +0 -401
- package/dist/esm/interpolate.js +0 -123
- package/dist/esm/is-approximately-the-same.js +0 -4
- package/dist/esm/is-player.js +0 -9
- package/dist/esm/loading-indicator.js +0 -31
- package/dist/esm/loop/index.js +0 -29
- package/dist/esm/multiple-versions-warning.js +0 -28
- package/dist/esm/nonce.js +0 -13
- package/dist/esm/play-and-handle-not-allowed-error.js +0 -40
- package/dist/esm/portal-node.js +0 -19
- package/dist/esm/prefetch-state.js +0 -22
- package/dist/esm/prefetch.js +0 -107
- package/dist/esm/random.js +0 -37
- package/dist/esm/register-root.js +0 -31
- package/dist/esm/series/flatten-children.js +0 -12
- package/dist/esm/series/index.js +0 -61
- package/dist/esm/setup-env-variables.js +0 -32
- package/dist/esm/spring/index.js +0 -50
- package/dist/esm/spring/measure-spring.js +0 -64
- package/dist/esm/spring/spring-utils.js +0 -99
- package/dist/esm/static-file.js +0 -29
- package/dist/esm/test/Img.test.js +0 -20
- package/dist/esm/test/absolute-src.test.js +0 -16
- package/dist/esm/test/audio-for-rendering.test.js +0 -83
- package/dist/esm/test/audio.test.js +0 -51
- package/dist/esm/test/bezier.test.js +0 -50
- package/dist/esm/test/composition-rules.test.js +0 -28
- package/dist/esm/test/composition-validation.test.js +0 -97
- package/dist/esm/test/easing.test.js +0 -189
- package/dist/esm/test/expect-to-throw.js +0 -11
- package/dist/esm/test/freeze.test.js +0 -63
- package/dist/esm/test/get-asset-file-name.test.js +0 -12
- package/dist/esm/test/get-current-time.test.js +0 -72
- package/dist/esm/test/input-props.test.js +0 -29
- package/dist/esm/test/interpolate.test.js +0 -136
- package/dist/esm/test/interpolateColors.test.js +0 -61
- package/dist/esm/test/loop-validation.test.js +0 -68
- package/dist/esm/test/measure-spring.test.js +0 -43
- package/dist/esm/test/media-validation.test.js +0 -45
- package/dist/esm/test/nested-sequences.test.js +0 -130
- package/dist/esm/test/not-all-props-in-media-tags.test.js +0 -28
- package/dist/esm/test/random.test.js +0 -58
- package/dist/esm/test/ready-manager.test.js +0 -27
- package/dist/esm/test/render-hook.js +0 -20
- package/dist/esm/test/sequence-from-initial-offset.test.js +0 -33
- package/dist/esm/test/sequence-validation.test.js +0 -45
- package/dist/esm/test/series.test.js +0 -113
- package/dist/esm/test/spring.test.js +0 -36
- package/dist/esm/test/truthy.test.js +0 -22
- package/dist/esm/test/use-audio-frame.test.js +0 -53
- package/dist/esm/test/use-media-in-timeline.test.js +0 -49
- package/dist/esm/test/use-media-tag-volume.test.js +0 -44
- package/dist/esm/test/use-sync-volume-with-media-tag.test.js +0 -53
- package/dist/esm/test/validate-start-from-props.test.js +0 -37
- package/dist/esm/test/video.test.js +0 -55
- package/dist/esm/test/volume-prop.test.js +0 -93
- package/dist/esm/test/wrap-sequence-context.js +0 -37
- package/dist/esm/timeline-position-state.js +0 -35
- package/dist/esm/truthy.js +0 -3
- package/dist/esm/use-current-frame.js +0 -23
- package/dist/esm/use-lazy-component.js +0 -22
- package/dist/esm/use-media-in-timeline.js +0 -125
- package/dist/esm/use-media-playback.js +0 -73
- package/dist/esm/use-media-tag-volume.js +0 -27
- package/dist/esm/use-sync-volume-with-media-tag.js +0 -17
- package/dist/esm/use-unsafe-video-config.js +0 -23
- package/dist/esm/use-video-config.js +0 -26
- package/dist/esm/use-video.js +0 -24
- package/dist/esm/validate-frame.js +0 -20
- package/dist/esm/validate-media-props.js +0 -20
- package/dist/esm/validate-start-from-props.js +0 -27
- package/dist/esm/validation/validate-composition-id.js +0 -8
- package/dist/esm/validation/validate-dimensions.js +0 -17
- package/dist/esm/validation/validate-duration-in-frames.js +0 -11
- package/dist/esm/validation/validate-folder-name.js +0 -14
- package/dist/esm/validation/validate-fps.js +0 -17
- package/dist/esm/validation/validate-offthreadvideo-image-format.js +0 -11
- package/dist/esm/validation/validation-spring-duration.js +0 -17
- package/dist/esm/version.js +0 -2
- package/dist/esm/video/OffthreadVideo.js +0 -33
- package/dist/esm/video/OffthreadVideoForRendering.js +0 -100
- package/dist/esm/video/Video.js +0 -51
- package/dist/esm/video/VideoForDevelopment.js +0 -110
- package/dist/esm/video/VideoForRendering.js +0 -200
- package/dist/esm/video/duration-state.js +0 -29
- package/dist/esm/video/get-current-time.js +0 -26
- package/dist/esm/video/index.js +0 -2
- package/dist/esm/video/props.js +0 -1
- package/dist/esm/video/video-fragment.js +0 -55
- package/dist/esm/video-config.js +0 -1
- package/dist/esm/volume-position-state.js +0 -27
- package/dist/esm/volume-prop.js +0 -20
- package/dist/esm/warn-about-non-seekable-media.js +0 -30
- package/dist/esm/wrap-remotion-context.js +0 -45
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'vitest';
|
|
2
|
-
import { measureSpring, spring } from '../spring/index.js';
|
|
3
|
-
import { expectToThrow } from './expect-to-throw.js';
|
|
4
|
-
describe('Measure spring should work', () => {
|
|
5
|
-
const duration = measureSpring({
|
|
6
|
-
fps: 30,
|
|
7
|
-
});
|
|
8
|
-
test('test measureSpring()', () => expect(duration).toBe(28));
|
|
9
|
-
test('spring should be close to 1', () => expect(spring({
|
|
10
|
-
fps: 30,
|
|
11
|
-
frame: duration,
|
|
12
|
-
})).toBeCloseTo(1));
|
|
13
|
-
test('spring should not be 1', () => expect(spring({
|
|
14
|
-
fps: 30,
|
|
15
|
-
frame: duration - 1,
|
|
16
|
-
})).not.toBe(1));
|
|
17
|
-
});
|
|
18
|
-
test('Higher threshold should lead to faster spring', () => {
|
|
19
|
-
expect(measureSpring({ fps: 30, threshold: 0.05 })).toBeLessThan(measureSpring({ fps: 30, threshold: 0.01 }));
|
|
20
|
-
});
|
|
21
|
-
test('Lower threshold should lead to slower spring', () => {
|
|
22
|
-
expect(measureSpring({ fps: 30, threshold: 0.001 })).toBeGreaterThan(measureSpring({ fps: 30, threshold: 0.01 }));
|
|
23
|
-
});
|
|
24
|
-
describe('Threshold edge cases', () => {
|
|
25
|
-
// threshold, expected
|
|
26
|
-
const validEdgeCases = [
|
|
27
|
-
[0, Infinity],
|
|
28
|
-
[1, 0],
|
|
29
|
-
];
|
|
30
|
-
validEdgeCases.forEach((entry) => test('', () => expect(measureSpring({ fps: 30, threshold: entry[0] })).toBe(entry[1])));
|
|
31
|
-
// threshold, errMsg
|
|
32
|
-
const errorEdgeCases = [
|
|
33
|
-
[NaN, /Threshold is NaN/],
|
|
34
|
-
[Infinity, /Threshold is not finite/],
|
|
35
|
-
[null, /threshold must be a number, got null of type object/],
|
|
36
|
-
];
|
|
37
|
-
errorEdgeCases.forEach((entry) => expectToThrow(
|
|
38
|
-
// @ts-expect-error
|
|
39
|
-
() => measureSpring({ fps: 30, threshold: entry[0] }), entry[1]));
|
|
40
|
-
});
|
|
41
|
-
test('Should throw on invalid FPS', () => {
|
|
42
|
-
expectToThrow(() => measureSpring({ fps: 0 }), /"fps" must be positive, but got 0./);
|
|
43
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'vitest';
|
|
2
|
-
import { validateMediaProps } from '../validate-media-props.js';
|
|
3
|
-
import { expectToThrow } from './expect-to-throw.js';
|
|
4
|
-
describe('ValidateMediaProps should throw with invalid volume inputs', () => {
|
|
5
|
-
const testComponents = ['Audio', 'Video'];
|
|
6
|
-
testComponents.forEach((component) => {
|
|
7
|
-
test(`It should not allow an ${component} element to have a negative volume `, () => {
|
|
8
|
-
expectToThrow(
|
|
9
|
-
// @ts-expect-error
|
|
10
|
-
() => validateMediaProps({ volume: -1 }, component), new RegExp(`You have passed a volume below 0 to your <${component} /> component. Volume must be between 0 and 1`));
|
|
11
|
-
});
|
|
12
|
-
test(`It should not allow an ${component} element to have an invalid type`, () => {
|
|
13
|
-
expectToThrow(
|
|
14
|
-
// @ts-expect-error
|
|
15
|
-
() => validateMediaProps({ volume: 'invalidType' }, component), new RegExp(`You have passed a volume of type string to your <${component} /> component.`));
|
|
16
|
-
});
|
|
17
|
-
});
|
|
18
|
-
});
|
|
19
|
-
describe('ValidateMediaProps should not throw with valid volume inputs', () => {
|
|
20
|
-
const validInputs = [
|
|
21
|
-
0,
|
|
22
|
-
1,
|
|
23
|
-
undefined,
|
|
24
|
-
() => 1,
|
|
25
|
-
(x) => x,
|
|
26
|
-
];
|
|
27
|
-
validInputs.forEach((vol) => test(`valid volume ${vol} shold not throw`, () => {
|
|
28
|
-
// @ts-expect-error
|
|
29
|
-
expect(() => validateMediaProps({ volume: vol }, 'Video')).not.toThrow();
|
|
30
|
-
}));
|
|
31
|
-
});
|
|
32
|
-
describe('ValidateMediaProps should throw with invalid playbackRate', () => {
|
|
33
|
-
test(`It should not allow playbackRate of 0 or below.`, () => {
|
|
34
|
-
expectToThrow(() => validateMediaProps({ playbackRate: -1 }, 'Audio'), /You have passed a playbackRate of -1 to your <Audio \/> component. Playback rate must be a real number above 0./);
|
|
35
|
-
});
|
|
36
|
-
test(`It should not allow non-finite playbackRate.`, () => {
|
|
37
|
-
expectToThrow(() => validateMediaProps({ playbackRate: Infinity }, 'Audio'), /You have passed a playbackRate of Infinity to your <Audio \/> component. Playback rate must be a real number above 0./);
|
|
38
|
-
});
|
|
39
|
-
test(`It should not allow NaN playbackRate.`, () => {
|
|
40
|
-
expectToThrow(() => validateMediaProps({ playbackRate: NaN }, 'Audio'), /You have passed a playbackRate of NaN to your <Audio \/> component. Playback rate must be a real number above 0./);
|
|
41
|
-
});
|
|
42
|
-
test(`It should not allow regular playbackrate.`, () => {
|
|
43
|
-
expect(() => validateMediaProps({ playbackRate: 1 }, 'Audio')).not.toThrow();
|
|
44
|
-
});
|
|
45
|
-
});
|
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @vitest-environment jsdom
|
|
4
|
-
*/
|
|
5
|
-
/* eslint-disable react/jsx-no-constructed-context-values */
|
|
6
|
-
import { render } from '@testing-library/react';
|
|
7
|
-
import { expect, test } from 'vitest';
|
|
8
|
-
import { CanUseRemotionHooksProvider } from '../CanUseRemotionHooks.js';
|
|
9
|
-
import { Sequence } from '../Sequence.js';
|
|
10
|
-
import { TimelineContext } from '../timeline-position-state.js';
|
|
11
|
-
import { useCurrentFrame } from '../use-current-frame.js';
|
|
12
|
-
import { WrapSequenceContext } from './wrap-sequence-context.js';
|
|
13
|
-
test('It should calculate the correct offset in nested sequences', () => {
|
|
14
|
-
const NestedChild = () => {
|
|
15
|
-
const frame = useCurrentFrame();
|
|
16
|
-
return _jsx("div", { children: 'frame' + frame });
|
|
17
|
-
};
|
|
18
|
-
const Child = () => {
|
|
19
|
-
return (_jsx(Sequence, { from: 10, durationInFrames: 50, children: _jsx(Child2, {}) }));
|
|
20
|
-
};
|
|
21
|
-
const Child2 = () => {
|
|
22
|
-
return (_jsx(Sequence, { from: 1, durationInFrames: 50, children: _jsx(NestedChild, {}) }));
|
|
23
|
-
};
|
|
24
|
-
const { queryByText } = render(_jsx(WrapSequenceContext, { children: _jsx(TimelineContext.Provider, { value: {
|
|
25
|
-
rootId: 'hi',
|
|
26
|
-
frame: 40,
|
|
27
|
-
playing: false,
|
|
28
|
-
imperativePlaying: {
|
|
29
|
-
current: false,
|
|
30
|
-
},
|
|
31
|
-
playbackRate: 1,
|
|
32
|
-
setPlaybackRate: () => {
|
|
33
|
-
throw new Error('playback rate');
|
|
34
|
-
},
|
|
35
|
-
audioAndVideoTags: {
|
|
36
|
-
current: [],
|
|
37
|
-
},
|
|
38
|
-
}, children: _jsx(Sequence, { from: 20, durationInFrames: 100, children: _jsx(Child, {}) }) }) }));
|
|
39
|
-
expect(queryByText(/^frame9$/i)).not.toBe(null);
|
|
40
|
-
});
|
|
41
|
-
test('Negative offset test', () => {
|
|
42
|
-
const NestedChild = () => {
|
|
43
|
-
const frame = useCurrentFrame();
|
|
44
|
-
return _jsx("div", { children: 'frame' + frame });
|
|
45
|
-
};
|
|
46
|
-
const { queryByText } = render(_jsx(WrapSequenceContext, { children: _jsx(TimelineContext.Provider, { value: {
|
|
47
|
-
frame: 40,
|
|
48
|
-
playing: false,
|
|
49
|
-
rootId: 'hi',
|
|
50
|
-
imperativePlaying: {
|
|
51
|
-
current: false,
|
|
52
|
-
},
|
|
53
|
-
playbackRate: 1,
|
|
54
|
-
setPlaybackRate: () => {
|
|
55
|
-
throw new Error('playback rate');
|
|
56
|
-
},
|
|
57
|
-
audioAndVideoTags: {
|
|
58
|
-
current: [],
|
|
59
|
-
},
|
|
60
|
-
}, children: _jsx(Sequence, { from: -200, durationInFrames: 300, children: _jsx(Sequence, { from: 10, durationInFrames: 300, children: _jsx(Sequence, { from: 10, durationInFrames: 300, children: _jsx(NestedChild, {}) }) }) }) }) }));
|
|
61
|
-
const result = queryByText(/^frame220/i);
|
|
62
|
-
expect(result).not.toBe(null);
|
|
63
|
-
});
|
|
64
|
-
test('Nested negative offset test', () => {
|
|
65
|
-
const NestedChild = () => {
|
|
66
|
-
const frame = useCurrentFrame();
|
|
67
|
-
return _jsx("div", { children: 'frame' + frame });
|
|
68
|
-
};
|
|
69
|
-
const startFrom = 40;
|
|
70
|
-
const endAt = 90;
|
|
71
|
-
const content = (_jsx(WrapSequenceContext, { children: _jsx(Sequence, { from: 0 - startFrom, durationInFrames: endAt, children: _jsx(NestedChild, {}) }) }));
|
|
72
|
-
const getForFrame = (frame) => {
|
|
73
|
-
const { queryByText } = render(_jsx(WrapSequenceContext, { children: _jsx(TimelineContext.Provider, { value: {
|
|
74
|
-
frame,
|
|
75
|
-
playing: false,
|
|
76
|
-
rootId: 'hi',
|
|
77
|
-
imperativePlaying: {
|
|
78
|
-
current: false,
|
|
79
|
-
},
|
|
80
|
-
playbackRate: 1,
|
|
81
|
-
setPlaybackRate: () => {
|
|
82
|
-
throw new Error('playback rate');
|
|
83
|
-
},
|
|
84
|
-
audioAndVideoTags: {
|
|
85
|
-
current: [],
|
|
86
|
-
},
|
|
87
|
-
}, children: content }) }));
|
|
88
|
-
return queryByText;
|
|
89
|
-
};
|
|
90
|
-
const frame0 = getForFrame(0);
|
|
91
|
-
expect(frame0(/^frame40$/i)).not.toBe(null);
|
|
92
|
-
const frame39 = getForFrame(39);
|
|
93
|
-
expect(frame39(/^frame79$/i)).not.toBe(null);
|
|
94
|
-
const frame50 = getForFrame(50);
|
|
95
|
-
expect(frame50(/^frame90$/i)).toBe(null);
|
|
96
|
-
});
|
|
97
|
-
test.skip('Negative offset edge case', () => {
|
|
98
|
-
const NestedChild = () => {
|
|
99
|
-
const frame = useCurrentFrame();
|
|
100
|
-
return _jsx("div", { children: 'frame' + frame });
|
|
101
|
-
};
|
|
102
|
-
const startFrom = 40;
|
|
103
|
-
const endAt = 90;
|
|
104
|
-
const content = (_jsx(WrapSequenceContext, { children: _jsx(Sequence, { from: 40, children: _jsx(Sequence, { from: 0 - startFrom, durationInFrames: endAt, children: _jsx(NestedChild, {}) }) }) }));
|
|
105
|
-
const getForFrame = (frame) => {
|
|
106
|
-
const { queryByText } = render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(TimelineContext.Provider, { value: {
|
|
107
|
-
frame,
|
|
108
|
-
playing: false,
|
|
109
|
-
rootId: 'hi',
|
|
110
|
-
imperativePlaying: {
|
|
111
|
-
current: false,
|
|
112
|
-
},
|
|
113
|
-
playbackRate: 1,
|
|
114
|
-
setPlaybackRate: () => {
|
|
115
|
-
throw new Error('playback rate');
|
|
116
|
-
},
|
|
117
|
-
audioAndVideoTags: {
|
|
118
|
-
current: [],
|
|
119
|
-
},
|
|
120
|
-
}, children: content }) }));
|
|
121
|
-
return queryByText;
|
|
122
|
-
};
|
|
123
|
-
expect(getForFrame(0)(/^frame0/i)).toBe(null);
|
|
124
|
-
expect(getForFrame(10)(/^frame10/i)).toBe(null);
|
|
125
|
-
expect(getForFrame(40)(/^frame40$/i)).not.toBe(null);
|
|
126
|
-
const atFrame80 = getForFrame(80)(/^frame80$/i);
|
|
127
|
-
expect(atFrame80).not.toBe(null);
|
|
128
|
-
const atFrame90 = getForFrame(90)(/^frame90$/i);
|
|
129
|
-
expect(atFrame90).toBe(null);
|
|
130
|
-
});
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import fs from 'fs';
|
|
2
|
-
import path from 'path';
|
|
3
|
-
import { expect, test } from 'vitest';
|
|
4
|
-
// Test for https://github.com/remotion-dev/remotion/issues/1243
|
|
5
|
-
test('Should not have disableRemotePlayback props in the <VideoForDevelopment> component type definition', () => {
|
|
6
|
-
const file = path.resolve(process.cwd(), 'dist', 'esm', 'video', 'VideoForDevelopment.d.ts');
|
|
7
|
-
const read = fs.readFileSync(file, 'utf-8');
|
|
8
|
-
expect(read).not.toContain('disableRemotePlayback');
|
|
9
|
-
expect(read).toContain('volume-prop');
|
|
10
|
-
});
|
|
11
|
-
test('Should not have disableRemotePlayback props in the <VideoForRendering> component type definition', () => {
|
|
12
|
-
const file = path.resolve(process.cwd(), 'dist', 'esm', 'video', 'VideoForRendering.d.ts');
|
|
13
|
-
const read = fs.readFileSync(file, 'utf-8');
|
|
14
|
-
expect(read).not.toContain('disableRemotePlayback');
|
|
15
|
-
expect(read).toContain('volume-prop');
|
|
16
|
-
});
|
|
17
|
-
test('Should not have disableRemotePlayback props in the <AudioForDevelopment> component type definition', () => {
|
|
18
|
-
const file = path.resolve(process.cwd(), 'dist', 'esm', 'audio', 'AudioForDevelopment.d.ts');
|
|
19
|
-
const read = fs.readFileSync(file, 'utf-8');
|
|
20
|
-
expect(read).not.toContain('aria-disabled');
|
|
21
|
-
expect(read).toContain('volume-prop');
|
|
22
|
-
});
|
|
23
|
-
test('Should not have disableRemotePlayback props in the <AudioForRendering> component type definition', () => {
|
|
24
|
-
const file = path.resolve(process.cwd(), 'dist', 'esm', 'audio', 'AudioForRendering.d.ts');
|
|
25
|
-
const read = fs.readFileSync(file, 'utf-8');
|
|
26
|
-
expect(read).not.toContain('aria-disabled');
|
|
27
|
-
expect(read).toContain('volume-prop');
|
|
28
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from 'vitest';
|
|
2
|
-
import { random } from '../random.js';
|
|
3
|
-
describe('Should support negative random numbers', () => {
|
|
4
|
-
test('test with -1', () => expect(random(-1)).toBe(random(-1)));
|
|
5
|
-
test('test with -2', () => expect(random(-2)).toBe(random(-2)));
|
|
6
|
-
test('different seeds should be different randoms', () => expect(random(-2)).not.toBe(random(-1)));
|
|
7
|
-
});
|
|
8
|
-
test('Random should be deterministic', () => {
|
|
9
|
-
expect(random(1)).toBe(random(1));
|
|
10
|
-
expect(random(2)).toBe(random(2));
|
|
11
|
-
expect(random(2)).not.toBe(random(1));
|
|
12
|
-
expect(random(null)).not.toBe(random(null));
|
|
13
|
-
});
|
|
14
|
-
describe('Random should be uniform', () => {
|
|
15
|
-
const ITEM_COUNT = 100000;
|
|
16
|
-
const mapped = new Array(ITEM_COUNT).fill(true).map((_a, i) => {
|
|
17
|
-
return random(i);
|
|
18
|
-
});
|
|
19
|
-
const average = mapped.reduce((a, b) => a + b, 0) / mapped.length;
|
|
20
|
-
test('test if average is around 0.5', () => {
|
|
21
|
-
expect(average).toBeLessThan(0.51);
|
|
22
|
-
expect(average).toBeGreaterThan(0.49);
|
|
23
|
-
});
|
|
24
|
-
const tenPercentSections = [];
|
|
25
|
-
const stepInterval = 0.1;
|
|
26
|
-
let currentStep = 0;
|
|
27
|
-
while (currentStep < 0.999999) {
|
|
28
|
-
const items = mapped.filter((m) => m >= currentStep && m <= currentStep + stepInterval);
|
|
29
|
-
tenPercentSections.push(items);
|
|
30
|
-
currentStep += stepInterval;
|
|
31
|
-
}
|
|
32
|
-
const ACCURACY = 0.005;
|
|
33
|
-
tenPercentSections.forEach((entries, index) => test(`section ${index} should contain around ${ITEM_COUNT * stepInterval} entries`, () => {
|
|
34
|
-
expect(entries.length).toBeLessThan(ITEM_COUNT * (stepInterval + ACCURACY));
|
|
35
|
-
expect(entries.length).toBeGreaterThan(ITEM_COUNT * (stepInterval - ACCURACY));
|
|
36
|
-
}));
|
|
37
|
-
test('test for average distance', () => {
|
|
38
|
-
const distances = mapped
|
|
39
|
-
.map((_a, i) => {
|
|
40
|
-
if (i === 0) {
|
|
41
|
-
return null;
|
|
42
|
-
}
|
|
43
|
-
return Math.abs(mapped[i] - mapped[i - 1]);
|
|
44
|
-
})
|
|
45
|
-
.filter((f) => f !== null);
|
|
46
|
-
const averageDistance = distances.reduce((a, b) => a + b, 0) / distances.length;
|
|
47
|
-
expect(averageDistance).toBeGreaterThan(0.3);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
test('Random string should be uniform', () => {
|
|
51
|
-
const alphabet = 'abcdefghijlkmnopqrstuvwxyz0123456789';
|
|
52
|
-
const array = new Array(alphabet.length)
|
|
53
|
-
.fill(true)
|
|
54
|
-
.map((_, i) => random(alphabet[i]));
|
|
55
|
-
const average = array.reduce((a, b) => a + b, 0) / array.length;
|
|
56
|
-
expect(average).toBeLessThan(0.55);
|
|
57
|
-
expect(average).toBeGreaterThan(0.45);
|
|
58
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @vitest-environment jsdom
|
|
3
|
-
*/
|
|
4
|
-
import { describe, expect, test } from 'vitest';
|
|
5
|
-
import { continueRender, delayRender } from '../delay-render.js';
|
|
6
|
-
describe('Ready Manager tests', () => {
|
|
7
|
-
let handle;
|
|
8
|
-
test('delayRender sets window.ready to false', () => {
|
|
9
|
-
window.ready = true;
|
|
10
|
-
handle = delayRender();
|
|
11
|
-
expect(typeof handle).toBe('number');
|
|
12
|
-
expect(window.ready).toBe(false);
|
|
13
|
-
});
|
|
14
|
-
test('continueRender sets window.ready to true', () => {
|
|
15
|
-
continueRender(handle);
|
|
16
|
-
expect(window.ready).toBe(true);
|
|
17
|
-
});
|
|
18
|
-
test('Render is only continued if all handles have been finished', () => {
|
|
19
|
-
handle = delayRender();
|
|
20
|
-
const handle2 = delayRender();
|
|
21
|
-
expect(window.ready).toBe(false);
|
|
22
|
-
continueRender(handle);
|
|
23
|
-
expect(window.ready).toBe(false);
|
|
24
|
-
continueRender(handle2);
|
|
25
|
-
expect(window.ready).toBe(true);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { render } from '@testing-library/react';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
export function renderHook(renderCallback, options = {}) {
|
|
5
|
-
const { initialProps, wrapper } = options;
|
|
6
|
-
const result = React.createRef();
|
|
7
|
-
const TestComponent = ({ renderCallbackProps, }) => {
|
|
8
|
-
const pendingResult = renderCallback(renderCallbackProps);
|
|
9
|
-
React.useEffect(() => {
|
|
10
|
-
// @ts-expect-error
|
|
11
|
-
result.current = pendingResult;
|
|
12
|
-
});
|
|
13
|
-
return null;
|
|
14
|
-
};
|
|
15
|
-
const { rerender: baseRerender, unmount } = render(_jsx(TestComponent, { renderCallbackProps: initialProps }), { wrapper });
|
|
16
|
-
function rerender(rerenderCallbackProps) {
|
|
17
|
-
return baseRerender(_jsx(TestComponent, { renderCallbackProps: rerenderCallbackProps }));
|
|
18
|
-
}
|
|
19
|
-
return { result, rerender, unmount };
|
|
20
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @vitest-environment jsdom
|
|
4
|
-
*/
|
|
5
|
-
import { render } from '@testing-library/react';
|
|
6
|
-
import { describe, expect, test } from 'vitest';
|
|
7
|
-
import { CanUseRemotionHooksProvider } from '../CanUseRemotionHooks.js';
|
|
8
|
-
import { Freeze } from '../freeze.js';
|
|
9
|
-
import { Internals } from '../internals.js';
|
|
10
|
-
import { Sequence } from '../Sequence.js';
|
|
11
|
-
import { useVideoConfig } from '../use-video-config.js';
|
|
12
|
-
import { WrapSequenceContext } from './wrap-sequence-context.js';
|
|
13
|
-
const Inner = () => {
|
|
14
|
-
const config = useVideoConfig();
|
|
15
|
-
return _jsx("div", { children: config.durationInFrames });
|
|
16
|
-
};
|
|
17
|
-
const context = {
|
|
18
|
-
audioAndVideoTags: { current: [] },
|
|
19
|
-
frame: 10000,
|
|
20
|
-
imperativePlaying: {
|
|
21
|
-
current: false,
|
|
22
|
-
},
|
|
23
|
-
playbackRate: 0,
|
|
24
|
-
playing: false,
|
|
25
|
-
rootId: 'hither',
|
|
26
|
-
setPlaybackRate: () => undefined,
|
|
27
|
-
};
|
|
28
|
-
describe('Composition-validation render should NOT throw with valid props', () => {
|
|
29
|
-
test('It should allow undefined as children', () => {
|
|
30
|
-
const { queryByText } = render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(WrapSequenceContext, { children: _jsx(Internals.Timeline.TimelineContext.Provider, { value: context, children: _jsx(Freeze, { frame: 10000, children: _jsx(Sequence, { durationInFrames: 2424, from: 9265, children: _jsx(Inner, {}) }) }) }) }) }));
|
|
31
|
-
expect(queryByText(/^0$/)).not.toBe(null);
|
|
32
|
-
});
|
|
33
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/**
|
|
3
|
-
* @vitest-environment jsdom
|
|
4
|
-
*/
|
|
5
|
-
import { render } from '@testing-library/react';
|
|
6
|
-
import { describe, expect, test } from 'vitest';
|
|
7
|
-
import { CanUseRemotionHooksProvider } from '../CanUseRemotionHooks.js';
|
|
8
|
-
import { Sequence } from '../Sequence.js';
|
|
9
|
-
import { expectToThrow } from './expect-to-throw.js';
|
|
10
|
-
import { WrapSequenceContext } from './wrap-sequence-context.js';
|
|
11
|
-
describe('Composition-validation render should throw with invalid props', () => {
|
|
12
|
-
describe('Throw with invalid duration props', () => {
|
|
13
|
-
test('It should throw if Sequence has non-integer durationInFrames', () => {
|
|
14
|
-
expectToThrow(() => render(_jsx(Sequence, { from: 0, durationInFrames: 1.1, children: "hi" })), /The "durationInFrames" of a sequence must be an integer, but got 1.1./);
|
|
15
|
-
});
|
|
16
|
-
test('It should throw if Sequence has negative duration', () => {
|
|
17
|
-
expectToThrow(
|
|
18
|
-
// @ts-expect-error
|
|
19
|
-
() => render(_jsx(Sequence, { from: 0, durationInFrames: -1 })), /durationInFrames must be positive, but got -1/);
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
describe('Throw with invalid from props', () => {
|
|
23
|
-
test('It should throw if "from" props is not a number', () => {
|
|
24
|
-
expectToThrow(
|
|
25
|
-
// @ts-expect-error
|
|
26
|
-
() => render(_jsx(Sequence, { from: '0', durationInFrames: 30 })), /You passed to the "from" props of your <Sequence> an argument of type string, but it must be a number./);
|
|
27
|
-
});
|
|
28
|
-
test('It should throw if Sequence has non-integer from', () => {
|
|
29
|
-
expectToThrow(() => render(_jsx(Sequence, { from: 0.1, durationInFrames: 1, children: "hi" })), /The "from" prop of a sequence must be an integer, but got 0.1./);
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
test('It should throw for invalid layout value', () => {
|
|
33
|
-
expectToThrow(() => render(
|
|
34
|
-
// @ts-expect-error
|
|
35
|
-
_jsx(Sequence, { from: 0, durationInFrames: 100, layout: 'invalid-value' })), /The layout prop of <Sequence \/> expects either "absolute-fill" or "none", but you passed: invalid-value/);
|
|
36
|
-
});
|
|
37
|
-
});
|
|
38
|
-
describe('Composition-validation render should NOT throw with valid props', () => {
|
|
39
|
-
test('It should allow null as children', () => {
|
|
40
|
-
expect(() => render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(WrapSequenceContext, { children: _jsx(Sequence, { durationInFrames: 100, from: 0, children: null }) }) }))).not.toThrow();
|
|
41
|
-
});
|
|
42
|
-
test('It should allow undefined as children', () => {
|
|
43
|
-
expect(() => render(_jsx(CanUseRemotionHooksProvider, { children: _jsx(WrapSequenceContext, { children: _jsx(Sequence, { durationInFrames: 100, from: 0, children: undefined }) }) }))).not.toThrow();
|
|
44
|
-
});
|
|
45
|
-
});
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { renderToString } from 'react-dom/server';
|
|
3
|
-
import { expect, test } from 'vitest';
|
|
4
|
-
import { CanUseRemotionHooksProvider } from '../CanUseRemotionHooks.js';
|
|
5
|
-
import { Series } from '../series/index.js';
|
|
6
|
-
import { TimelineContext } from '../timeline-position-state.js';
|
|
7
|
-
import { useCurrentFrame } from '../use-current-frame.js';
|
|
8
|
-
import { WrapSequenceContext } from './wrap-sequence-context.js';
|
|
9
|
-
const First = () => {
|
|
10
|
-
const frame = useCurrentFrame();
|
|
11
|
-
return _jsx("div", { children: 'first ' + frame });
|
|
12
|
-
};
|
|
13
|
-
const Second = () => {
|
|
14
|
-
const frame = useCurrentFrame();
|
|
15
|
-
return _jsx("div", { children: 'second ' + frame });
|
|
16
|
-
};
|
|
17
|
-
const Third = () => {
|
|
18
|
-
const frame = useCurrentFrame();
|
|
19
|
-
return _jsx("div", { children: 'third ' + frame });
|
|
20
|
-
};
|
|
21
|
-
const renderForFrame = (frame, markup) => {
|
|
22
|
-
return renderToString(_jsx(CanUseRemotionHooksProvider, { children: _jsx(TimelineContext.Provider, { value: {
|
|
23
|
-
rootId: '',
|
|
24
|
-
frame,
|
|
25
|
-
playing: false,
|
|
26
|
-
imperativePlaying: {
|
|
27
|
-
current: false,
|
|
28
|
-
},
|
|
29
|
-
playbackRate: 1,
|
|
30
|
-
setPlaybackRate: () => {
|
|
31
|
-
throw new Error('playback rate');
|
|
32
|
-
},
|
|
33
|
-
audioAndVideoTags: { current: [] },
|
|
34
|
-
}, children: markup }) }));
|
|
35
|
-
};
|
|
36
|
-
test('Basic series test', () => {
|
|
37
|
-
const outerHTML = renderForFrame(10, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(First, {}) }), _jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(Second, {}) }), _jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(Third, {}) })] }) }));
|
|
38
|
-
expect(outerHTML).toBe('<div style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;display:flex"><div>third 0</div></div>');
|
|
39
|
-
});
|
|
40
|
-
test('Should support fragments', () => {
|
|
41
|
-
const outerHtml = renderForFrame(10, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(First, {}) }), _jsxs(_Fragment, { children: [_jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(Second, {}) }, "0"), _jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(Third, {}) }, "1")] })] }) }));
|
|
42
|
-
expect(outerHtml).not.toBe('<div style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;display:flex"><div>second 1</div></div>');
|
|
43
|
-
});
|
|
44
|
-
test('Should not allow foreign elements', () => {
|
|
45
|
-
expect(() => {
|
|
46
|
-
renderForFrame(0, _jsx(WrapSequenceContext, { children: _jsx(Series, { children: _jsx(First, {}) }) }));
|
|
47
|
-
}).toThrow(/only accepts a/);
|
|
48
|
-
});
|
|
49
|
-
test('Should allow layout prop', () => {
|
|
50
|
-
const outerHTML = renderForFrame(0, _jsx(WrapSequenceContext, { children: _jsx(Series, { children: _jsx(Series.Sequence, { durationInFrames: 1, children: _jsx(First, {}) }) }) }));
|
|
51
|
-
expect(outerHTML).toBe('<div style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;display:flex"><div>first 0</div></div>');
|
|
52
|
-
const outerHTML2 = renderForFrame(0, _jsx(WrapSequenceContext, { children: _jsx(Series, { children: _jsx(Series.Sequence, { durationInFrames: 1, layout: "none", children: _jsx(First, {}) }) }) }));
|
|
53
|
-
expect(outerHTML2).toBe('<div>first 0</div>');
|
|
54
|
-
});
|
|
55
|
-
test('Should render nothing after the end', () => {
|
|
56
|
-
const outerHTML = renderForFrame(10, _jsx(WrapSequenceContext, { children: _jsx(Series, { children: _jsx(Series.Sequence, { durationInFrames: 1, children: _jsx(First, {}) }) }) }));
|
|
57
|
-
expect(outerHTML).toBe('');
|
|
58
|
-
});
|
|
59
|
-
test('Should throw if invalid or no duration provided', () => {
|
|
60
|
-
expect(() => {
|
|
61
|
-
renderForFrame(10, _jsx(Series, { children: _jsx(Series.Sequence, { durationInFrames: NaN, children: _jsx(First, {}) }) }));
|
|
62
|
-
}).toThrow(/The "durationInFrames" prop of a <Series.Sequence \/> component must be an integer, but got NaN./);
|
|
63
|
-
expect(() => {
|
|
64
|
-
renderForFrame(10, _jsx(Series, { children: _jsx(Series.Sequence, { children: _jsx(First, {}) }) }));
|
|
65
|
-
}).toThrow(/The "durationInFrames" prop of a <Series.Sequence \/> component must be a number, but you passed a value of type undefined/);
|
|
66
|
-
});
|
|
67
|
-
test('Should allow whitespace', () => {
|
|
68
|
-
const outerHtml = renderForFrame(11, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 10, children: _jsx(First, {}) }), ' ', _jsx(Series.Sequence, { durationInFrames: 10, children: _jsx(Second, {}) })] }) }));
|
|
69
|
-
expect(outerHtml).toBe('<div style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;display:flex"><div>second 1</div></div>');
|
|
70
|
-
});
|
|
71
|
-
test('Handle empty Series.Sequence', () => {
|
|
72
|
-
expect(() => renderForFrame(11, _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 10, children: _jsx(First, {}) }), _jsx(Series.Sequence, { durationInFrames: 10 })] }))).toThrow(/A <Series.Sequence \/> component \(index = 1, duration = 10\) was detected to not have any children\. Delete it to fix this error\./);
|
|
73
|
-
});
|
|
74
|
-
test('Should allow negative overlap prop', () => {
|
|
75
|
-
const outerHTML = renderForFrame(4, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, layout: "none", children: _jsx(First, {}) }), _jsx(Series.Sequence, { offset: -1, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) })] }) }));
|
|
76
|
-
expect(outerHTML).toBe('<div>first 4</div><div>second 0</div>');
|
|
77
|
-
});
|
|
78
|
-
test('Should allow positive overlap prop', () => {
|
|
79
|
-
const outerHTML = renderForFrame(5, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, layout: "none", children: _jsx(First, {}) }), _jsx(Series.Sequence, { offset: 1, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) })] }) }));
|
|
80
|
-
expect(outerHTML).toBe('');
|
|
81
|
-
});
|
|
82
|
-
test('Should disallow NaN as offset prop', () => {
|
|
83
|
-
expect(() => {
|
|
84
|
-
renderForFrame(9, _jsx(Series, { children: _jsx(Series.Sequence, { offset: NaN, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) }) }));
|
|
85
|
-
}).toThrow(/The "offset" property of a <Series.Sequence \/> must not be NaN, but got NaN \(index = 0, duration = 5\)\./);
|
|
86
|
-
});
|
|
87
|
-
test('Should disallow Infinity as offset prop', () => {
|
|
88
|
-
expect(() => {
|
|
89
|
-
renderForFrame(9, _jsx(Series, { children: _jsx(Series.Sequence, { offset: Infinity, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) }) }));
|
|
90
|
-
}).toThrow(/The "offset" property of a <Series.Sequence \/> must be finite, but got Infinity \(index = 0, duration = 5\)\./);
|
|
91
|
-
});
|
|
92
|
-
test('Should disallow non-integer numbers as offset prop', () => {
|
|
93
|
-
expect(() => {
|
|
94
|
-
renderForFrame(9, _jsx(Series, { children: _jsx(Series.Sequence, { offset: Math.PI, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) }) }));
|
|
95
|
-
}).toThrow(/The "offset" property of a <Series.Sequence \/> must be finite, but got 3.141592653589793 \(index = 0, duration = 5\)\./);
|
|
96
|
-
});
|
|
97
|
-
test('Should cascade negative offset props', () => {
|
|
98
|
-
const outerHTML = renderForFrame(9, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, layout: "none", children: _jsx(First, {}) }), _jsx(Series.Sequence, { offset: -1, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) }), _jsx(Series.Sequence, { layout: "none", durationInFrames: 5, children: _jsx(Third, {}) })] }) }));
|
|
99
|
-
expect(outerHTML).toBe('<div>third 0</div>');
|
|
100
|
-
});
|
|
101
|
-
test('Should cascade positive offset props', () => {
|
|
102
|
-
const outerHTML = renderForFrame(11, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, layout: "none", children: _jsx(First, {}) }), _jsx(Series.Sequence, { offset: 1, layout: "none", durationInFrames: 5, children: _jsx(Second, {}) }), _jsx(Series.Sequence, { layout: "none", durationInFrames: 5, children: _jsx(Third, {}) })] }) }));
|
|
103
|
-
expect(outerHTML).toBe('<div>third 0</div>');
|
|
104
|
-
});
|
|
105
|
-
test('Allow durationInFrames as Infinity for last Series.Sequence', () => {
|
|
106
|
-
const outerHTML = renderForFrame(10, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(First, {}) }), _jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(Second, {}) }), _jsx(Series.Sequence, { durationInFrames: Infinity, children: _jsx(Third, {}) })] }) }));
|
|
107
|
-
expect(outerHTML).toBe('<div style="position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;display:flex"><div>third 0</div></div>');
|
|
108
|
-
});
|
|
109
|
-
test('Disallow durationInFrames as Infinity for first n-1 Series.Sequence', () => {
|
|
110
|
-
expect(() => {
|
|
111
|
-
renderForFrame(10, _jsx(WrapSequenceContext, { children: _jsxs(Series, { children: [_jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(First, {}) }), _jsx(Series.Sequence, { durationInFrames: Infinity, children: _jsx(Second, {}) }), _jsx(Series.Sequence, { durationInFrames: 5, children: _jsx(Third, {}) })] }) }));
|
|
112
|
-
}).toThrow(/The "durationInFrames" prop of a <Series.Sequence \/> component must be an integer, but got Infinity\./);
|
|
113
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { expect, test } from 'vitest';
|
|
2
|
-
import { isApproximatelyTheSame } from '../is-approximately-the-same.js';
|
|
3
|
-
import { spring } from '../spring/index.js';
|
|
4
|
-
test('Basic spring to equal 0', () => {
|
|
5
|
-
expect(spring({
|
|
6
|
-
fps: 30,
|
|
7
|
-
frame: 0,
|
|
8
|
-
})).toEqual(0);
|
|
9
|
-
});
|
|
10
|
-
test('Basic spring to equal 1', () => {
|
|
11
|
-
expect(spring({
|
|
12
|
-
fps: 30,
|
|
13
|
-
frame: 0,
|
|
14
|
-
from: 1,
|
|
15
|
-
to: 0,
|
|
16
|
-
})).toEqual(1);
|
|
17
|
-
});
|
|
18
|
-
test('Should be approxmiately the same', () => {
|
|
19
|
-
expect(isApproximatelyTheSame(spring({
|
|
20
|
-
fps: 30,
|
|
21
|
-
frame: 1,
|
|
22
|
-
}), 0.04941510804510185)).toBe(true);
|
|
23
|
-
});
|
|
24
|
-
test('Should be close to 1', () => {
|
|
25
|
-
expect(spring({
|
|
26
|
-
fps: 30,
|
|
27
|
-
frame: 100,
|
|
28
|
-
})).toBeCloseTo(1);
|
|
29
|
-
});
|
|
30
|
-
test('Should be able to set duration for spring', () => {
|
|
31
|
-
expect(spring({
|
|
32
|
-
fps: 30,
|
|
33
|
-
frame: 5,
|
|
34
|
-
durationInFrames: 5,
|
|
35
|
-
})).toBeCloseTo(1);
|
|
36
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { expect, test } from 'vitest';
|
|
2
|
-
import { truthy } from '../truthy.js';
|
|
3
|
-
test.each([
|
|
4
|
-
['true', true],
|
|
5
|
-
['false', true],
|
|
6
|
-
['True', true],
|
|
7
|
-
['False', true],
|
|
8
|
-
['', false],
|
|
9
|
-
['abc', true],
|
|
10
|
-
[true, true],
|
|
11
|
-
[false, false],
|
|
12
|
-
[null, false],
|
|
13
|
-
[undefined, false],
|
|
14
|
-
[0, false],
|
|
15
|
-
[1, true],
|
|
16
|
-
[0.5, true],
|
|
17
|
-
[12, true],
|
|
18
|
-
[-1, true],
|
|
19
|
-
[-4, true],
|
|
20
|
-
])('test with %s', (input, expected) => {
|
|
21
|
-
expect(truthy(input)).toEqual(expected);
|
|
22
|
-
});
|