This repository was archived by the owner on Nov 16, 2018. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -6,16 +6,17 @@ const { TestUtils } = React.addons;
66describe ( "DateTimeField" , function ( ) {
77 const moment = require ( "moment" ) ;
88 const DateTimeField = require ( "../DateTimeField.js" ) ;
9+ const happyDate = moment ( "1990-06-05 07:30" ) ;
910 let parent , TestParent ;
1011
1112 beforeEach ( ( ) => {
1213 TestParent = React . createFactory ( React . createClass ( {
1314 getInitialState ( ) {
14- return { dateTime : moment ( "1990-06-05 07:30" ) . format ( "x" ) } ;
15+ return { dateTime : happyDate . format ( "x" ) } ;
1516 } ,
1617
1718 render ( ) {
18- return < DateTimeField dateTime = { this . state . dateTime } /> ;
19+ return < DateTimeField { ... this . state } /> ;
1920 }
2021 } ) ) ;
2122 parent = TestUtils . renderIntoDocument ( TestParent ( ) ) ; // eslint-disable-line
@@ -39,5 +40,12 @@ describe("DateTimeField", function() {
3940 expect ( input . getDOMNode ( ) . value ) . toBe ( "06/04/81 5:45 AM" ) ;
4041 } ) ;
4142
43+ it ( "changes the displayed format when inputFormat changes" , function ( ) {
44+ const input = TestUtils . findRenderedDOMComponentWithTag ( parent , "input" ) ;
45+ expect ( input . getDOMNode ( ) . value ) . toBe ( "06/05/90 7:30 AM" ) ;
46+ parent . setState ( { inputFormat : "x" } ) ;
47+ expect ( input . getDOMNode ( ) . value ) . toBe ( happyDate . format ( "x" ) ) ;
48+ } ) ;
49+
4250 } ) ;
4351} ) ;
You can’t perform that action at this time.
0 commit comments