-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathtest.js
19 lines (15 loc) · 953 Bytes
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
var assert = require('assert');
var htmlCommentRegex = require('./');
var html = '<!DOCTYPE html><!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]--> <!-- normal comment 1 --><!--normal comment 2--> <html lang="en"><head><meta charset="UTF-8"><title>Document</title></head><body></body></html>';
it('html should match the regex', function() {
var result = htmlCommentRegex.exec(html);
assert.deepEqual(result[0], '<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->');
assert.deepEqual(result[1], '[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]');
result = htmlCommentRegex.exec(html);
assert.deepEqual(result[0], '<!-- normal comment 1 -->');
assert.deepEqual(result[1], ' normal comment 1 ');
result = htmlCommentRegex.exec(html);
assert.deepEqual(result[0], '<!--normal comment 2-->');
assert.deepEqual(result[1], 'normal comment 2');
});