Skip to content

Commit

Permalink
Update dependencies and tests structure
Browse files Browse the repository at this point in the history
  • Loading branch information
crishpeen authored and adamkudrna committed Oct 20, 2017
1 parent 48250a7 commit 5925ecd
Show file tree
Hide file tree
Showing 7 changed files with 1,482 additions and 1,717 deletions.
13 changes: 11 additions & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,16 @@ root = true
[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.{js,json}]
indent_style = space
indent_size = 2

[*.css]
indent_style = space
indent_size = 4

[*.md]
trim_trailing_whitespace = false
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- "7.0"
- '8'
install:
- npm install
before_script:
Expand Down
3 changes: 3 additions & 0 deletions __tests__/css-invalid.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.element {
color: #000 !important;
}
69 changes: 69 additions & 0 deletions __tests__/css-valid.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
@import url(x.css);
@import url(y.css);

/**
* Multi-line comment
*/

.selector-1,
.selector-2,
.selector-3[type="text"] {
background: linear-gradient(#fff, rgba(0, 0, 0, 0.8));
box-sizing: border-box;
display: block;
color: #333;
}

.selector-a,
.selector-b:not(:first-child) {
padding: 10px;
top: calc(calc(1em * 2) / 3);
}

.selector-x { width: 10%; }
.selector-y { width: 20%; }
.selector-z { width: 30%; }

/* Single-line comment */

@media (min-width: 60em) {
.selector {
/* Flush to parent comment */
transform: translate(1, 1) scale(3);
}
}

@media (orientation: portrait), projection and (color) {
.selector-i + .selector-ii {
background: color(rgb(0, 0, 0) lightness(50%));
font-family: helvetica, "arial black", sans-serif;
}
}

/* Flush single line comment */
@media
screen and (min-resolution: 192dpi),
screen and (min-resolution: 2dppx) {
.selector {
background-image:
repeating-linear-gradient(
-45deg,
transparent,
#fff 25px,
rgba(255, 255, 255, 1) 50px
);
margin: 10px;
margin-bottom: 5px;
box-shadow:
0 1px 1px #000,
0 1px 0 #fff,
2px 2px 1px 1px #ccc inset;
height: 10rem;
}

/* Flush nested single line comment */
.selector::after {
content: '→';
background-image: url(x.svg);
}
}
82 changes: 3 additions & 79 deletions __tests__/index.js
Original file line number Diff line number Diff line change
@@ -1,85 +1,9 @@
const config = require('../');
const fs = require('fs');
const stylelint = require('stylelint');

const validCss = (
`@import url(x.css);
@import url(y.css);
/**
* Multi-line comment
*/
.selector-1,
.selector-2,
.selector-3[type="text"] {
background: linear-gradient(#fff, rgba(0, 0, 0, 0.8));
box-sizing: border-box;
display: block;
color: #333;
}
.selector-a,
.selector-b:not(:first-child) {
padding: 10px;
top: calc(calc(1em * 2) / 3);
}
.selector-x { width: 10%; }
.selector-y { width: 20%; }
.selector-z { width: 30%; }
/* Single-line comment */
@media (min-width >= 60em) {
.selector {
/* Flush to parent comment */
transform: translate(1, 1) scale(3);
}
}
@media (orientation: portrait), projection and (color) {
.selector-i + .selector-ii {
background: color(rgb(0, 0, 0) lightness(50%));
font-family: helvetica, "arial black", sans-serif;
}
}
/* Flush single line comment */
@media
screen and (min-resolution: 192dpi),
screen and (min-resolution: 2dppx) {
.selector {
background-image:
repeating-linear-gradient(
-45deg,
transparent,
#fff 25px,
rgba(255, 255, 255, 1) 50px
);
margin: 10px;
margin-bottom: 5px;
box-shadow:
0 1px 1px #000,
0 1px 0 #fff,
2px 2px 1px 1px #ccc inset;
height: 10rem;
}
/* Flush nested single line comment */
.selector::after {
content: '→';
background-image: url(x.svg);
}
}
`);

const invalidCss = (
`.element {
color: #000 !important;
}
`);
const validCss = fs.readFileSync('./__tests__/css-valid.css', 'utf-8');
const invalidCss = fs.readFileSync('./__tests__/css-invalid.css', 'utf-8');

describe('flags no warnings with valid CSS', () => {
let result;
Expand Down
Loading

0 comments on commit 5925ecd

Please sign in to comment.