mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-29 10:06:13 +01:00
Remove string.js dependency
This commit is contained in:
@@ -16,6 +16,28 @@ describe('Utility Methods', function () {
|
||||
var $ = global.$;
|
||||
global.window = window;
|
||||
|
||||
// https://github.com/jprichardson/string.js/blob/master/test/string.test.js
|
||||
it('should decode HTML entities', function (done) {
|
||||
assert.strictEqual(
|
||||
utils.decodeHTMLEntities('Ken Thompson & Dennis Ritchie'),
|
||||
'Ken Thompson & Dennis Ritchie'
|
||||
);
|
||||
assert.strictEqual(
|
||||
utils.decodeHTMLEntities('3 < 4'),
|
||||
'3 < 4'
|
||||
);
|
||||
assert.strictEqual(
|
||||
utils.decodeHTMLEntities('http://'),
|
||||
'http://'
|
||||
);
|
||||
done();
|
||||
});
|
||||
it('should strip HTML tags', function (done) {
|
||||
assert.strictEqual(utils.stripHTMLTags('<p>just <b>some</b> text</p>'), 'just some text');
|
||||
assert.strictEqual(utils.stripHTMLTags('<p>just <b>some</b> text</p>', ['p']), 'just <b>some</b> text');
|
||||
done();
|
||||
});
|
||||
|
||||
it('should preserve case if requested', function (done) {
|
||||
var slug = utils.slugify('UPPER CASE', true);
|
||||
assert.equal(slug, 'UPPER-CASE');
|
||||
|
||||
Reference in New Issue
Block a user