Skip to content

Commit ca70384

Browse files
committed
Support for animated gif
1 parent 735d655 commit ca70384

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

test/test-markup.js

+4-2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,8 @@ test("Filter out empty format arrays", async t => {
228228
test("Image markup (animated gif)", async t => {
229229
let results = await eleventyImage("./test/earth-animated.gif", {
230230
dryRun: true,
231-
formats: ["auto"]
231+
formats: ["auto"],
232+
outputDir: "./test/img/",
232233
});
233234

234235
t.is(generateHTML(results, {
@@ -239,7 +240,8 @@ test("Image markup (animated gif)", async t => {
239240
test("Image markup (animated gif, two formats)", async t => {
240241
let results = await eleventyImage("./test/earth-animated.gif", {
241242
dryRun: true,
242-
formats: ["tiff", "auto"]
243+
formats: ["tiff", "auto"],
244+
outputDir: "./test/img/",
243245
});
244246

245247
let e = t.throws(() => generateHTML(results, { alt: "" }));

test/test.js

+16
Original file line numberDiff line numberDiff line change
@@ -900,3 +900,19 @@ test("#132: Test EXIF orientation data landscape (8)", async t => {
900900
t.is(stats.jpeg[0].width, 400);
901901
t.is(Math.floor(stats.jpeg[0].height), 266);
902902
});
903+
904+
test("Animated gif", async t => {
905+
let stats = await eleventyImage("./test/earth-animated.gif", {
906+
dryRun: true,
907+
formats: ["auto"],
908+
sharpOptions: {
909+
animated: true
910+
},
911+
outputDir: "./test/img/",
912+
});
913+
914+
t.is(stats.gif.length, 1);
915+
t.is(stats.gif[0].width, 400);
916+
// it’s a big boi
917+
t.true( stats.gif[0].size > 1000*1000 );
918+
});

0 commit comments

Comments
 (0)