Lines Matching refs:t
25 export function test(t, { setPortalChild, cleanupPortal }) { argument
26 t.describe('Video', () => {
27 t.beforeAll(async () => {
50 t.afterEach(async () => {
59 t.describe(`Video.props.${propName}`, () => {
61 t.it(`sets it to \`${value}\``, async () => {
83 t.describe(`Video.props.${propName}`, () => {
85 t.it(`setting to \`${value}\` doesn't crash`, async () => {
93 t.describe(`Video.${propSetter}`, () => {
95 t.it(`sets it to \`${value}\``, async () => {
109 t.expect(status).toEqual(t.jasmine.objectContaining({ [propName]: value }));
118 t.describe('Video.props.onLoadStart', () => {
119 t.it('gets called when the source starts loading', async () => {
124 t.describe('Video.props.onLoad', () => {
125 t.it('gets called when the source loads', async () => {
129 t.it('gets called right when the video starts to play if it should autoplay', async () => {
134 t.expect(status.positionMillis).toEqual(0);
138 t.describe('Video.props.source', () => {
139 t.it('mounts even when the source is undefined', async () => {
143 t.it('loads `require` source', async () => {
145 t.expect(status).toEqual(t.jasmine.objectContaining({ isLoaded: true }));
148 t.it('loads `Asset` source', async () => {
152 t.expect(status).toEqual(t.jasmine.objectContaining({ isLoaded: true }));
155 t.it('loads `uri` source', async () => {
157 t.expect(status).toEqual(t.jasmine.objectContaining({ isLoaded: true }));
161 t.it(
173 t.expect(error.toLowerCase()).toContain('none');
176 t.it(
187 t.expect(status).toEqual(t.jasmine.objectContaining({ isLoaded: true }));
191 t.expect(hasBeenRejected).toBe(false);
195 t.it(
203 t.expect(status).toEqual(t.jasmine.objectContaining({ isLoaded: true }));
207 t.expect(hasBeenRejected).toBe(false);
212 t.it('loads HLS stream', async () => {
216 t.expect(status).toEqual(t.jasmine.objectContaining({ isLoaded: true }));
219 t.it('loads redirecting `uri` source', async () => {
223 t.expect(status).toEqual(t.jasmine.objectContaining({ isLoaded: true }));
226 t.it('changes the source', async () => {
231 t.it('changes the source and enables native-controls', async () => {
238 t.it('changes the source and disables native-controls', async () => {
244 t.it(
251 t.expect(error).toBeDefined();
257 t.it(
269 t.expect(error).toContain(' - ');
284 t.describe(`Video.props.posterSource`, () => {
285 t.it("doesn't crash if is set to required image", async () => {
294 t.it("doesn't crash if is set to uri", async () => {
304 t.describe(`Video.props.onReadyForDisplay`, () => {
305 t.it('gets called with the `naturalSize` object', async () => {
311 t.expect(status.naturalSize).toBeDefined();
312 t.expect(status.naturalSize.width).toBeDefined();
313 t.expect(status.naturalSize.height).toBeDefined();
314 t.expect(status.naturalSize.orientation).toBe('landscape');
317 t.it('gets called with the `status` object', async () => {
323 t.expect(status.status).toBeDefined();
324 t.expect(status.status.isLoaded).toBe(true);
327 t.it('gets called when the component uses native controls', async () => {
334 t.expect(status.status).toBeDefined();
335 t.expect(status.status.isLoaded).toBe(true);
338 t.it("gets called when the component doesn't use native controls", async () => {
345 t.expect(status.status).toBeDefined();
346 t.expect(status.status.isLoaded).toBe(true);
349 t.it('gets called for HLS streams', async () => {
355 t.expect(status.naturalSize).toBeDefined();
356 t.expect(status.naturalSize.width).toBeDefined();
357 t.expect(status.naturalSize.height).toBeDefined();
358 t.expect(status.naturalSize.orientation).toBeDefined();
361 t.it('correctly detects portrait video', async () => {
367 t.expect(status.naturalSize).toBeDefined();
368 t.expect(status.naturalSize.width).toBeDefined();
369 t.expect(status.naturalSize.height).toBeDefined();
370 t.expect(status.naturalSize.orientation).toBe('portrait');
374 t.describe('Video fullscreen player', () => {
375 t.it('presents the player and calls callback func', async () => {
392 t.expect(fullscreenUpdates).toEqual([
400 t.expect(fullscreenUpdates).toEqual([
409 t.it("raises an error if the code didn't wait for completion", async () => {
427 t.expect(presentationError).toBeDefined();
428 t.expect(dismissalError).toBeDefined();
432 t.it('rejects dismissal request if present request is being handled', async () => {
446 t.expect(error).toBeDefined();
451 t.it('rejects presentation request if present request is already being handled', async () => {
465 t.expect(error).toBeDefined();
475 t.it('errors when trying to set it to 2', async () => {
484 t.expect(error).toBeDefined();
485 t.expect(error.toString()).toMatch(/value .+ between/);
488 t.it('errors when trying to set it to -0.5', async () => {
497 t.expect(error).toBeDefined();
498 t.expect(error.toString()).toMatch(/value .+ between/);
512 t.it('errors when trying to set it above 32', async () => {
521 t.expect(error).toBeDefined();
522 t.expect(error.toString()).toMatch(/value .+ between/);
525 t.it('errors when trying to set it under 0', async () => {
534 t.expect(error).toBeDefined();
535 t.expect(error.toString()).toMatch(/value .+ between/);
542 t.describe('Video.onPlaybackStatusUpdate', () => {
543 t.it('gets called with `didJustFinish = true` when video is done playing', async () => {
544 const onPlaybackStatusUpdate = t.jasmine.createSpy('onPlaybackStatusUpdate');
561 t.expect(onPlaybackStatusUpdate).toHaveBeenCalledWith(
562 t.jasmine.objectContaining({ didJustFinish: true })
569 t.it('gets called periodically when playing', async () => {
570 const onPlaybackStatusUpdate = t.jasmine.createSpy('onPlaybackStatusUpdate');
583 t.expect(beforeCount).toBeLessThan(6);
594 t.expect(duringCount).toBeGreaterThan(50);
599 t.expect(afterCount).toBeLessThan(3);
637 t.describe('Video.setPositionAsync', () => {
638 t.it('sets position of the video', async () => {
650 t.describe('Video.loadAsync', () => {
652 const unreliablyIt = Platform.OS === 'ios' ? t.xit : t.it;
668 t.expect(status.positionMillis).toBeLessThan(1100);
669 t.expect(status.positionMillis).toBeGreaterThan(900);
680 t.describe('Video.unloadAsync', () => {
681 t.it('unloads the video', async () => {
690 t.describe('Video.pauseAsync', () => {
691 t.it('pauses the video', async () => {
699 t.expect(positionMillis).toBeGreaterThan(0);
703 t.describe('Video.playAsync', () => {
705 const unreliablyIt = Platform.OS === 'ios' ? t.xit : t.it;
707 t.it('plays the stopped video', async () => {
715 t.it('plays the paused video', async () => {
728 const onPlaybackStatusUpdate = t.jasmine.createSpy('onPlaybackStatusUpdate');
744 t.expect(onPlaybackStatusUpdate).toHaveBeenCalledWith(
745 t.jasmine.objectContaining({ didJustFinish: true })
751 t.expect((await instance.getStatusAsync()).isPlaying).toBe(false);
755 t.describe('Video.playFromPositionAsync', () => {
756 t.it('plays a video that played to an end', async () => {
757 const onPlaybackStatusUpdate = t.jasmine.createSpy('onPlaybackStatusUpdate');
768 t.expect(onPlaybackStatusUpdate).toHaveBeenCalledWith(
769 t.jasmine.objectContaining({ didJustFinish: true })
779 t.describe('Video.replayAsync', () => {
780 t.it('replays the video', async () => {
788 t.expect(statusAfter.positionMillis).toBeLessThan(statusBefore.positionMillis);
791 t.it('plays a video that played to an end', async () => {
792 const onPlaybackStatusUpdate = t.jasmine.createSpy('onPlaybackStatusUpdate');
803 t.expect(onPlaybackStatusUpdate).toHaveBeenCalledWith(
804 t.jasmine.objectContaining({ didJustFinish: true })
832 t.describe('Video.stopAsync', () => {
835 t.beforeAll(async () => {
836 originalTimeout = t.jasmine.DEFAULT_TIMEOUT_INTERVAL;
837 t.jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout * 6;
840 t.afterAll(() => {
841 t.jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
844 t.it('stops a playing video', async () => {
852 t.it('stops a paused video', async () => {