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

@ -1,87 +1,87 @@
{
"name" : "ghost",
"version" : "0.4.1",
"description" : "Just a blogging platform.",
"author" : "Ghost Foundation",
"homepage" : "http://ghost.org",
"keywords" : [
"ghost",
"blog",
"cms"
],
"repository" : {
"type": "git",
"url": "git://github.com/TryGhost/Ghost.git"
},
"bugs" : "https://github.com/TryGhost/Ghost/issues",
"contributors": "https://github.com/TryGhost/Ghost/graphs/contributors",
"private" : true,
"licenses" : [
{
"type": "MIT",
"url": "https://raw.github.com/TryGhost/Ghost/master/LICENSE"
}
],
"main": "./core/index",
"scripts": {
"start": "node index",
"test": "grunt validate --verbose"
},
"engines": {
"node": "~0.10.0"
},
"engineStrict": true,
"dependencies": {
"bcryptjs": "0.7.10",
"bookshelf": "0.6.1",
"busboy": "0.0.12",
"colors": "0.6.2",
"connect-slashes": "1.2.0",
"downsize": "0.0.4",
"express": "3.4.6",
"express-hbs": "0.7.6",
"fs-extra": "0.8.1",
"knex": "0.5.0",
"moment": "2.4.0",
"node-polyglot": "0.3.0",
"node-uuid": "1.4.1",
"nodemailer": "0.5.13",
"rss": "0.2.1",
"semver": "2.2.1",
"showdown": "0.3.1",
"sqlite3": "2.2.0",
"lodash": "2.4.1",
"unidecode": "0.1.3",
"validator": "1.4.0",
"when": "2.7.0"
},
"optionalDependencies": {
"mysql": "2.0.0-alpha9"
},
"devDependencies": {
"blanket": "~1.1.5",
"grunt": "~0.4.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-compress": "~0.5.2",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-handlebars": "~0.6.0",
"grunt-contrib-sass": "~0.5.0",
"grunt-contrib-uglify": "~0.2.5",
"grunt-contrib-watch": "~0.5.3",
"grunt-express-server": "~0.4.11",
"grunt-groc": "~0.4.0",
"grunt-jslint": "~1.1.1",
"grunt-mocha-cli": "~1.4.0",
"grunt-shell": "~0.6.1",
"grunt-update-submodules": "~0.2.1",
"matchdep": "~0.3.0",
"mocha": "~1.15.1",
"rewire": "~2.0.0",
"request": "~2.29.0",
"require-dir": "~0.1.0",
"should": "~2.1.1",
"sinon": "~1.7.3",
"supertest": "~0.8.2"
}
}
{
"name" : "ghost",
"version" : "0.4.1",
"description" : "Just a blogging platform.",
"author" : "Ghost Foundation",
"homepage" : "http://ghost.org",
"keywords" : [
"ghost",
"blog",
"cms"
],
"repository" : {
"type": "git",
"url": "git://github.com/TryGhost/Ghost.git"
},
"bugs" : "https://github.com/TryGhost/Ghost/issues",
"contributors": "https://github.com/TryGhost/Ghost/graphs/contributors",
"private" : true,
"licenses" : [
{
"type": "MIT",
"url": "https://raw.github.com/TryGhost/Ghost/master/LICENSE"
}
],
"main": "./core/index",
"scripts": {
"start": "node index",
"test": "grunt validate --verbose"
},
"engines": {
"node": "~0.10.0"
},
"engineStrict": true,
"dependencies": {
"bcryptjs": "0.7.10",
"bookshelf": "0.6.1",
"busboy": "0.0.12",
"colors": "0.6.2",
"connect-slashes": "1.2.0",
"downsize": "0.0.5",
"express": "3.4.6",
"express-hbs": "0.7.6",
"fs-extra": "0.8.1",
"knex": "0.5.0",
"moment": "2.4.0",
"node-polyglot": "0.3.0",
"node-uuid": "1.4.1",
"nodemailer": "0.5.13",
"rss": "0.2.1",
"semver": "2.2.1",
"showdown": "0.3.1",
"sqlite3": "2.2.0",
"lodash": "2.4.1",
"unidecode": "0.1.3",
"validator": "1.4.0",
"when": "2.7.0"
},
"optionalDependencies": {
"mysql": "2.0.0-alpha9"
},
"devDependencies": {
"blanket": "~1.1.5",
"grunt": "~0.4.1",
"grunt-contrib-clean": "~0.5.0",
"grunt-contrib-compress": "~0.5.2",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-handlebars": "~0.6.0",
"grunt-contrib-sass": "~0.5.0",
"grunt-contrib-uglify": "~0.2.5",
"grunt-contrib-watch": "~0.5.3",
"grunt-express-server": "~0.4.11",
"grunt-groc": "~0.4.0",
"grunt-jslint": "~1.1.1",
"grunt-mocha-cli": "~1.4.0",
"grunt-shell": "~0.6.1",
"grunt-update-submodules": "~0.2.1",
"matchdep": "~0.3.0",
"mocha": "~1.15.1",
"rewire": "~2.0.0",
"request": "~2.29.0",
"require-dir": "~0.1.0",
"should": "~2.1.1",
"sinon": "~1.7.3",
"supertest": "~0.8.2"
}
}