blob: 01a3ad6b91c7d684b22bee59682721dad82ec9cc [file] [log] [blame]
Tests parsing and re-serializing of various valid and invalid calc expressions.
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
element.style["width"] = "calc(100px)"
PASS element.style['width'] is "calc(100px)"
PASS getComputedStyle(element).getPropertyValue('width') is "100px"
element.style["width"] = "max(100px + 200px)"
PASS element.style['width'] is "max(300px)"
PASS getComputedStyle(element).getPropertyValue('width') is "300px"
element.style["width"] = "max(100px , 200px)"
PASS element.style['width'] is "max(200px)"
PASS getComputedStyle(element).getPropertyValue('width') is "200px"
element.style["width"] = "max(100px,200px)"
PASS element.style['width'] is "max(200px)"
PASS getComputedStyle(element).getPropertyValue('width') is "200px"
element.style["width"] = "clamp(100px,123px,200px)"
PASS element.style['width'] is "clamp(100px, 123px, 200px)"
PASS getComputedStyle(element).getPropertyValue('width') is "123px"
element.style["width"] = "clamp(100px,300px,200px)"
PASS element.style['width'] is "clamp(100px, 300px, 200px)"
PASS getComputedStyle(element).getPropertyValue('width') is "200px"
element.style["width"] = "clamp(200px,300px,100px)"
PASS element.style['width'] is "clamp(200px, 300px, 100px)"
PASS getComputedStyle(element).getPropertyValue('width') is "200px"
element.style["width"] = "clamp((50px + 50px),40px,200px)"
PASS element.style['width'] is "clamp(100px, 40px, 200px)"
PASS getComputedStyle(element).getPropertyValue('width') is "100px"
element.style["width"] = "clamp(50px + 50px,40px,200px)"
PASS element.style['width'] is "clamp(100px, 40px, 200px)"
PASS getComputedStyle(element).getPropertyValue('width') is "100px"
element.style["width"] = "min(100px,0%)"
PASS element.style['width'] is "min(100px, 0%)"
PASS getComputedStyle(element).getPropertyValue('width') is "0px"
element.style["width"] = "max(100px,0%)"
PASS element.style['width'] is "max(100px, 0%)"
PASS getComputedStyle(element).getPropertyValue('width') is "100px"
element.style["width"] = "clamp(100px,0%,1%)"
PASS element.style['width'] is "clamp(100px, 0%, 1%)"
PASS getComputedStyle(element).getPropertyValue('width') is "100px"
element.style["width"] = "calc(100px * pow(2, pow(2, 2)))"
PASS element.style['width'] is "calc(1600px)"
PASS getComputedStyle(element).getPropertyValue('width') is "1600px"
element.style["width"] = "calc(1px * pow(2, 3))"
PASS element.style['width'] is "calc(8px)"
PASS getComputedStyle(element).getPropertyValue('width') is "8px"
element.style["width"] = "calc(100px * sqrt(100))"
PASS element.style['width'] is "calc(1000px)"
PASS getComputedStyle(element).getPropertyValue('width') is "1000px"
element.style["width"] = "calc(1px * sqrt(999))"
PASS element.style['width'] is "calc(31.606961258558215px)"
PASS getComputedStyle(element).getPropertyValue('width') is "31.59375px"
element.style["width"] = "calc(1px * pow(2, sqrt(100))"
PASS element.style['width'] is "calc(1024px)"
PASS getComputedStyle(element).getPropertyValue('width') is "1024px"
element.style["width"] = "hypot(4px, 5px, 7px, 9px)"
PASS element.style['width'] is "hypot(13.076696830622021px)"
PASS getComputedStyle(element).getPropertyValue('width') is "13.0625px"
element.style["width"] = "hypot(3px, 4px)"
PASS element.style['width'] is "hypot(5px)"
PASS getComputedStyle(element).getPropertyValue('width') is "5px"
element.style["width"] = "calc(100px * hypot(3, 4))"
PASS element.style['width'] is "calc(500px)"
PASS getComputedStyle(element).getPropertyValue('width') is "500px"
element.style["width"] = "hypot(-5px)"
PASS element.style['width'] is "hypot(5px)"
PASS getComputedStyle(element).getPropertyValue('width') is "5px"
element.style["width"] = "calc(1px * hypot(-5))"
PASS element.style['width'] is "calc(5px)"
PASS getComputedStyle(element).getPropertyValue('width') is "5px"
element.style["width"] = "calc(1px * hypot(10000))"
PASS element.style['width'] is "calc(10000px)"
PASS getComputedStyle(element).getPropertyValue('width') is "10000px"
element.style["width"] = "calc(2px * sqrt(100000000))"
PASS element.style['width'] is "calc(20000px)"
PASS getComputedStyle(element).getPropertyValue('width') is "20000px"
element.style["width"] = "calc(3px * pow(200, 4))"
PASS element.style['width'] is "calc(4800000000px)"
PASS getComputedStyle(element).getPropertyValue('width') is "33554428px"
element.style["width"] = "calc(sin(90deg) * 100px)"
PASS 100 is 100
element.style["width"] = "calc(sin(45deg + 45deg ) * 100px)"
PASS 100 is 100
element.style["width"] = "calc(cos( 0 ) * 100px)"
PASS 100 is 100
element.style["width"] = "calc(cos( 30deg - 30deg ) * 100px)"
PASS 100 is 100
element.style["width"] = "calc(tan(45deg)*100px)"
PASS 100 is 100
element.style["width"] = "calc(tan(30deg + 15deg) * 100px)"
PASS 100 is 100
element.style["width"] = "calc(sin(pi/2) * 100px)"
PASS 100 is 100
element.style["width"] = "calc(cos(e - e) * 100px)"
PASS 100 is 100
element.style["width"] = "calc(100px, 200px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(100px 200px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(100px ( 200px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "min(100px 200px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "max(100px 200px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "max(100px,, 200px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "max(100px, , 200px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "max(100px, 200px,)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "clamp(200px,300px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "clamp(200px,300px,)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "clamp(200px,,300px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "clamp((),,300px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "clamp(1px,2px,2px,4px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(1px * pow(1))"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(1px * pow(2px, 3px))"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(sqrt(100px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "hypot(2px, 40%)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "hypot(2px, 3)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "hypot(3, ,4)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(1px * pow(2 3))"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "hypot()"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(pow(2))"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "pow())"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(sqrt())"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(sqrt(100, 200))"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(sin(90px) * 100px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(sin(30deg + 1.0471967rad, 0) * 100px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(cos( 0 ,) * 100px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(cos( () 30deg - 0.523599rad ) * 100px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(tan(45deg ) ) * 100px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(tan(30deg, + 0.261799rad) * 100px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(sin(piiii/4) * 100px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(sin(e e/4) * 100px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["width"] = "calc(sin() * 100px)"
PASS element.style['width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('width') is "999px"
element.style["min-width"] = "calc(100px)"
PASS element.style['min-width'] is "calc(100px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "100px"
element.style["min-width"] = "max(100px + 200px)"
PASS element.style['min-width'] is "max(300px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "300px"
element.style["min-width"] = "max(100px , 200px)"
PASS element.style['min-width'] is "max(200px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "200px"
element.style["min-width"] = "max(100px,200px)"
PASS element.style['min-width'] is "max(200px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "200px"
element.style["min-width"] = "clamp(100px,123px,200px)"
PASS element.style['min-width'] is "clamp(100px, 123px, 200px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "123px"
element.style["min-width"] = "clamp(100px,300px,200px)"
PASS element.style['min-width'] is "clamp(100px, 300px, 200px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "200px"
element.style["min-width"] = "clamp(200px,300px,100px)"
PASS element.style['min-width'] is "clamp(200px, 300px, 100px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "200px"
element.style["min-width"] = "clamp((50px + 50px),40px,200px)"
PASS element.style['min-width'] is "clamp(100px, 40px, 200px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "100px"
element.style["min-width"] = "clamp(50px + 50px,40px,200px)"
PASS element.style['min-width'] is "clamp(100px, 40px, 200px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "100px"
element.style["min-width"] = "min(100px,0%)"
PASS element.style['min-width'] is "min(100px, 0%)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "min(100px, 0%)"
element.style["min-width"] = "max(100px,0%)"
PASS element.style['min-width'] is "max(100px, 0%)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "max(100px, 0%)"
element.style["min-width"] = "clamp(100px,0%,1%)"
PASS element.style['min-width'] is "clamp(100px, 0%, 1%)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "clamp(100px, 0%, 1%)"
element.style["min-width"] = "calc(100px * pow(2, pow(2, 2)))"
PASS element.style['min-width'] is "calc(1600px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "1600px"
element.style["min-width"] = "calc(1px * pow(2, 3))"
PASS element.style['min-width'] is "calc(8px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "8px"
element.style["min-width"] = "calc(100px * sqrt(100))"
PASS element.style['min-width'] is "calc(1000px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "1000px"
element.style["min-width"] = "calc(1px * sqrt(999))"
PASS element.style['min-width'] is "calc(31.606961258558215px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "31.606962203979492px"
element.style["min-width"] = "calc(1px * pow(2, sqrt(100))"
PASS element.style['min-width'] is "calc(1024px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "1024px"
element.style["min-width"] = "hypot(4px, 5px, 7px, 9px)"
PASS element.style['min-width'] is "hypot(13.076696830622021px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "13.076696395874023px"
element.style["min-width"] = "hypot(3px, 4px)"
PASS element.style['min-width'] is "hypot(5px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "5px"
element.style["min-width"] = "calc(100px * hypot(3, 4))"
PASS element.style['min-width'] is "calc(500px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "500px"
element.style["min-width"] = "hypot(-5px)"
PASS element.style['min-width'] is "hypot(5px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "5px"
element.style["min-width"] = "calc(1px * hypot(-5))"
PASS element.style['min-width'] is "calc(5px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "5px"
element.style["min-width"] = "calc(1px * hypot(10000))"
PASS element.style['min-width'] is "calc(10000px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "10000px"
element.style["min-width"] = "calc(2px * sqrt(100000000))"
PASS element.style['min-width'] is "calc(20000px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "20000px"
element.style["min-width"] = "calc(3px * pow(200, 4))"
PASS element.style['min-width'] is "calc(4800000000px)"
PASS getComputedStyle(element).getPropertyValue('min-width') is "33554428px"
element.style["min-width"] = "calc(sin(90deg) * 100px)"
PASS 100 is 100
element.style["min-width"] = "calc(sin(45deg + 45deg ) * 100px)"
PASS 100 is 100
element.style["min-width"] = "calc(cos( 0 ) * 100px)"
PASS 100 is 100
element.style["min-width"] = "calc(cos( 30deg - 30deg ) * 100px)"
PASS 100 is 100
element.style["min-width"] = "calc(tan(45deg)*100px)"
PASS 100 is 100
element.style["min-width"] = "calc(tan(30deg + 15deg) * 100px)"
PASS 100 is 100
element.style["min-width"] = "calc(sin(pi/2) * 100px)"
PASS 100 is 100
element.style["min-width"] = "calc(cos(e - e) * 100px)"
PASS 100 is 100
element.style["min-width"] = "calc(100px, 200px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(100px 200px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(100px ( 200px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "min(100px 200px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "max(100px 200px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "max(100px,, 200px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "max(100px, , 200px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "max(100px, 200px,)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "clamp(200px,300px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "clamp(200px,300px,)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "clamp(200px,,300px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "clamp((),,300px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "clamp(1px,2px,2px,4px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(1px * pow(1))"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(1px * pow(2px, 3px))"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(sqrt(100px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "hypot(2px, 40%)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "hypot(2px, 3)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "hypot(3, ,4)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(1px * pow(2 3))"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "hypot()"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(pow(2))"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "pow())"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(sqrt())"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(sqrt(100, 200))"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(sin(90px) * 100px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(sin(30deg + 1.0471967rad, 0) * 100px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(cos( 0 ,) * 100px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(cos( () 30deg - 0.523599rad ) * 100px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(tan(45deg ) ) * 100px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(tan(30deg, + 0.261799rad) * 100px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(sin(piiii/4) * 100px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(sin(e e/4) * 100px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
element.style["min-width"] = "calc(sin() * 100px)"
PASS element.style['min-width'] is "999px"
PASS getComputedStyle(element).getPropertyValue('min-width') is "999px"
PASS successfullyParsed is true
TEST COMPLETE