@@ -20,159 +20,136 @@ const FIREFOX_4 = {
2020 version : "4" ,
2121} ;
2222
23- test ( "<length> type" , ( ) => {
24- const supportedUnits = [
25- "cap" , "ch" , "em" , "ex" , "ic" , "lh" , "rem" , "rlh" , "vh" , "vw" , "vi" , "vb" ,
26- "vmin" , "vmax" , "px" , "cm" , "mm" , "Q" , "in" , "pc" , "pt" , "mozmm" ,
27- ] ;
28-
29- const declarations = [
30- {
31- // <length> type allows 0.
32- name : "padding" ,
33- value : 0 ,
34- }
35- ] ;
36-
37- for ( const unit of supportedUnits ) {
38- declarations . push ( { name : "padding" , value : `1${ unit } ` } ) ;
39- }
40-
41- // Even if there are several issues such as experimental value, they should be valid.
42- const issues = webcompat . getCSSDeclarationBlockIssues ( declarations , [ FIREFOX_69 ] ) ;
43- expect ( issues . every ( i => ! i . invalid ) ) . toBe ( true ) ;
44- } ) ;
45-
46- test ( "<percentage> type" , ( ) => {
23+ test ( "a supported css value" , ( ) => {
4724 const declarations = [
4825 {
49- name : "padding " ,
50- value : "1% " ,
26+ name : "display " ,
27+ value : "inline-table " ,
5128 }
5229 ] ;
5330
5431 const issues = webcompat . getCSSDeclarationBlockIssues ( declarations , [ FIREFOX_69 ] ) ;
5532 expect ( issues . length ) . toBe ( 0 ) ;
5633} ) ;
5734
58- test ( "<calc> type " , ( ) => {
35+ test ( "a non supported css value " , ( ) => {
5936 const declarations = [
6037 {
61- name : "padding " ,
62- value : "calc(1px + 1%) " ,
38+ name : "display " ,
39+ value : "inline-table " ,
6340 }
6441 ] ;
6542
66- const issues = webcompat . getCSSDeclarationBlockIssues ( declarations , [ FIREFOX_69 ] ) ;
67- expect ( issues . length ) . toBe ( 0 ) ;
43+ const issues = webcompat . getCSSDeclarationBlockIssues ( declarations , [ FIREFOX_1 ] ) ;
44+ expect ( issues . length ) . toBe ( 1 ) ;
45+
46+ const expectedIssue = {
47+ type : WebCompat . ISSUE_TYPE . CSS_VALUE ,
48+ property : "display" ,
49+ value : "inline-table" ,
50+ unsupportedBrowsers : [ FIREFOX_1 ] ,
51+ } ;
52+ assertIssue ( issues [ 0 ] , expectedIssue ) ;
6853} ) ;
6954
70- test ( "<url> type " , ( ) => {
55+ test ( "an experimental css value " , ( ) => {
7156 const declarations = [
7257 {
73- name : "background-image " ,
74- value : "url(sample.png) " ,
58+ name : "display " ,
59+ value : "flow-root " ,
7560 }
7661 ] ;
7762
7863 const issues = webcompat . getCSSDeclarationBlockIssues ( declarations , [ FIREFOX_69 ] ) ;
79- expect ( issues . length ) . toBe ( 0 ) ;
64+ expect ( issues . length ) . toBe ( 1 ) ;
65+
66+ const expectedIssue = {
67+ type : WebCompat . ISSUE_TYPE . CSS_VALUE ,
68+ experimental : true ,
69+ property : "display" ,
70+ value : "flow-root" ,
71+ unsupportedBrowsers : [ ] ,
72+ } ;
73+ assertIssue ( issues [ 0 ] , expectedIssue ) ;
8074} ) ;
8175
82- test ( "global keywords type " , ( ) => {
76+ test ( "an deprecated css value " , ( ) => {
8377 const declarations = [
8478 {
85- name : "padding" ,
86- value : "initial" ,
87- } ,
88- {
89- name : "padding" ,
90- value : "inherit" ,
91- } ,
92- {
93- name : "padding" ,
94- value : "unset" ,
79+ name : "display" ,
80+ value : "subgrid" ,
9581 }
9682 ] ;
9783
9884 const issues = webcompat . getCSSDeclarationBlockIssues ( declarations , [ FIREFOX_69 ] ) ;
99- expect ( issues . length ) . toBe ( 0 ) ;
85+ expect ( issues . length ) . toBe ( 1 ) ;
86+
87+ const expectedIssue = {
88+ type : WebCompat . ISSUE_TYPE . CSS_VALUE ,
89+ deprecated : true ,
90+ property : "display" ,
91+ value : "subgrid" ,
92+ unsupportedBrowsers : [ FIREFOX_69 ] ,
93+ } ;
94+ assertIssue ( issues [ 0 ] , expectedIssue ) ;
10095} ) ;
10196
102- test ( "unknown value " , ( ) => {
97+ test ( "mapped css types " , ( ) => {
10398 const declarations = [
10499 {
105100 name : "padding" ,
106- value : "invalid-value " ,
101+ value : "1rem " ,
107102 }
108103 ] ;
109104
110- const issues = webcompat . getCSSDeclarationBlockIssues ( declarations , [ FIREFOX_69 ] ) ;
105+ const issues = webcompat . getCSSDeclarationBlockIssues ( declarations , [ FIREFOX_1 ] ) ;
111106 expect ( issues . length ) . toBe ( 1 ) ;
112107
113108 const expectedIssue = {
114109 type : WebCompat . ISSUE_TYPE . CSS_VALUE ,
115- invalid : true ,
116110 property : "padding" ,
117- value : "invalid-value " ,
118- unsupportedBrowsers : [ ] ,
111+ value : "1rem " ,
112+ unsupportedBrowsers : [ FIREFOX_1 ] ,
119113 } ;
120114 assertIssue ( issues [ 0 ] , expectedIssue ) ;
121115} ) ;
122116
123- test ( "unacceptable value" , ( ) => {
117+ test ( "invalid value" , ( ) => {
124118 const declarations = [
125119 {
126120 name : "padding" ,
127- value : 50 ,
121+ value : "invalid-value" ,
128122 }
129123 ] ;
130124
131125 const issues = webcompat . getCSSDeclarationBlockIssues ( declarations , [ FIREFOX_69 ] ) ;
132- expect ( issues . length ) . toBe ( 1 ) ;
133-
134- const expectedIssue = {
135- type : WebCompat . ISSUE_TYPE . CSS_VALUE ,
136- invalid : true ,
137- property : "padding" ,
138- value : 50 ,
139- unsupportedBrowsers : [ ] ,
140- } ;
141- assertIssue ( issues [ 0 ] , expectedIssue ) ;
126+ expect ( issues . length ) . toBe ( 0 ) ;
142127} ) ;
143128
144- test ( "valid and invalid mixed value in shorthand property" , ( ) => {
129+ test ( "mixed type in shorthand property" , ( ) => {
145130 const declarations = [
146131 {
147132 name : "padding" ,
148- value : "solid 10 5deg 1px" ,
133+ value : "solid 1rem 1mozmm 1px" ,
149134 }
150135 ] ;
151136
152- const issues = webcompat . getCSSDeclarationBlockIssues ( declarations , [ FIREFOX_69 ] ) ;
153- expect ( issues . length ) . toBe ( 3 ) ;
137+ const issues = webcompat . getCSSDeclarationBlockIssues ( declarations , [ FIREFOX_1 ] ) ;
138+ expect ( issues . length ) . toBe ( 2 ) ;
154139
155140 const expectedIssues = [
156141 {
157142 type : WebCompat . ISSUE_TYPE . CSS_VALUE ,
158- invalid : true ,
159- property : "padding" ,
160- value : "solid" ,
161- unsupportedBrowsers : [ ] ,
162- } ,
163- {
164- type : WebCompat . ISSUE_TYPE . CSS_VALUE ,
165- invalid : true ,
166143 property : "padding" ,
167- value : 10 ,
168- unsupportedBrowsers : [ ] ,
144+ value : "1rem" ,
145+ unsupportedBrowsers : [ FIREFOX_1 ] ,
169146 } ,
170147 {
171148 type : WebCompat . ISSUE_TYPE . CSS_VALUE ,
172- invalid : true ,
149+ experimental : true ,
173150 property : "padding" ,
174- value : "5deg " ,
175- unsupportedBrowsers : [ ] ,
151+ value : "1mozmm " ,
152+ unsupportedBrowsers : [ FIREFOX_1 ] ,
176153 } ,
177154 ] ;
178155
@@ -231,7 +208,6 @@ function assertIssue(actualIssue, expectedIssue) {
231208 expect ( actualIssue . property ) . toBe ( expectedIssue . property ) ;
232209 expect ( actualIssue . value ) . toBe ( expectedIssue . value ) ;
233210 expect ( actualIssue . issueTerm ) . toBe ( expectedIssue . issueTerm ) ;
234- expect ( ! ! actualIssue . invalid ) . toBe ( ! ! expectedIssue . invalid ) ;
235211 expect ( ! ! actualIssue . deprecated ) . toBe ( ! ! expectedIssue . deprecated ) ;
236212 expect ( ! ! actualIssue . experimental ) . toBe ( ! ! expectedIssue . experimental ) ;
237213 expect ( ! ! actualIssue . unsupportedBrowsers ) . toBe ( ! ! expectedIssue . unsupportedBrowsers ) ;
0 commit comments