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

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