Skip to content

Commit b927eb6

Browse files
committed
test: less and scss files lint integration tests
1 parent 927d261 commit b927eb6

File tree

3 files changed

+116
-15
lines changed

3 files changed

+116
-15
lines changed

test/spec/Extn-CSSCodeHints-integ-test.js

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*
2020
*/
2121

22-
/*global describe, it, expect, beforeEach, awaitsFor, awaitsForDone, afterAll */
22+
/*global describe, it, expect, beforeAll, awaitsFor, awaitsForDone, afterAll */
2323

2424
define(function (require, exports, module) {
2525

@@ -37,7 +37,7 @@ define(function (require, exports, module) {
3737
editor,
3838
testFile = "css-lint-errors.css";
3939

40-
beforeEach(async function () {
40+
beforeAll(async function () {
4141
// Create a new window that will be shared by ALL tests in this spec.
4242
if (!testWindow) {
4343
testWindow = await SpecRunnerUtils.createTestWindowAndRun();
@@ -90,66 +90,77 @@ define(function (require, exports, module) {
9090
expect(popoverInfo.content.find(".code-inspection-item").text().trim()).toBe(expectedWarning);
9191
}
9292

93-
describe("CSS warnings quick view", function () {
94-
it("Should show warning", async function () {
93+
function runTests(testTyle) {
94+
it(`Should ${testTyle} show warning`, async function () {
9595
await checkCSSWarningAtPos("Do not use empty rulesets (emptyRules)", 2, 0);
9696
});
9797

98-
it("Should show no warning for imports", async function () {
98+
it(`Should ${testTyle} show no warning for imports`, async function () {
9999
await expectNoCSSLintQuickViewAtPos(1, 1);
100100
});
101101

102-
it("Should show duplicate properties warning", async function () {
102+
it(`Should ${testTyle} show duplicate properties warning`, async function () {
103103
await checkCSSWarningAtPos("Do not use duplicate style definitions (duplicateProperties)",
104104
5, 8);
105105
await checkCSSWarningAtPos("Do not use duplicate style definitions (duplicateProperties)",
106106
6, 8);
107107
});
108108

109-
it("Should show duplicate properties warning", async function () {
109+
it(`Should ${testTyle} show duplicate properties warning`, async function () {
110110
await checkCSSWarningAtPos("No unit for zero needed (zeroUnits)",
111111
10, 11);
112112
});
113113

114-
it("Should show no warning for box model", async function () {
114+
it(`Should ${testTyle} show no warning for box model`, async function () {
115115
// dont use width and height when using padding
116116
await expectNoCSSLintQuickViewAtPos(14, 8);
117117
await expectNoCSSLintQuickViewAtPos(15, 8);
118118
await expectNoCSSLintQuickViewAtPos(16, 8);
119119
});
120120

121-
it("Should show unknown properties warning", async function () {
121+
it(`Should ${testTyle} show unknown properties warning`, async function () {
122122
await checkCSSWarningAtPos("Unknown property: 'doesntExist' (unknownProperties)",
123123
20, 8);
124124
});
125125

126-
it("Should show ie hack warning", async function () {
126+
it(`Should ${testTyle} show ie hack warning`, async function () {
127127
await checkCSSWarningAtPos("IE hacks are only necessary when supporting IE7 and older (ieHack)",
128128
25, 8);
129129
});
130130

131-
it("Should show ignored due to display warning", async function () {
131+
it(`Should ${testTyle} show ignored due to display warning`, async function () {
132132
await checkCSSWarningAtPos("inline-block is ignored due to the float. If 'float' has a value other than 'none', the box is floated and 'display' is treated as 'block' (propertyIgnoredDueToDisplay)",
133133
30, 8);
134134
});
135135

136-
it("Should show no warning on !important", async function () {
136+
it(`Should ${testTyle} show no warning on !important`, async function () {
137137
await expectNoCSSLintQuickViewAtPos(34, 8);
138138
await expectNoCSSLintQuickViewAtPos(35, 8);
139139
});
140140

141-
it("Should show font-face warning", async function () {
141+
it(`Should ${testTyle} show font-face warning`, async function () {
142142
await checkCSSWarningAtPos("@font-face rule must define 'src' and 'font-family' properties (fontFaceProperties)",
143143
38, 8);
144144
await checkCSSWarningAtPos("@font-face rule must define 'src' and 'font-family' properties (fontFaceProperties)",
145145
39, 8);
146146
});
147147

148-
it("Should show unknown vendor prefix warning", async function () {
148+
it(`Should ${testTyle} show unknown vendor prefix warning`, async function () {
149149
await checkCSSWarningAtPos("Unknown vendor specific property. (unknownVendorSpecificProperties)Also define the standard property 'border-radius' for compatibility (vendorPrefix)",
150150
43, 8);
151151
});
152-
});
152+
}
153+
154+
const testFiles = ["css-lint-errors.css", "less-lint-errors.less", "less-lint-errors.scss"];
155+
156+
for(let localTestFile of testFiles){
157+
describe("CSS warnings quick view", function () {
158+
beforeAll(async function () {
159+
await awaitsForDone(SpecRunnerUtils.openProjectFiles([localTestFile]), "open test file: " + testFile);
160+
}, 30000);
153161

162+
runTests(localTestFile);
163+
});
164+
}
154165
});
155166
});
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@import "no-error.css";
2+
3+
.empty-css-error {}
4+
5+
.duplicate-properties-warning {
6+
color: red;
7+
color: blue;
8+
}
9+
10+
.zero-units-warning {
11+
width: 0px;
12+
}
13+
14+
.box-model-no-warning {
15+
width: 300px;
16+
padding: 50px;
17+
border: 5px solid black;
18+
}
19+
20+
.unknown-properties-warning {
21+
doesntExist: 300px;
22+
}
23+
24+
.ie-hack-warning {
25+
color: blue; /* For modern browsers */
26+
_color: red; /* This color is only for IE 6 and below */
27+
}
28+
29+
.property-ignored-due-to-display-warning {
30+
display: inline-block;
31+
float: right;
32+
}
33+
34+
.no-warnings-on-important {
35+
width: 0 !important;
36+
height: 0 !important;
37+
}
38+
39+
@font-face {
40+
font-family: 'needa default font warning';
41+
}
42+
43+
.unknown-vendor-prefix-warning {
44+
-microsoft-border-radius: 5px;
45+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
@import "no-error.css";
2+
3+
.empty-css-error {}
4+
5+
.duplicate-properties-warning {
6+
color: red;
7+
color: blue;
8+
}
9+
10+
.zero-units-warning {
11+
width: 0px;
12+
}
13+
14+
.box-model-no-warning {
15+
width: 300px;
16+
padding: 50px;
17+
border: 5px solid black;
18+
}
19+
20+
.unknown-properties-warning {
21+
doesntExist: 300px;
22+
}
23+
24+
.ie-hack-warning {
25+
color: blue; /* For modern browsers */
26+
_color: red; /* This color is only for IE 6 and below */
27+
}
28+
29+
.property-ignored-due-to-display-warning {
30+
display: inline-block;
31+
float: right;
32+
}
33+
34+
.no-warnings-on-important {
35+
width: 0 !important;
36+
height: 0 !important;
37+
}
38+
39+
@font-face {
40+
font-family: 'needa default font warning';
41+
}
42+
43+
.unknown-vendor-prefix-warning {
44+
-microsoft-border-radius: 5px;
45+
}

0 commit comments

Comments
 (0)