plain.js 797 B

12345678910111213141516171819202122232425262728
  1. 'use strict';
  2. let bluebird = require('bluebird');
  3. let jsdomEnv = bluebird.promisify(require('jsdom').env);
  4. let utility = require('../utility');
  5. let glob = bluebird.promisify(require('glob'));
  6. describe('plain browser', function() {
  7. before(function() {
  8. // Will match both `highlight.pack.js` and `highlight.min.js`
  9. const filepath = utility.buildPath('..', 'build', 'highlight.*.js');
  10. return glob(filepath)
  11. .then(hljsPath => jsdomEnv(this.html, hljsPath))
  12. .then(window => {
  13. this.block = window.document.querySelector('pre code');
  14. this.hljs = window.hljs;
  15. });
  16. });
  17. it('should highlight block', function() {
  18. this.hljs.highlightBlock(this.block);
  19. const actual = this.block.innerHTML;
  20. actual.should.equal(this.expect);
  21. });
  22. });