@@ -14,6 +14,11 @@ const FIREFOX_1 = {
1414 version : "1" ,
1515} ;
1616
17+ const EDGE_18 = {
18+ id : "edge" ,
19+ version : "18" ,
20+ } ;
21+
1722test ( "a supported global attribute" , ( ) => {
1823 const elementName = "body" ;
1924 const attributes = [ { name : "id" , value : "test-id" } ] ;
@@ -28,6 +33,25 @@ test("a supported global attribute but different element", () => {
2833 expect ( issues . length ) . toBe ( 0 ) ;
2934} ) ;
3035
36+ test ( "a non supported global attribute" , ( ) => {
37+ const elementName = "body" ;
38+ const attributeName = "is" ;
39+ const attributeValue = "test" ;
40+ const attributes = [ { name : attributeName , value : attributeValue } ] ;
41+ const issues = webcompat . getHTMLElementIssues ( elementName , attributes , [ EDGE_18 ] ) ;
42+ expect ( issues . length ) . toBe ( 1 ) ;
43+
44+ const expectedIssue = {
45+ type : WebCompat . ISSUE_TYPE . HTML_ATTRIBUTE ,
46+ element : elementName ,
47+ attribute : attributeName ,
48+ value : attributeValue ,
49+ url : "https://developer.mozilla.org/docs/Web/HTML/Global_attributes/is" ,
50+ unsupportedBrowsers : [ EDGE_18 ] ,
51+ } ;
52+ assertIssue ( issues [ 0 ] , expectedIssue ) ;
53+ } ) ;
54+
3155test ( "a non supported html attribute" , ( ) => {
3256 const elementName = "a" ;
3357 const attributeName = "download" ;
@@ -42,6 +66,7 @@ test("a non supported html attribute", () => {
4266 element : elementName ,
4367 attribute : attributeName ,
4468 value : attributeValue ,
69+ url : "https://developer.mozilla.org/docs/Web/HTML/Element/a" ,
4570 unsupportedBrowsers : [ FIREFOX_1 ] ,
4671 } ;
4772 assertIssue ( issues [ 0 ] , expectedIssue ) ;
@@ -58,6 +83,7 @@ test("an experimental html attribute", () => {
5883 const expectedElementIssue = {
5984 type : WebCompat . ISSUE_TYPE . HTML_ELEMENT ,
6085 element : elementName ,
86+ url : "https://developer.mozilla.org/docs/Web/HTML/Element/menu" ,
6187 experimental : true ,
6288 unsupportedBrowsers : [ ] ,
6389 } ;
@@ -68,6 +94,7 @@ test("an experimental html attribute", () => {
6894 element : elementName ,
6995 attribute : attributeName ,
7096 value : attributeValue ,
97+ url : "https://developer.mozilla.org/docs/Web/HTML/Element/menu" ,
7198 experimental : true ,
7299 unsupportedBrowsers : [ ] ,
73100 } ;
@@ -87,6 +114,7 @@ test("a deprecated html attribute", () => {
87114 element : elementName ,
88115 attribute : attributeName ,
89116 value : attributeValue ,
117+ url : "https://developer.mozilla.org/docs/Web/HTML/Element/table" ,
90118 deprecated : true ,
91119 unsupportedBrowsers : [ ] ,
92120 } ;
@@ -115,6 +143,7 @@ function assertIssue(actualIssue, expectedIssue) {
115143 expect ( actualIssue . element ) . toBe ( expectedIssue . element ) ;
116144 expect ( actualIssue . attribute ) . toBe ( expectedIssue . attribute ) ;
117145 expect ( actualIssue . value ) . toBe ( expectedIssue . value ) ;
146+ expect ( actualIssue . url ) . toBe ( expectedIssue . url ) ;
118147 expect ( ! ! actualIssue . invalid ) . toBe ( ! ! expectedIssue . invalid ) ;
119148 expect ( ! ! actualIssue . deprecated ) . toBe ( ! ! expectedIssue . deprecated ) ;
120149 expect ( ! ! actualIssue . experimental ) . toBe ( ! ! expectedIssue . experimental ) ;
0 commit comments