1
- var expect = require ( " expect.js" ) ;
1
+ const expect = require ( ' expect.js' ) ;
2
2
3
- var HTMLHint = require ( " ../index" ) . HTMLHint ;
3
+ const HTMLHint = require ( ' ../index' ) . HTMLHint ;
4
4
5
- describe ( 'Core' , function ( ) {
6
-
7
- it ( 'Set false to rule no effected should result in an error' , function ( ) {
8
- var code = '<img src="test.gif" />' ;
9
- var messages = HTMLHint . verify ( code , {
10
- 'alt-require' : false
11
- } ) ;
5
+ describe ( 'Core' , function ( ) {
6
+ it ( 'Set false to rule no effected should result in an error' , function ( ) {
7
+ const code = '<img src="test.gif" />' ;
8
+ const messages = HTMLHint . verify ( code , { 'alt-require' : false } ) ;
12
9
expect ( messages . length ) . to . be ( 0 ) ;
13
10
} ) ;
14
11
15
- it ( 'Not load default ruleset when use undefined ruleset should result in an error' , function ( ) {
16
- var code = '<P ATTR=\'1\' id="a">><div id="a"><img src="" a="1" a="2"/></div>' ;
17
- var messages = HTMLHint . verify ( code ) ;
12
+ it ( 'Not load default ruleset when use undefined ruleset should result in an error' , function ( ) {
13
+ const code = '<P ATTR=\'1\' id="a">><div id="a"><img src="" a="1" a="2"/></div>' ;
14
+ const messages = HTMLHint . verify ( code ) ;
18
15
expect ( messages . length ) . to . be ( 9 ) ;
19
16
} ) ;
20
17
21
- it ( 'Not load default ruleset when use empty ruleset should result in an error' , function ( ) {
22
- var code = '<P ATTR=\'1\' id="a">><div id="a"><img src="" a="1" a="2"/></div>' ;
23
- var messages = HTMLHint . verify ( code , { } ) ;
18
+ it ( 'Not load default ruleset when use empty ruleset should result in an error' , function ( ) {
19
+ const code = '<P ATTR=\'1\' id="a">><div id="a"><img src="" a="1" a="2"/></div>' ;
20
+ const messages = HTMLHint . verify ( code , { } ) ;
24
21
expect ( messages . length ) . to . be ( 9 ) ;
25
22
} ) ;
26
23
27
- it ( 'Inline ruleset not worked should result in an error' , function ( ) {
28
- var code = '<!-- htmlhint alt-require:true-->\r\n<img src="test.gif" />' ;
29
- var messages = HTMLHint . verify ( code , {
24
+ it ( 'Inline ruleset not worked should result in an error' , function ( ) {
25
+ let code = '<!-- htmlhint alt-require:true-->\r\n<img src="test.gif" />' ;
26
+ let messages = HTMLHint . verify ( code , {
30
27
'alt-require' : false
31
28
} ) ;
32
29
@@ -42,20 +39,21 @@ describe('Core', function(){
42
39
expect ( messages . length ) . to . be ( 0 ) ;
43
40
} ) ;
44
41
45
- it ( 'Show formated result should not result in an error' , function ( ) {
46
- var code = 'tttttttttttttttttttttttttttttttttttt<div>中文<img src="test.gif" />tttttttttttttttttttttttttttttttttttttttttttttt' ;
47
- var messages = HTMLHint . verify ( code , {
42
+ it ( 'Show formated result should not result in an error' , function ( ) {
43
+ const code =
44
+ 'tttttttttttttttttttttttttttttttttttt<div>中文<img src="test.gif" />tttttttttttttttttttttttttttttttttttttttttttttt' ;
45
+ const messages = HTMLHint . verify ( code , {
48
46
'tag-pair' : true ,
49
47
'alt-require' : true
50
48
} ) ;
51
- var arrLogs = HTMLHint . format ( messages ) ;
49
+ let arrLogs = HTMLHint . format ( messages ) ;
52
50
expect ( arrLogs . length ) . to . be ( 4 ) ;
53
51
54
52
arrLogs = HTMLHint . format ( messages , {
55
53
colors : true ,
56
54
indent : 4
57
55
} ) ;
58
- var log = arrLogs [ 0 ] ;
56
+ const log = arrLogs [ 0 ] ;
59
57
expect ( / \[ 3 7 m / . test ( log ) ) . to . be ( true ) ;
60
58
expect ( / L 1 / . test ( log ) ) . to . be ( true ) ;
61
59
expect ( / | \. \. \. / . test ( log ) ) . to . be ( true ) ;
0 commit comments