@@ -20,6 +20,20 @@ describe('multi-class matchers', () => {
20
20
}
21
21
]
22
22
} ,
23
+ {
24
+ className : "carrot" ,
25
+ begin : / \^ \^ \^ / ,
26
+ end : / \^ \^ \^ / ,
27
+ contains : [
28
+ {
29
+ begin : [ "a" , "b" , "c" ] ,
30
+ className : {
31
+ 1 : "a" ,
32
+ 3 : "c"
33
+ }
34
+ }
35
+ ]
36
+ } ,
23
37
{
24
38
match : [
25
39
/ f u n c / ,
@@ -33,8 +47,8 @@ describe('multi-class matchers', () => {
33
47
}
34
48
}
35
49
]
36
- }
37
- }
50
+ } ;
51
+ } ;
38
52
hljs . registerLanguage ( "test" , grammar ) ;
39
53
} ) ;
40
54
after ( ( ) => {
@@ -44,14 +58,23 @@ describe('multi-class matchers', () => {
44
58
const code = "abcdef" ;
45
59
const result = hljs . highlight ( code , { language : 'test' } ) ;
46
60
47
- result . relevance . should . equal ( 2 ) ;
48
61
result . value . should . equal ( `<span class="hljs-a">a</span>b<span class="hljs-c">c</span><span class="hljs-def">def</span>` ) ;
49
- } )
62
+ result . relevance . should . equal ( 2 ) ;
63
+ } ) ;
50
64
it ( 'basic functionality' , ( ) => {
51
65
const code = "func(){ test }" ;
52
66
const result = hljs . highlight ( code , { language : 'test' } ) ;
53
67
54
- result . relevance . should . equal ( 1 ) ;
55
68
result . value . should . equal ( `<span class="hljs-keyword">func</span><span class="hljs-params">()</span><span class="hljs-body">{ test }</span>` ) ;
69
+ result . relevance . should . equal ( 1 ) ;
56
70
} ) ;
71
+ it ( 'works inside a classified parent mode' , ( ) => {
72
+ const code = "^^^what abc now^^^" ;
73
+ const result = hljs . highlight ( code , { language : 'test' } ) ;
74
+
75
+ result . value . should . equal (
76
+ `<span class="hljs-carrot">^^^what ` +
77
+ `<span class="hljs-a">a</span>b<span class="hljs-c">c</span>` +
78
+ ` now^^^</span>` ) ;
79
+ } )
57
80
} ) ;
0 commit comments