@@ -79,12 +79,8 @@ describe(`web worker CSS Language tests`, async function () {
7979 * - "compatibleVendorPrefixes": Unnecessary vendor prefixes checker.
8080 * - "vendorPrefix": Warns on missing vendor prefixes.
8181 * - "universalSelector": Warns against the use of the universal selector (*).
82- * - "fontFaceProperties": Ensures necessary properties are included in @font-face declarations.
8382 * - "hexColorLength": Enforces consistency in hex color definitions.
8483 * - "argumentsInColorFunction": Validates arguments within color functions.
85- * - "unknownVendorSpecificProperties": Flags vendor-specific properties that might not be universally recognized.
86- * - "propertyIgnoredDueToDisplay": Notifies when CSS properties are ignored due to the `display` setting of an element.
87- * - "important": Warns against the excessive use of `!important`.
8884 * - "float": Advises on the use of `float`, recommending modern layout alternatives.
8985 * - "idSelector": Advises against using ID selectors for styling.
9086 */
@@ -97,11 +93,72 @@ describe(`web worker CSS Language tests`, async function () {
9793 * unknownProperties: "warning"
9894 * ieHack: "warning"
9995 * propertyIgnoredDueToDisplay: "warning"
96+ * fontFaceProperties: "warning"
97+ * unknownVendorSpecificProperties: "warning"
10098 * // leave default
10199 * importStatement: none
102100 * boxModel: none
101+ * important: none
103102 */
104103
104+ it ( "should validate css unknownVendorSpecificProperties" , async function ( ) {
105+ const cssValidationData = await ( await fetch ( "test-files/cssValidationData.json" ) ) . json ( ) ;
106+ messageFromWorker = null ;
107+ const text = `div {
108+ -microsoft-border-radius: 5px;
109+ }` ;
110+ worker . postMessage ( {
111+ command : `validateCSS` , text, cssMode : "CSS" , filePath : "file:///c.css" , lintSettings : {
112+ unknownVendorSpecificProperties : "warning"
113+ }
114+ } ) ;
115+ let output = await waitForWorkerMessage ( `validateCSS` , 1000 ) ;
116+ const symbols = output . diag ;
117+ expect ( symbols ) . to . deep . equal ( cssValidationData [ "unknownVendorSpecificProperties" ] ) ;
118+ } ) ;
119+
120+ it ( "should validate css fontFaceProperties" , async function ( ) {
121+ const cssValidationData = await ( await fetch ( "test-files/cssValidationData.json" ) ) . json ( ) ;
122+ messageFromWorker = null ;
123+ const text = `@font-face {
124+ font-family: 'MyFont';
125+ }` ;
126+ worker . postMessage ( {
127+ command : `validateCSS` , text, cssMode : "CSS" , filePath : "file:///c.css" , lintSettings : {
128+ fontFaceProperties : "warning"
129+ }
130+ } ) ;
131+ let output = await waitForWorkerMessage ( `validateCSS` , 1000 ) ;
132+ const symbols = output . diag ;
133+ expect ( symbols ) . to . deep . equal ( cssValidationData [ "fontFaceProperties" ] ) ;
134+ } ) ;
135+
136+ it ( "should validate css fontFaceProperties by default" , async function ( ) {
137+ const cssValidationData = await ( await fetch ( "test-files/cssValidationData.json" ) ) . json ( ) ;
138+ messageFromWorker = null ;
139+ const text = `@font-face {
140+ font-family: 'MyFont';
141+ }` ;
142+ worker . postMessage ( {
143+ command : `validateCSS` , text, cssMode : "CSS" , filePath : "file:///c.css" } ) ;
144+ let output = await waitForWorkerMessage ( `validateCSS` , 1000 ) ;
145+ const symbols = output . diag ;
146+ expect ( symbols ) . to . deep . equal ( cssValidationData [ "fontFaceProperties" ] ) ;
147+ } ) ;
148+
149+ it ( "should not validate css important by default" , async function ( ) {
150+ messageFromWorker = null ;
151+ const text = `.element {
152+ width: 0 !important;
153+ height: 0 !important;
154+ }` ;
155+ worker . postMessage ( {
156+ command : `validateCSS` , text, cssMode : "CSS" , filePath : "file:///c.css" } ) ;
157+ let output = await waitForWorkerMessage ( `validateCSS` , 1000 ) ;
158+ const symbols = output . diag ;
159+ expect ( symbols ) . to . deep . equal ( [ ] ) ;
160+ } ) ;
161+
105162 it ( "should validate css propertyIgnoredDueToDisplay" , async function ( ) {
106163 const cssValidationData = await ( await fetch ( "test-files/cssValidationData.json" ) ) . json ( ) ;
107164 messageFromWorker = null ;
0 commit comments