forked from HHS/TANF-app
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into 2883-kibana-dashboard
- Loading branch information
Showing
6 changed files
with
206 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const toTitleCase = (str) => | ||
str && | ||
str.replace( | ||
/\w\S*/g, | ||
(txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase() | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { toTitleCase } from './stringUtils' | ||
|
||
describe('toTitleCase', () => { | ||
it.each([ | ||
['test me', 'Test Me'], | ||
['tribe', 'Tribe'], | ||
[' i like peanuts ', ' I Like Peanuts '], | ||
['jeffrey wuz 123here', 'Jeffrey Wuz 123here'], | ||
['', ''], | ||
[null, null], | ||
])('Capitalizes first char of each word', (original, expected) => { | ||
expect(toTitleCase(original)).toEqual(expected) | ||
}) | ||
}) |