generated from Tinkoff/angular-open-source-starter
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
97dc5a1
commit 4a5107b
Showing
3 changed files
with
41 additions
and
1 deletion.
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
File renamed without changes.
40 changes: 40 additions & 0 deletions
40
projects/kit/src/lib/masks/date-range/tests/pseudo-range-separators.spec.ts
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,40 @@ | ||
import {MASKITO_DEFAULT_OPTIONS, MaskitoOptions, maskitoTransform} from '@maskito/core'; | ||
import {maskitoDateRangeOptionsGenerator} from '@maskito/kit'; | ||
|
||
import {CHAR_EM_DASH, CHAR_EN_DASH, CHAR_HYPHEN, CHAR_MINUS} from '../../../constants'; | ||
|
||
describe('DateRange (maskitoTransform) | Pseudo range separators', () => { | ||
let options: MaskitoOptions = MASKITO_DEFAULT_OPTIONS; | ||
|
||
beforeEach(() => { | ||
options = maskitoDateRangeOptionsGenerator({ | ||
mode: 'dd/mm/yyyy', | ||
dateSeparator: '.', | ||
rangeSeparator: CHAR_EN_DASH, | ||
}); | ||
}); | ||
|
||
it('works with already valid range separator', () => { | ||
expect(maskitoTransform(`01012000${CHAR_EN_DASH}10102000`, options)).toBe( | ||
`01.01.2000${CHAR_EN_DASH}10.10.2000`, | ||
); | ||
}); | ||
|
||
it('replaces hyphen with valid range separator', () => { | ||
expect(maskitoTransform(`01012000${CHAR_HYPHEN}10102000`, options)).toBe( | ||
`01.01.2000${CHAR_EN_DASH}10.10.2000`, | ||
); | ||
}); | ||
|
||
it('replaces em-dash with valid range separator', () => { | ||
expect(maskitoTransform(`01012000${CHAR_EM_DASH}10102000`, options)).toBe( | ||
`01.01.2000${CHAR_EN_DASH}10.10.2000`, | ||
); | ||
}); | ||
|
||
it('replaces minus with valid range separator', () => { | ||
expect(maskitoTransform(`01012000${CHAR_MINUS}10102000`, options)).toBe( | ||
`01.01.2000${CHAR_EN_DASH}10.10.2000`, | ||
); | ||
}); | ||
}); |