Updated downsize to 0.0.5

closes #2106
- downsize 0.0.5 contains the fix to accept single quote found inside a double-quote string or vice-versa
- created unit tests to properly check this scenario
This commit is contained in:
Aia Patag 2014-02-07 23:40:16 +08:00 committed by Hannah Wolfe
parent 37b7907c09
commit 4e5c624d9f
2 changed files with 115 additions and 87 deletions

View File

@ -110,6 +110,34 @@ describe('Core Helpers', function () {
rendered.string.should.equal("<p><img src='example.jpg' /></p>"); rendered.string.should.equal("<p><img src='example.jpg' /></p>");
}); });
it('can truncate html to 0 words, leaving image tag if it is first and if it has an alt text with a single quote in the string', function () {
var html = "<p><img src='example.jpg' alt=\"It's me!\" />Hello <strong>World! It's me!</strong></p>",
rendered = (
helpers.content
.call(
{ html: html },
{ "hash": { "words": "0" } }
)
);
should.exist(rendered);
rendered.string.should.equal("<p><img src='example.jpg' alt=\"It's me!\" /></p>");
});
it('can truncate html to 0 words, leaving image tag if it is first and if it has an alt text with a double quote in the string', function () {
var html = "<p><img src='example.jpg' alt='A double quote is \"' />Hello <strong>World! It's me!</strong></p>",
rendered = (
helpers.content
.call(
{ html: html },
{ "hash": { "words": "0" } }
)
);
should.exist(rendered);
rendered.string.should.equal("<p><img src='example.jpg' alt='A double quote is \"' /></p>");
});
it('can truncate html by character', function () { it('can truncate html by character', function () {
var html = "<p>Hello <strong>World! It's me!</strong></p>", var html = "<p>Hello <strong>World! It's me!</strong></p>",
rendered = ( rendered = (

View File

@ -37,7 +37,7 @@
"busboy": "0.0.12", "busboy": "0.0.12",
"colors": "0.6.2", "colors": "0.6.2",
"connect-slashes": "1.2.0", "connect-slashes": "1.2.0",
"downsize": "0.0.4", "downsize": "0.0.5",
"express": "3.4.6", "express": "3.4.6",
"express-hbs": "0.7.6", "express-hbs": "0.7.6",
"fs-extra": "0.8.1", "fs-extra": "0.8.1",