@@ -2521,7 +2521,7 @@ describe('<calc-mix()>', () => {
25212521 [ '<number> | <length>' , 'calc-mix(1px, 1, 1)' ] ,
25222522 [ '<length-percentage>' , 'calc-mix(calc(1% / 1px), 1px, 1px)' ] ,
25232523 [ '<length-percentage>' , 'calc-mix(calc((1% + 1px) / 1px), 1px, 1px)' ] ,
2524- [ '<length-percentage>' , 'calc-mix(progress(1% from 1px to 1px), 1px, 1px)' ] ,
2524+ [ '<length-percentage>' , 'calc-mix(progress(1%, 1px, 1px), 1px, 1px)' ] ,
25252525 // Inconsistent calculation types
25262526 [ '<number> | <length>' , 'calc-mix(0, 1, 1px)' ] ,
25272527 [ '<number> | <percentage>' , 'calc-mix(0, 1, 1%)' ] ,
@@ -2536,10 +2536,10 @@ describe('<calc-mix()>', () => {
25362536 [ '<length>' , 'calc-mix(--timeline, 1px * 1, 1px)' , 'calc-mix(--timeline, 1px, 1px)' ] ,
25372537 [ '<length>' , 'calc-mix(0 * 1, 1px, 1px)' , 'calc-mix(0, 1px, 1px)' ] ,
25382538 [ '<length>' , 'calc-mix(0%, 1px, 1px)' ] ,
2539- [ '<length>' , 'calc-mix(progress(1% from 1% + 1% to 1%), 1px, 1px)' , 'calc-mix(1, 1px, 1px)' ] ,
2539+ [ '<length>' , 'calc-mix(progress(1%, 1% + 1%, 1%), 1px, 1px)' , 'calc-mix(1, 1px, 1px)' ] ,
25402540 [ '<length-percentage>' , 'calc-mix(0, 1px, 1%)' ] ,
25412541 [ '<length-percentage>' , 'calc-mix(0%, 1px, 1%)' ] ,
2542- [ '<length-percentage>' , 'calc-mix(progress(1% from 1% to 1%), 1px, 1%)' ] ,
2542+ [ '<length-percentage>' , 'calc-mix(progress(1%, 1%, 1%), 1px, 1%)' ] ,
25432543 [ '<length-percentage>' , 'calc(1px * calc-mix(0%, 1% / 1px, (1% + 1px) / 1px))' ] ,
25442544 ]
25452545 valid . forEach ( ( [ definition , input , expected = input ] ) => expect ( parse ( definition , input ) ) . toBe ( expected ) )
@@ -2571,30 +2571,30 @@ describe('<progress()>', () => {
25712571 test ( 'invalid' , ( ) => {
25722572 const invalid = [
25732573 // Inconsistent calculation types
2574- [ '<number> | <length>' , 'progress(1 from 1px to 1)' ] ,
2575- [ '<number> | <percentage>' , 'progress(1 from 1% to 1)' ] ,
2574+ [ '<number> | <length>' , 'progress(1, 1px, 1)' ] ,
2575+ [ '<number> | <percentage>' , 'progress(1, 1%, 1)' ] ,
25762576 // Result type mismatch
2577- [ '<number> | <percentage>' , 'progress(1 from (1% + 1px) / 1px to 1)' ] ,
2578- [ '<length>' , 'calc(1px * progress(1% from 1px to 1px))' ] ,
2577+ [ '<number> | <percentage>' , 'progress(1, (1% + 1px) / 1px, 1)' ] ,
2578+ [ '<length>' , 'calc(1px * progress(1%, 1px, 1px))' ] ,
25792579 ]
25802580 invalid . forEach ( ( [ definition , input ] ) => expect ( parse ( definition , input , false ) ) . toBeNull ( ) )
25812581 } )
25822582 test ( 'valid' , ( ) => {
25832583 const valid = [
25842584 // Identical units
2585- [ '<number>' , 'progress(1 from 0 to 2)' , 'calc(0.5)' ] ,
2586- [ '<number>' , 'progress(1 from 2 to 0)' , 'calc(0.5)' ] ,
2587- [ '<number>' , 'progress(-1 from 0 to 2)' , 'calc(-0.5)' ] ,
2588- [ '<number>' , 'progress(1em from 0em to 2em)' ] ,
2589- [ '<length-percentage>' , 'calc(1px * progress(1% from 0% to 2%))' ] ,
2585+ [ '<number>' , 'progress(1, 0, 2)' , 'calc(0.5)' ] ,
2586+ [ '<number>' , 'progress(1, 2, 0)' , 'calc(0.5)' ] ,
2587+ [ '<number>' , 'progress(-1, 0, 2)' , 'calc(-0.5)' ] ,
2588+ [ '<number>' , 'progress(1em, 0em, 2em)' ] ,
2589+ [ '<length-percentage>' , 'calc(1px * progress(1%, 0%, 2%))' ] ,
25902590 // Different units
2591- [ '<number>' , 'progress(48px from 0px to 1in)' , 'calc(0.5)' ] ,
2592- [ '<length-percentage>' , 'calc(1px * progress(1px from 0% to 2px))' ] ,
2591+ [ '<number>' , 'progress(48px, 0px, 1in)' , 'calc(0.5)' ] ,
2592+ [ '<length-percentage>' , 'calc(1px * progress(1px, 0%, 2px))' ] ,
25932593 // Consistent type
2594- [ '<number>' , 'progress(1 * 1 from 360deg / 1turn to 1em / 1px)' , 'progress(1 from 1 to 1em / 1px)' ] ,
2595- [ '<length-percentage>' , 'calc(1px * progress(1 * 1 from 1% / 1% to 1em / 1px))' , 'calc(1px * progress(1 from 1% / 1% to 1em / 1px))' ] ,
2594+ [ '<number>' , 'progress(1 * 1, 360deg / 1turn, 1em / 1px)' , 'progress(1, 1, 1em / 1px)' ] ,
2595+ [ '<length-percentage>' , 'calc(1px * progress(1 * 1, 1% / 1%, 1em / 1px))' , 'calc(1px * progress(1, 1% / 1%, 1em / 1px))' ] ,
25962596 // Equal argument values
2597- [ '<number>' , 'progress(1 from 1 to 1)' , 'calc(0)' ] ,
2597+ [ '<number>' , 'progress(1, 1, 1)' , 'calc(0)' ] ,
25982598 ]
25992599 valid . forEach ( ( [ definition , input , expected = input ] ) => expect ( parse ( definition , input ) ) . toBe ( expected ) )
26002600 } )
@@ -2603,46 +2603,44 @@ describe('<container-progress()>', () => {
26032603 test ( 'invalid' , ( ) => {
26042604 const invalid = [
26052605 // Invalid feature
2606- [ '<number>' , 'container-progress(resolution from 1dpi to 1dpi)' ] ,
2607- [ '<number>' , 'container-progress(orientation from 1 to 1)' ] ,
2608- [ '<number>' , 'container-progress(width: 1px from 1px to 1px)' ] ,
2609- [ '<number>' , 'container-progress(width < 1px from 1px to 1px)' ] ,
2606+ [ '<number>' , 'container-progress(resolution, 1dpi, 1dpi)' ] ,
2607+ [ '<number>' , 'container-progress(orientation, 1, 1)' ] ,
2608+ [ '<number>' , 'container-progress(width: 1px, 1px, 1px)' ] ,
2609+ [ '<number>' , 'container-progress(width < 1px, 1px, 1px)' ] ,
26102610 // Invalid value
2611- [ '<number>' , 'container-progress(width from 1 to 1)' ] ,
2612- [ '<number>' , 'container-progress(width from 1% to 1%)' ] ,
2613- [ '<length-percentage>' , 'calc(1px * container-progress(width from 1% to 1px))' ] ,
2614- [ '<length>' , 'calc(1px * container-progress(width from 1% + 1px to 1px))' ] ,
2611+ [ '<number>' , 'container-progress(width, 1, 1)' ] ,
2612+ [ '<number>' , 'container-progress(width, 1%, 1%)' ] ,
2613+ [ '<length-percentage>' , 'calc(1px * container-progress(width, 1%, 1px))' ] ,
2614+ [ '<length>' , 'calc(1px * container-progress(width, 1% + 1px, 1px))' ] ,
26152615 ]
26162616 invalid . forEach ( ( [ definition , input ] ) => expect ( parse ( definition , input , false ) ) . toBeNull ( ) )
26172617 } )
26182618 test ( 'valid' , ( ) => {
2619- expect ( parse ( '<number>' , 'container-progress(width from 0px + 1px to 1px * 1)' ) )
2620- . toBe ( 'container-progress(width from 1px to 1px)' )
2621- expect ( parse ( '<number>' , 'container-progress(aspect-ratio from -1 to 1)' ) )
2622- . toBe ( 'container-progress(aspect-ratio from -1 to 1)' )
2619+ expect ( parse ( '<number>' , 'container-progress(width, 0px + 1px, 1px * 1)' ) )
2620+ . toBe ( 'container-progress(width, 1px, 1px)' )
2621+ expect ( parse ( '<number>' , 'container-progress(aspect-ratio, -1, 1)' ) )
2622+ . toBe ( 'container-progress(aspect-ratio, -1, 1)' )
26232623 } )
26242624} )
26252625describe ( '<media-progress()>' , ( ) => {
26262626 test ( 'invalid' , ( ) => {
26272627 const invalid = [
26282628 // Invalid feature
2629- [ '<number>' , 'media-progress(inline-size from 1px to 1px)' ] ,
2630- [ '<number>' , 'media-progress(orientation from 1 to 1)' ] ,
2631- [ '<number>' , 'media-progress(width: 1px from 1px to 1px)' ] ,
2632- [ '<number>' , 'media-progress(width < 1px from 1px to 1px)' ] ,
2629+ [ '<number>' , 'media-progress(inline-size, 1px, 1px)' ] ,
2630+ [ '<number>' , 'media-progress(grid, 1, 1)' ] ,
2631+ [ '<number>' , 'media-progress(width: 1px, 1px, 1px)' ] ,
2632+ [ '<number>' , 'media-progress(width < 1px, 1px, 1px)' ] ,
26332633 // Invalid value
2634- [ '<number>' , 'media-progress(width from 1 to 1)' ] ,
2635- [ '<number>' , 'media-progress(width from 1% to 1%)' ] ,
2636- [ '<length-percentage>' , 'calc(1px * media-progress(width from 1% to 1px))' ] ,
2637- [ '<length>' , 'calc(1px * media-progress(width from 1% + 1px to 1px))' ] ,
2634+ [ '<number>' , 'media-progress(width, 1, 1)' ] ,
2635+ [ '<number>' , 'media-progress(width, 1%, 1%)' ] ,
2636+ [ '<length-percentage>' , 'calc(1px * media-progress(width, 1%, 1px))' ] ,
2637+ [ '<length>' , 'calc(1px * media-progress(width, 1% + 1px, 1px))' ] ,
26382638 ]
26392639 invalid . forEach ( ( [ definition , input ] ) => expect ( parse ( definition , input , false ) ) . toBeNull ( ) )
26402640 } )
26412641 test ( 'valid' , ( ) => {
2642- expect ( parse ( '<number>' , 'media-progress(width from 0px + 1px to 1px * 1)' ) )
2643- . toBe ( 'media-progress(width from 1px to 1px)' )
2644- expect ( parse ( '<number>' , 'media-progress(aspect-ratio from -1 to 1)' ) )
2645- . toBe ( 'media-progress(aspect-ratio from -1 to 1)' )
2642+ expect ( parse ( '<number>' , 'media-progress(width, 0px + 1px, 1px * 1)' ) ) . toBe ( 'media-progress(width, 1px, 1px)' )
2643+ expect ( parse ( '<number>' , 'media-progress(aspect-ratio, -1, 1)' ) ) . toBe ( 'media-progress(aspect-ratio, -1, 1)' )
26462644 } )
26472645} )
26482646describe ( '<sibling-count()>, <sibling-index()>' , ( ) => {
@@ -2966,7 +2964,7 @@ describe('<color>', () => {
29662964 [ 'rgb(calc(-1%) 0% 0% / calc(-1%))' , 'rgba(0, 0, 0, 0)' ] ,
29672965 [ 'rgb(calc(101%) 0% 0% / calc(101%))' , 'rgb(255, 0, 0)' ] ,
29682966 [ 'rgba(-1 calc(1em / 1px) 101% / 1)' , 'rgb(0 calc(1em / 1px) 255)' ] ,
2969- [ 'rgb(calc(1) sibling-index() progress(1 from 0 to 2))' , 'rgb(1 sibling-index() 0.5)' ] ,
2967+ [ 'rgb(calc(1) sibling-index() progress(1, 0, 2))' , 'rgb(1 sibling-index() 0.5)' ] ,
29702968 // Relative color syntax
29712969 [ 'rgb(from green alpha calc(r) calc(g * 1%) / calc(b + 1 + 1))' , 'rgb(from green alpha calc(r) calc(1% * g) / calc(2 + b))' ] ,
29722970 [ 'rgba(from rgba(-1 256 0 / -1) -100% 200% 0% / 101%)' , 'rgb(from rgb(-1 256 0 / 0) -255 510 0)' ] ,
@@ -3016,7 +3014,7 @@ describe('<color>', () => {
30163014 [ 'hsl(calc(-540deg) 100% 50% / calc(-1%))' , 'rgba(0, 255, 255, 0)' ] ,
30173015 [ 'hsl(calc(540deg) 100% 50% / 101%)' , 'rgb(0, 255, 255)' ] ,
30183016 [ 'hsla(-540 calc(1em / 1px) 101% / 1)' , 'hsl(180 calc(1em / 1px) 100)' ] ,
3019- [ 'hsl(calc(1) sibling-index() progress(1 from 0 to 2))' , 'hsl(1 sibling-index() 0.5)' ] ,
3017+ [ 'hsl(calc(1) sibling-index() progress(1, 0, 2))' , 'hsl(1 sibling-index() 0.5)' ] ,
30203018 // Relative color syntax
30213019 [ 'hsl(from green alpha calc(h) calc(s * 1%) / calc(l + 1 + 1))' , 'hsl(from green alpha calc(h) calc(1% * s) / calc(2 + l))' ] ,
30223020 [ 'hsla(from hsla(540 -1 0 / -1) 540deg 101% 0% / 101%)' , 'hsl(from hsl(180 -1 0 / 0) 180 101 0)' ] ,
@@ -3062,7 +3060,7 @@ describe('<color>', () => {
30623060 [ 'hwb(calc(-540deg) 0% 0% / calc(-1%))' , 'rgba(0, 255, 255, 0)' ] ,
30633061 [ 'hwb(calc(540deg) 0% 0% / calc(101%))' , 'rgb(0, 255, 255)' ] ,
30643062 [ 'hwb(-540 calc(1em / 1px) 101% / 1)' , 'hwb(180 calc(1em / 1px) 100)' ] ,
3065- [ 'hwb(calc(1) sibling-index() progress(1 from 0 to 2))' , 'hwb(1 sibling-index() 0.5)' ] ,
3063+ [ 'hwb(calc(1) sibling-index() progress(1, 0, 2))' , 'hwb(1 sibling-index() 0.5)' ] ,
30663064 // Relative color syntax
30673065 [ 'hwb(from green alpha calc(h) calc(w * 1%) / calc(b + 1 + 1))' , 'hwb(from green alpha calc(h) calc(1% * w) / calc(2 + b))' ] ,
30683066 [ 'hwb(from hwb(540 -1 0 / -1) 540deg -1% 0% / 101%)' , 'hwb(from hwb(180 -1 0 / 0) 180 -1 0)' ] ,
@@ -3831,7 +3829,7 @@ describe('<progress>', () => {
38313829 const invalid = [
38323830 // Invalid <calc-sum>
38333831 '(1% + 1px) / 1px' ,
3834- 'progress(1% from 1px to 1px)' ,
3832+ 'progress(1%, 1px, 1px)' ,
38353833 // Invalid <'animation-timeline'>
38363834 'auto' ,
38373835 'none' ,
@@ -4080,8 +4078,8 @@ describe('<syntax-component>', () => {
40804078 expect ( parse ( '<syntax-component>' , '<transform-list >' , false ) ) . toBeNull ( )
40814079 } )
40824080 test ( 'representation' , ( ) => {
4083- const componentName = customIdent ( 'a' , [ '<syntax-component-name >' ] )
4084- const component = list ( [ componentName , omitted ] , '' , [ '<syntax-component>' ] )
4081+ const componentUnit = ident ( 'a' , [ '<syntax-single-component >' ] )
4082+ const component = list ( [ componentUnit , omitted ] , '' , [ '<syntax-component>' ] )
40854083 expect ( parse ( '<syntax-component>' , 'a' , false ) ) . toMatchObject ( component )
40864084 } )
40874085} )
0 commit comments