From 9835b3e123f5b82cb5087e99c277400b07238b90 Mon Sep 17 00:00:00 2001 From: Gavin Joyce Date: Fri, 5 Apr 2019 15:30:38 +0100 Subject: [PATCH] [BUGFIX beta] Don't capitalize characters following multiple forward slashes --- packages/@ember/string/index.ts | 2 +- packages/@ember/string/tests/capitalize_test.js | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/@ember/string/index.ts b/packages/@ember/string/index.ts index 7c9cb1df0a9..a242eb9c8d1 100644 --- a/packages/@ember/string/index.ts +++ b/packages/@ember/string/index.ts @@ -53,7 +53,7 @@ const UNDERSCORE_CACHE = new Cache(1000, str => .toLowerCase() ); -const STRING_CAPITALIZE_REGEXP = /(^|\/)([a-z\u00C0-\u024F])/g; +const STRING_CAPITALIZE_REGEXP = /(^|(?(1000, str => str.replace(STRING_CAPITALIZE_REGEXP, (match /*, separator, chr */) => match.toUpperCase()) diff --git a/packages/@ember/string/tests/capitalize_test.js b/packages/@ember/string/tests/capitalize_test.js index 3f5951802c5..1f9c6d2eba6 100644 --- a/packages/@ember/string/tests/capitalize_test.js +++ b/packages/@ember/string/tests/capitalize_test.js @@ -52,6 +52,12 @@ moduleFor( 'Private-docs/Owner-invoice', 'capitalize namespaced dasherized string' ); + test( + assert, + 'url is http://www.emberjs.com, not http:///www.emberjs.com', + 'Url is http://www.emberjs.com, not http:///www.emberjs.com', + 'does nothing with multiple slashes' + ); test(assert, 'šabc', 'Šabc', 'capitalize string with accent character'); } }