blear.ui.code-highlight
Version:
代码高亮,基于 prism@1.17.1
50 lines (39 loc) • 1.14 kB
JavaScript
/**
* karma 测试 文件
* @author ydr.me
* @create 2016-05-17 12:13
*/
;
var codeHighlight = require('../src/index.js');
describe('blear.ui.code-highlight', function () {
it('highlight js', function (done) {
var text = 'var a = 1;';
var html = codeHighlight.text(text, 'js');
console.log(html);
done();
});
it('highlight css', function (done) {
var text = 'body { width: 100px;}';
var html = codeHighlight.text(text, 'css');
console.log(html);
done();
});
it('highlight html', function (done) {
var text = '<h1>Hello</h1>';
var html = codeHighlight.text(text, 'html');
console.log(html);
done();
});
it('highlight unkndow', function (done) {
var text = '<h1>Hello</h1>';
var html = codeHighlight.text(text, 'unkndow');
console.log(html);
done();
});
it('highlight wrap', function (done) {
var text = '<h1>Hello</h1>';
var html = codeHighlight.text(text, 'unkndow', true);
console.log(html);
done();
});
});