]> git.ipfire.org Git - thirdparty/moment.git/commitdiff
added test to demonstrate <24 hours in addition to >24 hours
authorIan Remmel <design@ianwremmel.com>
Thu, 12 Sep 2013 13:06:53 +0000 (09:06 -0400)
committerIan Remmel <design@ianwremmel.com>
Thu, 12 Sep 2013 13:06:53 +0000 (09:06 -0400)
test/moment/duration.js

index ed0605afba2c30f84be30c0613a06e410c3e4b77..7a9ef5462124d10340734c3e0ae399f8d63af11d 100644 (file)
@@ -150,7 +150,18 @@ exports.duration = {
         test.done();
     },
 
-    "instantiation from 24-hour time" : function (test) {
+    "instantiation from 24-hour time <24 hours" : function (test) {
+        test.expect(6);
+        test.equal(moment.duration("06:45").years(), 0, "0 years");
+        test.equal(moment.duration("06:45").days(), 0, "0 days");
+        test.equal(moment.duration("06:45").hours(), 6, "6 hours");
+        test.equal(moment.duration("06:45").minutes(), 45, "45 minutes");
+        test.equal(moment.duration("06:45").seconds(), 0, "0 seconds");
+        test.equal(moment.duration("06:45").milliseconds(), 0, "0 milliseconds");
+        test.done();
+    },
+
+    "instantiation from 24-hour time >24 hours" : function (test) {
         test.expect(6);
         test.equal(moment.duration("26:45").years(), 0, "0 years");
         test.equal(moment.duration("26:45").days(), 1, "0 days");