fix: truncatewords should use at least one word, #537

This commit is contained in:
Harttle
2022-10-21 14:40:25 +08:00
committed by Harttle
parent 71a1dc6e72
commit 32f613fb43
2 changed files with 8 additions and 3 deletions
@@ -172,6 +172,10 @@ describe('filters/string', function () {
})
})
describe('truncatewords', function () {
it('should truncate to 1 words if less than 1', function () {
return test('{{ "Ground control to Major Tom." | truncatewords: 0 }}',
'Ground...')
})
it('should truncate when too many words', function () {
return test('{{ "Ground control to Major Tom." | truncatewords: 3 }}',
'Ground control to...')