mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Add 'animated' constructor property as shortcut for 'pages'
Provides easier-to-understand API when handling animated images
This commit is contained in:
@@ -649,6 +649,15 @@ describe('Input/output', function () {
|
||||
sharp({ density: 'zoinks' });
|
||||
}, /Expected number between 1 and 2400 for density but received zoinks of type string/);
|
||||
});
|
||||
it('Setting animated property updates pages property', function () {
|
||||
assert.strictEqual(sharp({ animated: false }).options.input.pages, 1);
|
||||
assert.strictEqual(sharp({ animated: true }).options.input.pages, -1);
|
||||
});
|
||||
it('Invalid animated property throws', function () {
|
||||
assert.throws(function () {
|
||||
sharp({ animated: -1 });
|
||||
}, /Expected boolean for animated but received -1 of type number/);
|
||||
});
|
||||
it('Invalid page property throws', function () {
|
||||
assert.throws(function () {
|
||||
sharp({ page: -1 });
|
||||
|
||||
Reference in New Issue
Block a user