fix: title wasn't cleaning html tags

This commit is contained in:
Adam Pash 2016-09-01 13:45:00 -04:00
parent 956fd678f7
commit d3b791d516
2 changed files with 3 additions and 2 deletions

View File

@ -18,5 +18,6 @@ export default function cleanTitle(title, url, $) {
} }
} }
return title.trim() // strip any html tags in the title text
return stripTags(title, $).trim()
} }

View File

@ -20,8 +20,8 @@ describe('cleanTitle(title, $)', () => {
}) })
it('removes HTML tags from titles', () => { it('removes HTML tags from titles', () => {
const title = "Too Short"
const $ = cheerio.load(HTML.docWithTagsInH1.before) const $ = cheerio.load(HTML.docWithTagsInH1.before)
const title = $('h1').html()
assert.equal(cleanTitle(title, '', $), HTML.docWithTagsInH1.after) assert.equal(cleanTitle(title, '', $), HTML.docWithTagsInH1.after)
}) })