var assert = require('assert'), cleaner = require('./index.js'); // test that text is unchanged cleaner.clean('Foo Bar', function (html) { assert.equal(html, 'Foo Bar'); }); // test that non-breaking space is replaced cleaner.clean('Foo Bar', function (html) { assert.equal(html, 'Foo Bar'); }); cleaner.clean('Foo Bar', {'replace-nbsp': true}, function (html) { assert.equal(html, 'Foo Bar'); }); // test that extra whitespace is removed cleaner.clean('Foo Bar', function (html) { assert.equal(html, 'Foo Bar'); }); cleaner.clean('Foo\nBar', function (html) { assert.equal(html, 'Foo Bar'); }); // test that comments are removed cleaner.clean('', function (html) { assert.equal(html, ''); }); cleaner.clean('', {'remove-comments': true}, function (html) { assert.equal(html, ''); }); // test that lines breaks are added before and after comments cleaner.clean('fooqux', function (html) { assert.equal(html, 'foo\n\nqux'); }); cleaner.clean('fooqux', {'break-around-comments': false}, function (html) { assert.equal(html, 'fooqux'); }); // test that empty paragraph tags are removed cleaner.clean('
\n
', function (html) { assert.equal(html, '\n
'); }); cleaner.clean('\n
', {'remove-empty-paras': true}, function (html) { assert.equal(html, ''); }); // test that deprecated tags are removed cleaner.clean('foo', function (html) { assert.equal(html, 'foo'); }); // test that legacy attributes are removed cleaner.clean('foo', function (html) { assert.equal(html, 'foo'); }); // test that line break is added after br tag cleaner.clean('foo