react-moment 0.7.5 → 0.7.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/tests/index.jsx CHANGED
@@ -109,6 +109,24 @@ describe('react-moment', () => {
109
109
  expect(ReactDOM.findDOMNode(date).innerHTML).toEqual(expected);
110
110
  });
111
111
 
112
+ it('fromNowDuring', () => {
113
+ const twoHoursAgo = moment().add(-2, 'hours');
114
+ const hour = 1e3 * 60 * 60;
115
+ const TWO_HOURS_AGO_ISO = twoHoursAgo.format();
116
+
117
+ let date = TestUtils.renderIntoDocument(
118
+ <Moment format="YYYY-MM-DD HH:mm" fromNowDuring={3 * hour}>{TWO_HOURS_AGO_ISO}</Moment>
119
+ );
120
+ let expected = twoHoursAgo.fromNow();
121
+ expect(ReactDOM.findDOMNode(date).innerHTML).toEqual(expected);
122
+
123
+ date = TestUtils.renderIntoDocument(
124
+ <Moment format="YYYY-MM-DD HH:mm" fromNowDuring={1 * hour}>{TWO_HOURS_AGO_ISO}</Moment>
125
+ );
126
+ expected = twoHoursAgo.format('YYYY-MM-DD HH:mm');
127
+ expect(ReactDOM.findDOMNode(date).innerHTML).toEqual(expected);
128
+ });
129
+
112
130
  it('from', () => {
113
131
  let date = TestUtils.renderIntoDocument(
114
132
  <Moment from="2016-09-20T12:00">{DATE_STRING}</Moment>