Skip to content
This repository has been archived by the owner on May 17, 2023. It is now read-only.

fix ellipsis limit and test #4

Merged
merged 2 commits into from
Sep 9, 2015
Merged

fix ellipsis limit and test #4

merged 2 commits into from
Sep 9, 2015

Conversation

marianosimone
Copy link
Contributor

The ellipsis helper seem to be off regarding its limit.

In the docs it says: Shortens a string by removing words until string length is <= 'limit'..., but then the code was using < instead. Besides that, it was taking the space after the last word into account, when it shouldn't (as it's the last word, there shouldn't be a ws after it)

💃 my first PR in this repo!!!

@@ -1,7 +1,10 @@
describe('Handlebars.helpers.ellipsis', function() {

var tests = [
{ text: 'The quick brown fox', len: 12, expected: 'The quick...' }
{ text: '', len: 1, expected: undefined },
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not really sure if this should be the expected behavior. I'd rather get the input if it couldn't be ellipsed (but that's off topic here, maybe)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're completely right - it makes sense that if you pass an empty string you should get an empty string back. It's just a matter of changing this line to return "";.

Would you like to make the change it or shall I do it?

@andrey-p
Copy link
Contributor

andrey-p commented Sep 7, 2015

my first PR in this repo!!!

@marianosimone It's also the first PR from an open source contributor! This is pretty damn cool, thanks for helping out. I'll have a look at this shortly.

@andrey-p andrey-p self-assigned this Sep 7, 2015
@andrey-p
Copy link
Contributor

andrey-p commented Sep 8, 2015

It's all good 👍 If you can just add the small return "" tweak that'll be ready to merge.

@marianosimone
Copy link
Contributor Author

@andrey-p fixed!

@andrey-p
Copy link
Contributor

andrey-p commented Sep 9, 2015

Sweet, thanks for contributing!

andrey-p added a commit that referenced this pull request Sep 9, 2015
@andrey-p andrey-p merged commit eaf6dcb into duckduckgo:master Sep 9, 2015
@bsstoner
Copy link
Contributor

bsstoner commented Sep 9, 2015

thanks @marianosimone!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants