|
1 | 1 | import { mount } from "@vue/test-utils"; |
2 | | -import { CloudinaryVideo } from "@cloudinary/url-gen"; |
| 2 | +import { CloudinaryImage, CloudinaryVideo } from "@cloudinary/url-gen"; |
3 | 3 | import { auto, vp9 } 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"; |
7 | 7 |
|
| 8 | +const cloudinaryImage = new CloudinaryImage( |
| 9 | + "sample", |
| 10 | + { cloudName: "demo" }, |
| 11 | + { analytics: false } |
| 12 | +); |
8 | 13 | const cloudinaryVideo = new CloudinaryVideo( |
9 | 14 | "sample", |
10 | 15 | { cloudName: "demo" }, |
@@ -110,6 +115,28 @@ describe("AdvancedVideo", () => { |
110 | 115 | expect(component.html()).toContain('poster="www.example.com"'); |
111 | 116 | }); |
112 | 117 |
|
| 118 | + it('should contain poster when "auto" is passed as cldPoster', async function () { |
| 119 | + const component = mount(AdvancedVideo, { |
| 120 | + props: { cldVid: cloudinaryVideo, cldPoster: "auto" }, |
| 121 | + }); |
| 122 | + await waitTicks(1); |
| 123 | + |
| 124 | + expect(component.html()).toContain( |
| 125 | + 'poster="https://res.cloudinary.com/demo/video/upload/q_auto/f_jpg/so_auto/sample"' |
| 126 | + ); |
| 127 | + }); |
| 128 | + |
| 129 | + it("should contain poster when cloudinary image is passed as cldPoster", async function () { |
| 130 | + const component = mount(AdvancedVideo, { |
| 131 | + props: { cldVid: cloudinaryVideo, cldPoster: cloudinaryImage }, |
| 132 | + }); |
| 133 | + await waitTicks(1); |
| 134 | + |
| 135 | + expect(component.html()).toContain( |
| 136 | + 'poster="https://res.cloudinary.com/demo/image/upload/sample"' |
| 137 | + ); |
| 138 | + }); |
| 139 | + |
113 | 140 | it("should emit play event", async function () { |
114 | 141 | const mockCallback = jest.fn(); |
115 | 142 |
|
|
0 commit comments