mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-04 08:57:49 +00:00
Add _.unescape method. [closes #63]
Former-commit-id: 10eada385fd0e1157271a2da6fb32de047d6d88a
This commit is contained in:
30
test/test.js
30
test/test.js
@@ -395,15 +395,11 @@
|
||||
QUnit.module('lodash.escape');
|
||||
|
||||
(function() {
|
||||
test('should not escape the ">" character', function() {
|
||||
equal(_.escape('>'), '>');
|
||||
});
|
||||
|
||||
test('should not escape the "/" character', function() {
|
||||
equal(_.escape('/'), '/');
|
||||
});
|
||||
|
||||
test('should return empty string when passed `null` or `undefined`', function() {
|
||||
test('should return an empty string when passed `null` or `undefined`', function() {
|
||||
equal(_.escape(null), '');
|
||||
equal(_.escape(undefined), '');
|
||||
});
|
||||
@@ -1540,6 +1536,30 @@
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.unescape');
|
||||
|
||||
(function() {
|
||||
test('should perform a case-insensitive replacement of numeric character references', function() {
|
||||
equal(_.unescape(''x''), "'x'");
|
||||
});
|
||||
|
||||
test('should unescape entities in the correct order', function() {
|
||||
equal(_.unescape('&lt;'), '<');
|
||||
});
|
||||
|
||||
test('should unescape the proper entities', function() {
|
||||
var escaped = '<h1>Moe's famous "death by chocolate" brownies & cake<\/h1>';
|
||||
equal(_.unescape(escaped), '<h1>Moe\'s famous "death by chocolate" brownies & cake<\/h1>');
|
||||
});
|
||||
|
||||
test('should return an empty string when passed `null` or `undefined`', function() {
|
||||
equal(_.unescape(null), '');
|
||||
equal(_.unescape(undefined), '');
|
||||
});
|
||||
}());
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
QUnit.module('lodash.uniq');
|
||||
|
||||
(function() {
|
||||
|
||||
Reference in New Issue
Block a user