|
150 | 150 | Assert.areEqual(1, result.messages.length);
|
151 | 151 | Assert.areEqual("warning", result.messages[0].type);
|
152 | 152 | Assert.areEqual("Fallback background-color (hex or RGB) should precede HSLA background-color.", result.messages[0].message);
|
153 |
| - } |
| 153 | + }, |
154 | 154 |
|
| 155 | + // border color tests |
155 | 156 |
|
156 |
| - |
| 157 | + "Using only a named border should not result in a warning": function(){ |
| 158 | + var result = CSSLint.verify(".hex { border: 1px solid red; }", { "fallback-colors": 1 }); |
| 159 | + Assert.areEqual(0, result.messages.length); |
| 160 | + }, |
| 161 | + |
| 162 | + "Using only a hex border should not result in a warning": function(){ |
| 163 | + var result = CSSLint.verify(".hex { border: 1px solid #fff; }", { "fallback-colors": 1 }); |
| 164 | + Assert.areEqual(0, result.messages.length); |
| 165 | + }, |
| 166 | + |
| 167 | + "Using only rgb() border should not result in a warning": function(){ |
| 168 | + var result = CSSLint.verify(".rgb { border: 1px solid rgb(0, 0, 0); }", { "fallback-colors": 1 }); |
| 169 | + Assert.areEqual(0, result.messages.length); |
| 170 | + }, |
| 171 | + |
| 172 | + "Using only rgba() border should result in a warning": function(){ |
| 173 | + var result = CSSLint.verify(".rgba { border: 1px solid rgba(0, 0, 0, 0.5); }", { "fallback-colors": 1 }); |
| 174 | + Assert.areEqual(1, result.messages.length); |
| 175 | + Assert.areEqual("warning", result.messages[0].type); |
| 176 | + Assert.areEqual("Fallback border (hex or RGB) should precede RGBA border.", result.messages[0].message); |
| 177 | + }, |
| 178 | + |
| 179 | + "Using only hsl() border should result in a warning": function(){ |
| 180 | + var result = CSSLint.verify(".hsl { border: 1px solid hsl(0, 0%, 0%); }", { "fallback-colors": 1 }); |
| 181 | + Assert.areEqual(1, result.messages.length); |
| 182 | + Assert.areEqual("warning", result.messages[0].type); |
| 183 | + Assert.areEqual("Fallback border (hex or RGB) should precede HSL border.", result.messages[0].message); |
| 184 | + }, |
| 185 | + |
| 186 | + "Using only hsla() border should result in a warning": function(){ |
| 187 | + var result = CSSLint.verify(".hsla { border: 1px solid hsla(0, 0%, 0%, 0.5); }", { "fallback-colors": 1 }); |
| 188 | + Assert.areEqual(1, result.messages.length); |
| 189 | + Assert.areEqual("warning", result.messages[0].type); |
| 190 | + Assert.areEqual("Fallback border (hex or RGB) should precede HSLA border.", result.messages[0].message); |
| 191 | + }, |
| 192 | + |
| 193 | + "Using rgba() with a fallback border should not result in a warning": function(){ |
| 194 | + var result = CSSLint.verify(".rgba { border: 1px solid #fff; border: 1px solid rgba(0, 0, 0, 0.5); }", { "fallback-colors": 1 }); |
| 195 | + Assert.areEqual(0, result.messages.length); |
| 196 | + }, |
| 197 | + |
| 198 | + "Using hsl() with a fallback border should not result in a warning": function(){ |
| 199 | + var result = CSSLint.verify(".hsl { border: 1px solid #fff; border: 1px solid hsl(0, 0%, 0%); }", { "fallback-colors": 1 }); |
| 200 | + Assert.areEqual(0, result.messages.length); |
| 201 | + }, |
| 202 | + |
| 203 | + "Using hsla() with a fallback border should not result in a warning": function(){ |
| 204 | + var result = CSSLint.verify(".hsla { border: 1px solid #fff; border: 1px solid hsla(0, 0%, 0%, 0.5); }", { "fallback-colors": 1 }); |
| 205 | + Assert.areEqual(0, result.messages.length); |
| 206 | + }, |
| 207 | + |
| 208 | + "Using rgba() with fallback border afterwards should result in a warning": function(){ |
| 209 | + var result = CSSLint.verify(".rgba { border: 1px solid rgba(0, 0, 0, 0.5); border: 1px solid #fff; }", { "fallback-colors": 1 }); |
| 210 | + Assert.areEqual(1, result.messages.length); |
| 211 | + Assert.areEqual("warning", result.messages[0].type); |
| 212 | + Assert.areEqual("Fallback border (hex or RGB) should precede RGBA border.", result.messages[0].message); |
| 213 | + }, |
| 214 | + |
| 215 | + "Using hsl() with fallback border afterwards should result in a warning": function(){ |
| 216 | + var result = CSSLint.verify(".hsl { border: 1px solid hsl(0, 0%, 0%); border: 1px solid #fff; }", { "fallback-colors": 1 }); |
| 217 | + Assert.areEqual(1, result.messages.length); |
| 218 | + Assert.areEqual("warning", result.messages[0].type); |
| 219 | + Assert.areEqual("Fallback border (hex or RGB) should precede HSL border.", result.messages[0].message); |
| 220 | + }, |
| 221 | + |
| 222 | + "Using hsla() with fallback border afterwards should result in a warning": function(){ |
| 223 | + var result = CSSLint.verify(".hsla { border: 1px solid hsla(0, 0%, 0%, 0.5); border: 1px solid #fff; }", { "fallback-colors": 1 }); |
| 224 | + Assert.areEqual(1, result.messages.length); |
| 225 | + Assert.areEqual("warning", result.messages[0].type); |
| 226 | + Assert.areEqual("Fallback border (hex or RGB) should precede HSLA border.", result.messages[0].message); |
| 227 | + } |
157 | 228 |
|
158 | 229 |
|
159 | 230 |
|
|
0 commit comments