mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-03 16:47:49 +00:00
Simplify _.unescape to match the behavior of _.escape.
Former-commit-id: ec7f4cf9a6f44b1ba99f467c47d7e04d5596d76e
This commit is contained in:
12
test/test.js
12
test/test.js
@@ -1539,17 +1539,19 @@
|
||||
QUnit.module('lodash.unescape');
|
||||
|
||||
(function() {
|
||||
test('should perform a case-insensitive replacement of numeric character references', function() {
|
||||
equal(_.unescape(''x''), "'x'");
|
||||
});
|
||||
var escaped = '<h1>Moe's famous "death by chocolate" brownies & cake<\/h1>',
|
||||
unescaped = '<h1>Moe\'s famous "death by chocolate" brownies & cake<\/h1>';
|
||||
|
||||
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>');
|
||||
equal(_.unescape(escaped), unescaped);
|
||||
});
|
||||
|
||||
test('should unescape the same characters escaped by `_.escape`', function() {
|
||||
equal(_.unescape(_.escape(unescaped)), unescaped);
|
||||
});
|
||||
|
||||
test('should return an empty string when passed `null` or `undefined`', function() {
|
||||
|
||||
Reference in New Issue
Block a user