Skip to content

Commit

Permalink
Change custom markup to asynchronous testing
Browse files Browse the repository at this point in the history
  • Loading branch information
sourrust committed Jun 17, 2015
1 parent c16cae9 commit e83cdc1
Showing 1 changed file with 10 additions and 16 deletions.
26 changes: 10 additions & 16 deletions test/special/customMarkup.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,46 +4,40 @@ var _ = require('lodash');
var fs = require('fs');
var utility = require('../utility');

var handleFile = utility.handleExpectedFile;

describe('custom markup', function() {
before(function() {
var testHTML = document.querySelectorAll('#custom-markup .hljs');

this.blocks = _.map(testHTML, 'innerHTML');
});

it('should replace tabs', function() {
it('should replace tabs', function(done) {
var filename = utility.buildPath('expect', 'tabreplace.txt'),

expected = fs.readFileSync(filename, 'utf-8'),
actual = this.blocks[0];

actual.should.equal(expected);
fs.readFile(filename, 'utf-8', handleFile(actual, done));
});

it('should keep custom markup', function() {
it('should keep custom markup', function(done) {
var filename = utility.buildPath('expect', 'custommarkup.txt'),

expected = fs.readFileSync(filename, 'utf-8'),
actual = this.blocks[1];

actual.should.equal(expected);
fs.readFile(filename, 'utf-8', handleFile(actual, done));
});

it('should keep custom markup and replace tabs', function() {
it('should keep custom markup and replace tabs', function(done) {
var filename = utility.buildPath('expect', 'customtabreplace.txt'),

expected = fs.readFileSync(filename, 'utf-8'),
actual = this.blocks[2];

actual.should.equal(expected);
fs.readFile(filename, 'utf-8', handleFile(actual, done));
});

it('should keep the same amount of void elements (<br>, <hr>, ...)', function() {
it('should keep the same amount of void elements (<br>, <hr>, ...)', function(done) {
var filename = utility.buildPath('expect', 'brInPre.txt'),

expected = fs.readFileSync(filename, 'utf-8'),
actual = this.blocks[3];

actual.should.equal(expected);
fs.readFile(filename, 'utf-8', handleFile(actual, done));
});
});

0 comments on commit e83cdc1

Please sign in to comment.