diff options
author | Haijian Wang <haijian@vaadin.com> | 2013-02-27 15:38:55 +0200 |
---|---|---|
committer | Vaadin Code Review <review@vaadin.com> | 2013-02-27 13:53:22 +0000 |
commit | 934b8ceb3f8ddcc6acc3ffb4a35b67e3e989ec38 (patch) | |
tree | 1a5f25c3afb03e2fee285f8d7a3b75c33427ea16 /theme-compiler/tests/resources/automatic | |
parent | c5af559686ab3984d43c59a8d6289b99229961e1 (diff) | |
download | vaadin-framework-934b8ceb3f8ddcc6acc3ffb4a35b67e3e989ec38.tar.gz vaadin-framework-934b8ceb3f8ddcc6acc3ffb4a35b67e3e989ec38.zip |
support arithmetics in the SCSS compiler (#9354)
Change-Id: Ieb7834fb12cdba5c0794a26de20b3c8c2d509642
Diffstat (limited to 'theme-compiler/tests/resources/automatic')
-rw-r--r-- | theme-compiler/tests/resources/automatic/css/basic_arithmetics.css | 31 | ||||
-rw-r--r-- | theme-compiler/tests/resources/automatic/scss/basic_arithmetics.scss | 44 |
2 files changed, 75 insertions, 0 deletions
diff --git a/theme-compiler/tests/resources/automatic/css/basic_arithmetics.css b/theme-compiler/tests/resources/automatic/css/basic_arithmetics.css new file mode 100644 index 0000000000..9fd33f2efe --- /dev/null +++ b/theme-compiler/tests/resources/automatic/css/basic_arithmetics.css @@ -0,0 +1,31 @@ +.foo { + font: 10px / 8px; + font: 5px; + margin-left: 9px; +} + +.foo { + size: 1; +} + +.foo { + bar: 8; + bar: 8; + bar: 12; +} + +.foo { + bar: 2 3; + bar: 5; + bar: 5; +} + +.foo { + bar: 2 -3; + bar: -1; + bar: -1; +} + +.foo { + bar: 14; +}
\ No newline at end of file diff --git a/theme-compiler/tests/resources/automatic/scss/basic_arithmetics.scss b/theme-compiler/tests/resources/automatic/scss/basic_arithmetics.scss new file mode 100644 index 0000000000..cc913fe048 --- /dev/null +++ b/theme-compiler/tests/resources/automatic/scss/basic_arithmetics.scss @@ -0,0 +1,44 @@ +/* +*supports: +* 1. standard arithmetic operations (+, -, *, /, %) +* 2. / is treated as css operator, unless one of its operands is variable or there is another binary arithmetic operator +*limits: +* 1. cannot mix arithmetic and css operations, e.g. "margin: 1px + 3px 2px" will fail +* 2. space between add and minus operator and their following operand is mandatory. e.g. "1 + 2" is valid, "1+2" is not +* 3. parenthesis is not supported now. +*/ + +$div: 10px; +.foo { + font: 10px/8px; // Plain CSS, no division + font: $div/2; // Uses a variable, does division + margin-left: 5px + 8px/2px; //Uses +, does division +} + +.foo{ + size: 5 % 2; // modular +} + +$mul: 2*4; //valid multiply in variable +$mul1: 2 * 4; //valid multiply in variable +.foo{ + bar: $mul; + bar: $mul1; + bar: 3*4; //valid multiply in declaration +} + +.foo { + bar: 2 +3; //'+' is regarded as an unary operator, because no space between '+' and '3' + bar: 2+ 3; //valid add expression + bar: 2 + 3; //beautiful valid add expression +} + +.foo { + bar: 2 -3; //'-' is regarded as an unary operator, because no space between '-' and '3' + bar: 2 - 3; //beautiful valid minus expression + bar: 2- 3; //valid minus expression +} + +.foo { + bar: 2 + 3 * 4; // combinations +}
\ No newline at end of file |