Skip to content

Commit

Permalink
Add tests for abs() and sign()
Browse files Browse the repository at this point in the history
  • Loading branch information
asamuzaK committed Dec 20, 2024
1 parent a955140 commit 191c942
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/CSSStyleDeclaration.js
Original file line number Diff line number Diff line change
Expand Up @@ -805,4 +805,28 @@ describe('CSSStyleDeclaration', () => {
'calc( /* comment */ 100% - calc(var(--foo) *2 ))'
);
});

it('supports abs', () => {
const style = new CSSStyleDeclaration();
style.setProperty('width', 'abs(1 + 2 + 3)');
assert.strictEqual(style.getPropertyValue('width'), 'calc(6)');
});

it('supports abs inside calc', () => {
const style = new CSSStyleDeclaration();
style.setProperty('width', 'calc(abs(1) + abs(2))');
assert.strictEqual(style.getPropertyValue('width'), 'calc(3)');
});

it('supports sign', () => {
const style = new CSSStyleDeclaration();
style.setProperty('width', 'sign(.1)');
assert.strictEqual(style.getPropertyValue('width'), 'calc(1)');
});

it('supports sign inside calc', () => {
const style = new CSSStyleDeclaration();
style.setProperty('width', 'calc(sign(.1) + sign(.2))');
assert.strictEqual(style.getPropertyValue('width'), 'calc(2)');
});
});

0 comments on commit 191c942

Please sign in to comment.