-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUGFIX release-1-13] Fix string classify normalizer #12383
Conversation
}).replace(STRING_CLASSIFY_REGEXP_2, function(match, separator, chr) { | ||
return str | ||
.split('/') | ||
.map(function(piece) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't use Array.prototype.map
in release-1-13 (because it must support ES3 browsers), can you swap this to a for
loop instead to allow this to be pulled into those branches?
Changed. |
Can you also add tests for these scenarios:
|
Any issue with redoing all these tests as a sort of macro function? i.e. they're all like QUnit.test('classify normal string', function() {
deepEqual(classify('my favorite items'), 'MyFavoriteItems');
if (Ember.EXTEND_PROTOTYPES) {
deepEqual('my favorite items'.classify(), 'MyFavoriteItems');
}
}); -- could write one function function test(description, given, expected) {
QUnit.test(description, function() {
deepEqual(classify(given), expected);
if (Ember.EXTEND_PROTOTYPES) {
deepEqual(given.classify(), expected);
}
});
} and call it for all test cases. Would be easier to write them and easier to see all the different test cases. [Edit: and if so, should I make that a separate commit or amend it?] |
Ya, one commit with the fix and new tests (the old way), and a second commit that refactors to a saner structure sounds great. |
Only the first commit would be |
alright, have it done in a min |
Resolves emberjs#11326. If a piece of a name starts with dash (-), it will be changed into an underscore (_).
Looks great, thank you! |
[BUGFIX release-1-13] Fix string classify normalizer
Resolves #11326. If a piece of a name starts with dash (-), it will be changed into an underscore (_).