mirror of
https://github.com/postlight/mercury-parser
synced 2024-11-17 03:25:31 +00:00
fix: title wasn't cleaning html tags
This commit is contained in:
parent
956fd678f7
commit
d3b791d516
@ -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()
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user