Skip to content
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

Fixed string capitalize for accented characters #14764

Merged
merged 1 commit into from
Jul 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/ember-runtime/lib/system/string.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const UNDERSCORE_CACHE = new Cache(1000, function(str) {
replace(STRING_UNDERSCORE_REGEXP_2, '_').toLowerCase();
});

const STRING_CAPITALIZE_REGEXP = (/(^|\/)([a-z])/g);
const STRING_CAPITALIZE_REGEXP = (/(^|\/)([a-z\u00C0-\u024F])/g);

const CAPITALIZE_CACHE = new Cache(1000, function(str) {
return str.replace(STRING_CAPITALIZE_REGEXP, function(match, separator, chr) {
Expand Down
7 changes: 7 additions & 0 deletions packages/ember-runtime/tests/system/string/capitalize_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,10 @@ QUnit.test('capitalize namespaced dasherized string', function() {
deepEqual('private-docs/owner-invoice'.capitalize(), 'Private-docs/Owner-invoice');
}
});

QUnit.test('capitalize string with accent character', function() {
deepEqual(capitalize('šabc'), 'Šabc');
if (ENV.EXTEND_PROTOTYPES.String) {
deepEqual('šabc'.capitalize(), 'Šabc');
}
});