Skip to content

Commit

Permalink
make sure that there are tests for all operators
Browse files Browse the repository at this point in the history
  • Loading branch information
kristerkari committed Feb 6, 2019
1 parent ec0c106 commit 238b093
Showing 1 changed file with 111 additions and 0 deletions.
111 changes: 111 additions & 0 deletions src/rules/operator-no-unspaced/__tests__/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -1077,6 +1077,16 @@ testRule(rule, {
`,
description:
"background-image with relative path inside url function and interpolation."
},
{
code: `
$i: 10;
.thing {
background-image: url(https://99-0a.x.y.rackcdn.com/img/build/svg/arrow-#{$i / 2}-down-dark.svg);
}
`,
description:
"Op /: background-image with absolute path inside url function and interpolation."
}
],

Expand Down Expand Up @@ -1138,6 +1148,32 @@ testRule(rule, {
message: messages.expectedAfter("/"),
line: 4,
column: 62
},
{
code: `
$i: 10;
.thing {
background-image: url(https://99-0a.x.y.rackcdn.com/img/build/svg/arrow-#{$i /2}-down-dark.svg);
}
`,
description:
"Op /: background-image with relative path inside url function and interpolation.",
message: messages.expectedAfter("/"),
line: 4,
column: 86
},
{
code: `
$i: 10;
.thing {
background-image: url(https://99-0a.x.y.rackcdn.com/img/build/svg/arrow-#{$i/ 2}-down-dark.svg);
}
`,
description:
"Op /: background-image with relative path inside url function and interpolation.",
message: messages.expectedBefore("/"),
line: 4,
column: 85
}
]
});
Expand Down Expand Up @@ -1199,6 +1235,19 @@ testRule(rule, {
syntax: "scss",
skipBasicChecks: true,

accept: [
{
code: `
$i: 10;
.thing {
background-image: url(https://99-0a.x.y.rackcdn.com/img/build/svg/arrow-#{$i * 2}-down-dark.svg);
}
`,
description:
"Op *: background-image with absolute path inside url function and interpolation."
}
],

reject: [
{
code: "a { width: 10* 1; }",
Expand All @@ -1211,6 +1260,32 @@ testRule(rule, {
description: "Op: 10 *1.",
message: messages.expectedAfter("*"),
column: 15
},
{
code: `
$i: 10;
.thing {
background-image: url(https://99-0a.x.y.rackcdn.com/img/build/svg/arrow-#{$i *2}-down-dark.svg);
}
`,
description:
"Op *: background-image with relative path inside url function and interpolation.",
message: messages.expectedAfter("*"),
line: 4,
column: 86
},
{
code: `
$i: 10;
.thing {
background-image: url(https://99-0a.x.y.rackcdn.com/img/build/svg/arrow-#{$i* 2}-down-dark.svg);
}
`,
description:
"Op *: background-image with relative path inside url function and interpolation.",
message: messages.expectedBefore("*"),
line: 4,
column: 85
}
]
});
Expand Down Expand Up @@ -1290,6 +1365,16 @@ testRule(rule, {
{
code: "a { width: 10% - (1 + 3); }",
description: "10% - (1 + 3)."
},
{
code: `
$i: 10;
.thing {
background-image: url(https://99-0a.x.y.rackcdn.com/img/build/svg/arrow-#{$i % 2}-down-dark.svg);
}
`,
description:
"Op %: background-image with absolute path inside url function and interpolation."
}
],

Expand Down Expand Up @@ -1374,6 +1459,32 @@ testRule(rule, {
code: "a { width: 10% -(1 + 3); }",
description: "10% -(1 + 3).",
message: messages.expectedAfter("-")
},
{
code: `
$i: 10;
.thing {
background-image: url(https://99-0a.x.y.rackcdn.com/img/build/svg/arrow-#{$i %2}-down-dark.svg);
}
`,
description:
"Op %: background-image with relative path inside url function and interpolation.",
message: messages.expectedAfter("%"),
line: 4,
column: 86
},
{
code: `
$i: 10;
.thing {
background-image: url(https://99-0a.x.y.rackcdn.com/img/build/svg/arrow-#{$i% 2}-down-dark.svg);
}
`,
description:
"Op %: background-image with relative path inside url function and interpolation.",
message: messages.expectedBefore("%"),
line: 4,
column: 85
}
]
});
Expand Down

0 comments on commit 238b093

Please sign in to comment.