Skip to content

Commit

Permalink
Add Indented syntax tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesnw committed Oct 24, 2024
1 parent eabbabc commit 5cf5060
Show file tree
Hide file tree
Showing 10 changed files with 277 additions and 0 deletions.
11 changes: 11 additions & 0 deletions spec/indented-syntax/arguments.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<===> arguments/function/input.sass
@function increment($number, $by: 1)
@return $number + $by

.header
--var: #{increment(2,8)}

<===> arguments/function/output.css
.header {
--var: 10;
}
31 changes: 31 additions & 0 deletions spec/indented-syntax/comments.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<===> comments/loud/input.sass
/* Persist */
a
color: blue
<===> comments/loud/output.css
/* Persist */
a {
color: blue;
}

<===>
================================================================================
<===> comments/silent/input.sass
// Disappear
a
color: blue
// Disappear
<===> comments/silent/output.css
a {
color: blue;
}

<===>
================================================================================
<===> comments/whitespace/input.sass
a /* Disappear */
color: blue
<===> comments/whitespace/output.css
a {
color: blue;
}
33 changes: 33 additions & 0 deletions spec/indented-syntax/custom-properties.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<===> custom-properties/no-interpolation/input.sass
$b: 1
a
--key: $b

<===> custom-properties/no-interpolation/output.css
a {
--key: $b;
}

<===>
================================================================================
<===> custom-properties/interpolation/input.sass
$b: 1
a
--key: #{$b}

<===> custom-properties/interpolation/output.css
a {
--key: 1;
}

<===>
================================================================================
<===> custom-properties/interpolation-mix/input.sass
$b: 1
a
--key: $b #{$b}

<===> custom-properties/interpolation-mix/output.css
a {
--key: $b 1;
}
14 changes: 14 additions & 0 deletions spec/indented-syntax/each.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<===> each/each/input.sass
$sizes: 12px, 24px

@each $size in $sizes
.size-#{$size}
font-size: $size

<===> each/each/output.css
.size-12px {
font-size: 12px;
}
.size-24px {
font-size: 24px;
}
24 changes: 24 additions & 0 deletions spec/indented-syntax/for.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<===> for/through/input.sass
body
@for $i from 1 through 3
--item-#{$i}: #{$i * 2}

<===> for/through/output.css
body {
--item-1: 2;
--item-2: 4;
--item-3: 6;
}

<===>
================================================================================
<===> for/to/input.sass
body
@for $i from 1 to 3
--item-#{$i}: #{$i * 2}

<===> for/to/output.css
body {
--item-1: 2;
--item-2: 4;
}
36 changes: 36 additions & 0 deletions spec/indented-syntax/if.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<===> if/if/input.sass
$v: true
a
@if $v
value: 1

<===> if/if/output.css
a {
value: 1;
}

<===>
================================================================================
<===> if/if-statement/input.sass
$v: up
a
@if $v == up
value: 1

<===> if/if-statement/output.css
a {
value: 1;
}

<===>
================================================================================
<===> if/if-statement-wrapped/input.sass
$v: up
a
@if ($v == up)
value: 1

<===> if/if-statement-wrapped/output.css
a {
value: 1;
}
40 changes: 40 additions & 0 deletions spec/indented-syntax/lists.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<===> lists/inline/input.sass
$list: (1, 2)
a
value: $list

<===> lists/inline/output.css
a {
value: 1, 2;
}

<===>
================================================================================
<===> lists/inline-trailing-comma/input.sass
$list: 1, 2,
a
value: $list

<===> lists/inline-trailing-comma/output.css
a {
value: 1, 2;
}

<===>
================================================================================
<===> font-face/inline/input.sass
@font-face
font-family: 'Geneva'
src: url('fonts/geneva-webfont.eot')
src: url('fonts/geneva-webfont.eot?#iefix') format('embedded-opentype'), url('fonts/geneva-webfont.woff') format('woff'), url('fonts/geneva-webfont.ttf') format('truetype')
font-weight: normal
font-style: normal

<===> font-face/inline/output.css
@font-face {
font-family: "Geneva";
src: url("fonts/geneva-webfont.eot");
src: url("fonts/geneva-webfont.eot?#iefix") format("embedded-opentype"), url("fonts/geneva-webfont.woff") format("woff"), url("fonts/geneva-webfont.ttf") format("truetype");
font-weight: normal;
font-style: normal;
}
8 changes: 8 additions & 0 deletions spec/indented-syntax/operations.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<===> operations/equal/input.sass
a
value: 1 == 1

<===> operations/equal/output.css
a {
value: true;
}
36 changes: 36 additions & 0 deletions spec/indented-syntax/selectors.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<===> selectors/inline/input.sass
a .b, .c .d
value: 1

<===> selectors/inline/output.css
a .b, .c .d {
value: 1;
}

<===>
================================================================================
<===> selectors/multiline/input.sass
// Line breaks in selectors after a comma is ignored
a .b,
.c .d
value: 1

<===> selectors/multiline/output.css
a .b,
.c .d {
value: 1;
}

<===>
================================================================================
<===> selectors/whitespace/input.sass
// Whitespace in selectors after a comma is ignored
a .b,
.c .d
value: 1

<===> selectors/whitespace/output.css
a .b,
.c .d {
value: 1;
}
44 changes: 44 additions & 0 deletions spec/indented-syntax/style-rules.hrx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<===> style-rules/simple/input.sass
a
value: 1

<===> style-rules/simple/output.css
a {
value: 1;
}

<===>
================================================================================
<===> style-rules/nested/input.sass
a
.b
value: 1

<===> style-rules/nested/output.css
a .b {
value: 1;
}

<===>
================================================================================
<===> style-rules/nested-non-parent/input.sass
a
font
weight: 1

<===> style-rules/nested-non-parent/output.css
a font {
weight: 1;
}

<===>
================================================================================
<===> style-rules/nested-parent/input.sass
a
font:
weight: bold

<===> style-rules/nested-parent/output.css
a {
font-weight: bold;
}

0 comments on commit 5cf5060

Please sign in to comment.