-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix date input to accept any parsable date as value
- Loading branch information
Daniel Perez
committed
Aug 6, 2016
1 parent
ffc2a1b
commit eeefcbb
Showing
10 changed files
with
97 additions
and
10 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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
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,12 @@ | ||
import {expect} from 'chai' | ||
import {inputs} from 'riot-form' | ||
|
||
describe('DateInput', () => { | ||
describe('preProcessValue', () => { | ||
it('should return a formatted date', () => { | ||
const input = new inputs.DateInput({name: 'whatever'}) | ||
expect(input.preProcessValue('2016-08-06T06:15:38.864Z')).to.eq('2016-08-06') | ||
expect(input.preProcessValue('2016-08-31T06:15:38.864Z')).to.eq('2016-08-31') | ||
}) | ||
}) | ||
}) |
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,19 @@ | ||
import {expect} from 'chai' | ||
import * as util from 'riot-form/util' | ||
|
||
describe('util', () => { | ||
describe('capitalize', () => { | ||
it('should capitalize the string', () => { | ||
expect(util.capitalize('foobar')).to.eq('Foobar') | ||
expect(util.capitalize('Foobar')).to.eq('Foobar') | ||
expect(util.capitalize('hellOO')).to.eq('HellOO') | ||
}) | ||
}) | ||
|
||
describe('padLeft', () => { | ||
it('should pad string', () => { | ||
expect(util.padLeft('1', 2, '0')).to.eq('01') | ||
expect(util.padLeft('ab', 4, 'x')).to.eq('xxab') | ||
}) | ||
}) | ||
}) |