File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ export default {
34
34
const originalAttrs = JSON . stringify ( listOfAttributes )
35
35
listOfAttributes . sort ( ( a , b ) => {
36
36
if ( orderMap [ a ] == undefined && orderMap [ b ] == undefined ) {
37
- return 0
37
+ return a . localeCompare ( b )
38
38
}
39
39
if ( orderMap [ a ] == undefined ) {
40
40
return 1
Original file line number Diff line number Diff line change @@ -16,14 +16,24 @@ describe(`Rules: ${ruleId}`, () => {
16
16
expect ( messages [ 0 ] . message ) . toContain ( '["id","class","title"]' )
17
17
} )
18
18
19
- it ( 'Attribute unsorted tags that are unrecognizable should not throw error' , ( ) => {
20
- const code = '<div img="image" meta="meta" font="font "></div>'
19
+ it ( 'Attribute sorted tags that are unrecognizable should not throw error' , ( ) => {
20
+ const code = '<div font="font" img="image" meta="meta "></div>'
21
21
22
22
const messages = HTMLHint . verify ( code , ruleOptions )
23
23
24
24
expect ( messages . length ) . toBe ( 0 )
25
25
} )
26
26
27
+ it ( 'Attribute unsorted tags that are unrecognizable should throw error' , ( ) => {
28
+ const code = '<div img="image" meta="meta" font="font"></div>'
29
+
30
+ const messages = HTMLHint . verify ( code , ruleOptions )
31
+
32
+ expect ( messages . length ) . to . be ( 1 )
33
+ expect ( messages [ 0 ] . rule . id ) . to . be ( ruleId )
34
+ expect ( messages [ 0 ] . message ) . to . contain ( '["img","meta","font"]' )
35
+ } )
36
+
27
37
it ( 'Attribute unsorted of tags of various types should throw error' , ( ) => {
28
38
const code = '<div type="type" img="image" id="id" font="font"></div>'
29
39
You can’t perform that action at this time.
0 commit comments