-
Notifications
You must be signed in to change notification settings - Fork 557
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Port strings update from upstream removing multiline content/tooltips…
… (can confirm they didn't work) Remove non-existant tooltipOverrideLong props
- Loading branch information
Showing
6 changed files
with
216 additions
and
296 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,35 @@ | ||
import { createSearch, decodeHtmlEntities, toTitleCase } from './string'; | ||
|
||
describe('createSearch', () => { | ||
it('matches search terms correctly', () => { | ||
const search = createSearch('test', (obj: { value: string }) => obj.value); | ||
|
||
const obj1 = { value: 'This is a test string.' }; | ||
const obj2 = { value: 'This is a different string.' }; | ||
const obj3 = { value: 'This is a test string.' }; | ||
|
||
const objects = [obj1, obj2, obj3]; | ||
|
||
expect(objects.filter(search)).toEqual([obj1, obj3]); | ||
}); | ||
}); | ||
|
||
describe('toTitleCase', () => { | ||
it('converts strings to title case correctly', () => { | ||
expect(toTitleCase('hello world')).toBe('Hello World'); | ||
expect(toTitleCase('HELLO WORLD')).toBe('Hello World'); | ||
expect(toTitleCase('HeLLo wORLd')).toBe('Hello World'); | ||
expect(toTitleCase('a tale of two cities')).toBe('A Tale of Two Cities'); | ||
expect(toTitleCase('war and peace')).toBe('War and Peace'); | ||
}); | ||
}); | ||
|
||
describe('decodeHtmlEntities', () => { | ||
it('decodes HTML entities and removes unnecessary HTML tags correctly', () => { | ||
expect(decodeHtmlEntities('<br>')).toBe('\n'); | ||
expect(decodeHtmlEntities('<p>Hello World</p>')).toBe('Hello World'); | ||
expect(decodeHtmlEntities('&')).toBe('&'); | ||
expect(decodeHtmlEntities('&')).toBe('&'); | ||
expect(decodeHtmlEntities('&')).toBe('&'); | ||
}); | ||
}); |
Oops, something went wrong.