Skip to content

Commit 657521a

Browse files
committed
test parent mode closes propertly
1 parent 287421d commit 657521a

File tree

1 file changed

+28
-5
lines changed

1 file changed

+28
-5
lines changed

test/api/multiClassMatch.js

+28-5
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,20 @@ describe('multi-class matchers', () => {
2020
}
2121
]
2222
},
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+
},
2337
{
2438
match: [
2539
/func/,
@@ -33,8 +47,8 @@ describe('multi-class matchers', () => {
3347
}
3448
}
3549
]
36-
}
37-
}
50+
};
51+
};
3852
hljs.registerLanguage("test", grammar);
3953
});
4054
after(() => {
@@ -44,14 +58,23 @@ describe('multi-class matchers', () => {
4458
const code = "abcdef";
4559
const result = hljs.highlight(code, { language: 'test' });
4660

47-
result.relevance.should.equal(2);
4861
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+
});
5064
it('basic functionality', () => {
5165
const code = "func(){ test }";
5266
const result = hljs.highlight(code, { language: 'test' });
5367

54-
result.relevance.should.equal(1);
5568
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);
5670
});
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+
})
5780
});

0 commit comments

Comments
 (0)