]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
add tests for ISO bubbling
authorJan Sandbrink <j.sandbrink@finn.de>
Mon, 4 May 2015 13:00:24 +0000 (15:00 +0200)
committerIskren Chernev <iskren.chernev@gmail.com>
Sun, 12 Jul 2015 23:57:20 +0000 (16:57 -0700)
src/test/moment/duration.js

index 5965303a78a56351d5e7b8177a2ab09170080691..b6fb7b33fcd13e135a7c632bad89b3e829223872 100644 (file)
@@ -258,6 +258,7 @@ test('serialization to ISO 8601 duration strings', function (assert) {
     assert.equal(moment.duration({s: -0.5}).toISOString(), '-PT0.5S', 'one half second ago');
     assert.equal(moment.duration({y: -0.5, M: 1}).toISOString(), '-P5M', 'a month after half a year ago');
     assert.equal(moment.duration({}).toISOString(), 'P0D', 'zero duration');
+    assert.equal(moment.duration({M: 16, d:40, s: 86465}).toISOString(), 'P1Y4M40DT24H1M5S', 'all fields');
 });
 
 test('toString acts as toISOString', function (assert) {
@@ -267,6 +268,7 @@ test('toString acts as toISOString', function (assert) {
     assert.equal(moment.duration({s: -0.5}).toString(), '-PT0.5S', 'one half second ago');
     assert.equal(moment.duration({y: -0.5, M: 1}).toString(), '-P5M', 'a month after half a year ago');
     assert.equal(moment.duration({}).toString(), 'P0D', 'zero duration');
+    assert.equal(moment.duration({M: 16, d:40, s: 86465}).toString(), 'P1Y4M40DT24H1M5S', 'all fields');
 });
 
 test('toIsoString deprecation', function (assert) {