Skip to content

Commit

Permalink
Fix tests to account for new syntax errors in PostCSS (#3892)
Browse files Browse the repository at this point in the history
* Fix usage of invalid double slashes

* Remove invalid CSS test
  • Loading branch information
jeddy3 committed Jan 16, 2019
1 parent 4e7f263 commit e4e758d
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 20 deletions.
25 changes: 19 additions & 6 deletions lib/rules/no-invalid-double-slash-comments/README.md
Expand Up @@ -3,7 +3,9 @@
Disallow double-slash comments (`//...`) which are not supported by CSS and [could lead to unexpected results](https://stackoverflow.com/a/20192639/130652).

```css
a { // color: pink; }
a {
//color: pink;
}
/** ↑
* This comment */
```
Expand All @@ -17,19 +19,30 @@ If you are using a preprocessor that allows `//` single-line comments (e.g. Sass
The following patterns are considered violations:

```css
a { // color: pink; }
a {
//color: pink;
}
```

```css
// a { color: pink; }
//a { color: pink; }
```

The following patterns are *not* considered violations:
```css
// Comment {}
a {
color: pink;
}
```

The following patterns are _not_ considered violations:

```css
a { /* color: pink; */ }
a {
/* color: pink; */
}
```

```css
/* a { color: pink; } */
/* a { color: pink; } */
```
19 changes: 13 additions & 6 deletions lib/rules/no-invalid-double-slash-comments/__tests__/index.js
Expand Up @@ -24,28 +24,35 @@ testRule(rule, {

reject: [
{
code: "a { // color: pink; }",
description: "before declaration",
code: "// Invalid comment {}\na {}",
description: "line before",
message: messages.rejected,
line: 1,
column: 5
column: 1
},
{
code: "a {\n//color: pink;\n}",
description: "before declaration",
message: messages.rejected,
line: 2,
column: 1
},
{
code: "// a { color: pink; }",
code: "//a { color: pink; }",
description: "before rule",
message: messages.rejected,
line: 1,
column: 1
},
{
code: "a, // div { color: pink; }",
code: "a, //div { color: pink; }",
description: "between rules",
message: messages.rejected,
line: 1,
column: 1
},
{
code: "// @media { }",
code: "//@media { }",
description: "before media rule",
message: messages.rejected,
line: 1,
Expand Down
8 changes: 0 additions & 8 deletions lib/rules/value-list-comma-space-after/__tests__/index.js
Expand Up @@ -180,14 +180,6 @@ testRule(rule, {
message: messages.rejectedAfter(),
line: 1,
column: 22
},
{
code: "a { pr, op: 0, 0; }",
fixed: "a { pr, op: 0,0; }",
description: "edge case",
message: messages.rejectedAfter(),
line: 1,
column: 7
}
]
});
Expand Down

0 comments on commit e4e758d

Please sign in to comment.