Skip to content

Commit 79be4a1

Browse files
committed
Partially restore b6e26b5
Restore tests for an invalid arbitrary substitution nested in a function or simple block, to ensure they are looked for recursively. Restore tests for a comma or a positioned {} as a non-strict comma-containing <declaration-value> in var(). But move it as a test of <var()>, since it is presumably a strict comma-containing <declaration-value> in <var-args>.
1 parent 8fdd17e commit 79be4a1

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

__tests__/style.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ describe('arbitrary substitution', () => {
375375
test('invalid', () => {
376376
const style = createStyleBlock()
377377
const invalid = [
378+
// Invalid component value
378379
['env(name) "\n'],
379380
['env(name) url(bad .url)'],
380381
['env(name) ]'],
@@ -386,6 +387,9 @@ describe('arbitrary substitution', () => {
386387
['{} env(name)', 'color'],
387388
['env(name) !important'],
388389
['!important env(name)'],
390+
// Nested
391+
['fn(env())'],
392+
['{env()}'],
389393
]
390394
invalid.forEach(([input, property = '--custom']) => {
391395
style.setProperty(property, input)

__tests__/value.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4289,6 +4289,20 @@ describe('<url-set>', () => {
42894289
})
42904290
})
42914291
})
4292+
describe('<var()>', () => {
4293+
test('representation', () => {
4294+
const property = dashedIdent('--custom', ['<custom-property-name>'])
4295+
expect(parse('<var()>', 'var(--custom)', false)).toMatchObject({
4296+
name: 'var',
4297+
value: list([property, omitted, omitted]),
4298+
types: ['<function>', '<var()>'],
4299+
})
4300+
})
4301+
test('valid', () => {
4302+
expect(parse('<var()>', 'var(--custom,,)')).toBe('var(--custom,,)')
4303+
expect(parse('<var()>', 'var(--custom, 1 {})')).toBe('var(--custom, 1 {})')
4304+
})
4305+
})
42924306
describe('<view()>', () => {
42934307
test('representation', () => {
42944308
expect(parse('<view()>', 'view()', false)).toMatchObject({

0 commit comments

Comments
 (0)