|
1 | 1 | import { mount } from "@vue/test-utils"; |
2 | 2 | import { CloudinaryImage, CloudinaryVideo } from "@cloudinary/url-gen"; |
3 | | -import { auto, vp9 } from "@cloudinary/url-gen/qualifiers/videoCodec"; |
| 3 | +import { auto, vp9, theora } from "@cloudinary/url-gen/qualifiers/videoCodec"; |
4 | 4 | import { videoCodec } from "@cloudinary/url-gen/actions/transcode"; |
5 | 5 | import { AdvancedVideo } from "../../src"; |
6 | 6 | import { waitTicks } from "../unit/utils"; |
@@ -85,6 +85,38 @@ describe("AdvancedVideo", () => { |
85 | 85 | ); |
86 | 86 | }); |
87 | 87 |
|
| 88 | + it("should render video with input sources when using useFetchFormat", async function () { |
| 89 | + const sources = [ |
| 90 | + { |
| 91 | + type: "mp4", |
| 92 | + codecs: ["vp8", "vorbis"], |
| 93 | + transcode: videoCodec(auto()), |
| 94 | + }, |
| 95 | + { |
| 96 | + type: "webm", |
| 97 | + codecs: ["avc1.4D401E", "mp4a.40.2"], |
| 98 | + transcode: videoCodec(vp9()), |
| 99 | + }, |
| 100 | + { |
| 101 | + type: "ogv", |
| 102 | + codecs: ["theora"], |
| 103 | + transcode: videoCodec(theora()), |
| 104 | + }, |
| 105 | + ]; |
| 106 | + |
| 107 | + const component = mount(AdvancedVideo, { |
| 108 | + props: { cldVid: cloudinaryVideo, sources, useFetchFormat: true }, |
| 109 | + }); |
| 110 | + await waitTicks(1); |
| 111 | + |
| 112 | + expect(component.html()).toContain( |
| 113 | + "<video>\n" + |
| 114 | + ' <source src="https://res.cloudinary.com/demo/video/upload/vc_auto/f_mp4/sample" type="video/mp4; codecs=vp8, vorbis">\n' + |
| 115 | + ' <source src="https://res.cloudinary.com/demo/video/upload/vc_vp9/f_webm/sample" type="video/webm; codecs=avc1.4D401E, mp4a.40.2">\n' + |
| 116 | + ' <source src="https://res.cloudinary.com/demo/video/upload/vc_theora/f_ogv/sample" type="video/ogg; codecs=theora">\n</video>' |
| 117 | + ); |
| 118 | + }); |
| 119 | + |
88 | 120 | it("should pass video attributes", async function () { |
89 | 121 | const component = mount(AdvancedVideo, { |
90 | 122 | props: { |
|
0 commit comments