0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-13 22:41:32 -05:00

Merge pull request #2117 from aiampogi/Issue_2106

This commit is contained in:
Hannah Wolfe 2014-02-08 15:14:07 +00:00
commit 6dfe955311
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",