mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-08-15 02:54:11 +08:00
fix(css): prevent shorthand parse error on 'unset' and 'inset' (#10424)
This commit is contained in:
@ -144,4 +144,36 @@ describe('css-shadow', () => {
|
||||
expect(shadow.spreadRadius).toBeUndefined();
|
||||
expect(shadow.color).toBeUndefined();
|
||||
});
|
||||
|
||||
it('unset', () => {
|
||||
const shadow = parseCSSShadow('unset');
|
||||
expect(shadow.inset).toBe(false);
|
||||
expect(shadow.offsetX).toBeUndefined();
|
||||
expect(shadow.offsetY).toBeUndefined();
|
||||
expect(shadow.blurRadius).toBeUndefined();
|
||||
expect(shadow.spreadRadius).toBeUndefined();
|
||||
expect(shadow.color).toBeUndefined();
|
||||
});
|
||||
|
||||
it('unset 5em 1em gold', () => {
|
||||
// invalid shorthand should result in nothing being applied
|
||||
const shadow = parseCSSShadow('unset 5em 1em gold');
|
||||
expect(shadow.inset).toBe(false);
|
||||
expect(shadow.offsetX).toBeUndefined();
|
||||
expect(shadow.offsetY).toBeUndefined();
|
||||
expect(shadow.blurRadius).toBeUndefined();
|
||||
expect(shadow.spreadRadius).toBeUndefined();
|
||||
expect(shadow.color).toBeUndefined();
|
||||
});
|
||||
|
||||
it('5em 1em gold unset', () => {
|
||||
// partially invalid shorthand should result in standard default fallback
|
||||
const shadow = parseCSSShadow('5em 1em gold unset');
|
||||
expect(shadow.inset).toBe(false);
|
||||
expect(shadow.offsetX).toBe(5);
|
||||
expect(shadow.offsetY).toBe(1);
|
||||
expect(shadow.blurRadius).toEqual(CoreTypes.zeroLength);
|
||||
expect(shadow.spreadRadius).toBeUndefined();
|
||||
expect(shadow.color).toEqual(new Color('black'));
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user