@@ -60,6 +60,38 @@ define( [
60
60
! timeValue1 . equals ( timeValue2 ) ,
61
61
'instances encapsulating different values are not equal'
62
62
) ;
63
+ } ,
64
+
65
+ /**
66
+ * Tests the effect of the private pad() function, relevant in getSortKey() and toJSON().
67
+ *
68
+ * @since 0.7
69
+ *
70
+ * @param {QUnit } assert
71
+ */
72
+ testPad : function ( assert ) {
73
+ var testCases = {
74
+ '-123456789012-00-00T00:00:00Z' : '-123456789012-00-00T00:00:00Z' ,
75
+ '-12345678901-00-00T00:00:00Z' : '-12345678901-00-00T00:00:00Z' ,
76
+ '-1-1-1T01:01:01Z' : '-00000000001-01-01T01:01:01Z' ,
77
+ '1-1-1T01:01:01Z' : '+00000000001-01-01T01:01:01Z' ,
78
+ '12-00-00T00:00:00Z' : '+00000000012-00-00T00:00:00Z' ,
79
+ '1234567890-00-00T00:00:00Z' : '+01234567890-00-00T00:00:00Z' ,
80
+ '12345678901-00-00T00:00:00Z' : '+12345678901-00-00T00:00:00Z' ,
81
+ '123456789012-00-00T00:00:00Z' : '+123456789012-00-00T00:00:00Z' ,
82
+ '1234567890123456-00-00T00:00:00Z' : '+1234567890123456-00-00T00:00:00Z'
83
+ } ;
84
+
85
+ for ( var iso8601 in testCases ) {
86
+ var expected = testCases [ iso8601 ] ,
87
+ actual = new dv . TimeValue ( iso8601 ) . getSortKey ( ) ;
88
+
89
+ assert . ok (
90
+ expected === actual ,
91
+ 'Expected getSortKey() to return "' + expected + '", got "' + actual + '"'
92
+ ) ;
93
+
94
+ }
63
95
}
64
96
65
97
} ) ;
0 commit comments