2
1
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2023-12-13 21:00:40 +01:00

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>");
});
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 () {
var html = "<p>Hello <strong>World! It's me!</strong></p>",
rendered = (

View file

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