UNPKG

956 Btext/coffeescriptView Raw
1require './setup'
2
3describe 'Syntax highlight', ->
4 describe 'non-examples', ->
5 beforeEach ->
6 @load '''
7 ``` html
8 <div>hello</div>
9 ```
10 '''
11
12 it 'should work', ->
13
14 it 'intact text', ->
15 expect(@$('pre').text().trim()).eq "<div>hello</div>"
16
17 it 'highlight', ->
18 expect(@$).have.selector 'pre .hljs-tag'
19 expect(@$).have.selector 'pre .hljs-title'
20
21 it 'set correct pre class', ->
22 expect(@$).have.selector 'pre.sg-lang-html'
23
24
25 describe 'examples', ->
26 beforeEach ->
27 @load '''
28 ### Buttons
29
30 @example
31 a.button.primary Primary button
32 a.button.success Success button
33 '''
34
35 it 'should work', ->
36
37 it 'should highlight', ->
38 expect(@$('.sg-code .hljs-tag').length).gte 4
39 expect(@$('.sg-code .hljs-value').length).gte 2
40 expect(@$('.sg-code .hljs-attribute').length).gte 2
41 expect(@$('.sg-code').html()).match /&lt;/
42