12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- 'use strict';
- let _ = require('lodash');
- describe('no highlighting', function() {
- before(function() {
- const testHTML = document.querySelectorAll('#no-highlight pre');
- this.blocks = _.map(testHTML, 'children[0].innerHTML');
- this.expected = {
- html: '<div id="contents">\n ' +
- '<p>Hello, World!\n</div>',
- python: 'for x in [1, 2, 3]: count(x)',
- javascript: '<span class="hljs-keyword">var</span> x = ' +
- '<span class="hljs-string">\'foo\'</span>;'
- };
- });
- it('should keep block unchanged (nohighlight)', function() {
- const expected = this.expected.html,
- actual = this.blocks[0];
- actual.should.equal(expected);
- });
- it('should keep block unchanged (no-highlight)', function() {
- const expected = this.expected.html,
- actual = this.blocks[1];
- actual.should.equal(expected);
- });
- it('should keep block unchanged (plain)', function() {
- const expected = this.expected.html,
- actual = this.blocks[2];
- actual.should.equal(expected);
- });
- it('should keep block unchanged (text)', function() {
- const expected = this.expected.html,
- actual = this.blocks[3];
- actual.should.equal(expected);
- });
- it('should skip pre tags without a child code tag', function() {
- const expected = 'Computer output',
- actual = this.blocks[4];
- actual.should.equal(expected);
- });
- it('should keep block unchanged (unsupported language)', function() {
- const expected = this.expected.python,
- actual = this.blocks[5];
- actual.should.equal(expected);
- });
- it('should keep block unchanged (unsupported lang)', function() {
- const expected = this.expected.python,
- actual = this.blocks[6];
- actual.should.equal(expected);
- });
- it('should keep block unchanged (unsupported prefixed language)', function() {
- const expected = this.expected.python,
- actual = this.blocks[7];
- actual.should.equal(expected);
- });
- it('should highlight class names containing text at the start', function() {
- const expected = this.expected.javascript,
- actual = this.blocks[8];
- actual.should.equal(expected);
- });
- it('should highlight class names containing text at the end', function() {
- const expected = this.expected.javascript,
- actual = this.blocks[9];
- actual.should.equal(expected);
- });
- });
|