Skip to content

Commit d90f863

Browse files
authored
Add specs cover content-exists in control statements (#1637)
1 parent d05947b commit d90f863

1 file changed

Lines changed: 63 additions & 7 deletions

File tree

spec/core_functions/meta/content_exists.hrx

Lines changed: 63 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@
55

66
<===>
77
================================================================================
8+
<===> false/top_level/options.yml
9+
---
10+
:todo:
11+
- libsass
12+
813
<===> false/top_level/input.scss
914
@mixin a {
1015
b {c: content-exists()}
@@ -16,11 +21,6 @@ b {
1621
c: false;
1722
}
1823

19-
<===> false/top_level/options.yml
20-
---
21-
:todo:
22-
- libsass
23-
2424
<===>
2525
================================================================================
2626
<===> false/through_content/input.scss
@@ -57,6 +57,11 @@ b {
5757

5858
<===>
5959
================================================================================
60+
<===> true/non_empty/options.yml
61+
---
62+
:todo:
63+
- libsass
64+
6065
<===> true/non_empty/input.scss
6166
@mixin a {
6267
b {c: content-exists()}
@@ -75,10 +80,61 @@ d {
7580
e: f;
7681
}
7782

78-
<===> true/non_empty/options.yml
83+
<===>
84+
================================================================================
85+
<===> controls/true/options.yml
7986
---
8087
:todo:
81-
- libsass
88+
- sass/libsass#2842
89+
90+
<===> controls/true/input.scss
91+
// Regression test for sass/libsass#2842
92+
@mixin test-content-exists() {
93+
@if content-exists() {
94+
@content;
95+
}
96+
@else {
97+
content-exists: false;
98+
}
99+
}
100+
101+
a {
102+
@include test-content-exists() {
103+
content: present;
104+
}
105+
}
106+
107+
<===> controls/true/output.css
108+
a {
109+
content: present;
110+
}
111+
112+
<===>
113+
================================================================================
114+
<===> controls/false/options.yml
115+
---
116+
:todo:
117+
- sass/libsass#2842
118+
119+
<===> controls/false/input.scss
120+
// Regression test for sass/libsass#2842
121+
@mixin test-content-exists() {
122+
@if content-exists() {
123+
@content;
124+
}
125+
@else {
126+
content-exists: false;
127+
}
128+
}
129+
130+
a {
131+
@include test-content-exists();
132+
}
133+
134+
<===> controls/false/output.css
135+
a {
136+
content-exists: false;
137+
}
82138

83139
<===>
84140
================================================================================

0 commit comments

Comments
 (0)