@@ -89,5 +89,68 @@ describe('datetimepicker', function() {
89
89
expect ( util . _convert24to12 ( expectedValue + 12 * 3 ) ) . toBe ( "" + expectedValue ) ;
90
90
} )
91
91
} ) ;
92
+
93
+ describe ( 'detectSupport' , function ( ) {
94
+ it ( 'should detect support for hours' , function ( ) {
95
+ expect ( util . _detectSupport ( 'H' ) . hour ) . toBe ( true ) ;
96
+ expect ( util . _detectSupport ( 'HH' ) . hour ) . toBe ( true ) ;
97
+ expect ( util . _detectSupport ( 'h' ) . hour ) . toBe ( true ) ;
98
+ expect ( util . _detectSupport ( 'hh' ) . hour ) . toBe ( true ) ;
99
+
100
+ expect ( util . _detectSupport ( 'asdf' ) . hour ) . toBe ( false ) ;
101
+ } ) ;
102
+
103
+ it ( 'should detect support for minutes' , function ( ) {
104
+ expect ( util . _detectSupport ( 'm' ) . minute ) . toBe ( true ) ;
105
+ expect ( util . _detectSupport ( 'mm' ) . minute ) . toBe ( true ) ;
106
+
107
+ expect ( util . _detectSupport ( 'asdf' ) . minute ) . toBe ( false ) ;
108
+ } ) ;
109
+
110
+ it ( 'should detect support for seconds' , function ( ) {
111
+ expect ( util . _detectSupport ( 's' ) . second ) . toBe ( true ) ;
112
+ expect ( util . _detectSupport ( 'ss' ) . second ) . toBe ( true ) ;
113
+
114
+ expect ( util . _detectSupport ( 'acdf' ) . second ) . toBe ( false ) ;
115
+ } ) ;
116
+
117
+ it ( 'should detect support for milliseconds' , function ( ) {
118
+ expect ( util . _detectSupport ( 'l' ) . millisec ) . toBe ( true ) ;
119
+
120
+ expect ( util . _detectSupport ( 'acdf' ) . millisec ) . toBe ( false ) ;
121
+ } ) ;
122
+
123
+ it ( 'should detect support for microseconds' , function ( ) {
124
+ expect ( util . _detectSupport ( 'c' ) . microsec ) . toBe ( true ) ;
125
+
126
+ expect ( util . _detectSupport ( 'asdf' ) . microsec ) . toBe ( false ) ;
127
+ } ) ;
128
+
129
+ it ( 'should detect support for AM/PM' , function ( ) {
130
+ expect ( util . _detectSupport ( 'h t' ) . ampm ) . toBe ( true ) ;
131
+ expect ( util . _detectSupport ( 'h tt' ) . ampm ) . toBe ( true ) ;
132
+ expect ( util . _detectSupport ( 'h T' ) . ampm ) . toBe ( true ) ;
133
+ expect ( util . _detectSupport ( 'h TT' ) . ampm ) . toBe ( true ) ;
134
+
135
+ expect ( util . _detectSupport ( 't' ) . ampm ) . toBe ( false ) ;
136
+ expect ( util . _detectSupport ( 'h' ) . ampm ) . toBe ( false ) ;
137
+ expect ( util . _detectSupport ( 'H t' ) . ampm ) . toBe ( false ) ;
138
+ expect ( util . _detectSupport ( 'acdf' ) . ampm ) . toBe ( false ) ;
139
+ } ) ;
140
+
141
+ it ( 'should detect support for timezone' , function ( ) {
142
+ expect ( util . _detectSupport ( 'z' ) . timezone ) . toBe ( true ) ;
143
+ expect ( util . _detectSupport ( 'Z' ) . timezone ) . toBe ( true ) ;
144
+
145
+ expect ( util . _detectSupport ( 'acdf' ) . timezone ) . toBe ( false ) ;
146
+ } ) ;
147
+
148
+ it ( 'should detect support for iso8601' , function ( ) {
149
+ expect ( util . _detectSupport ( 'Z' ) . iso8601 ) . toBe ( true ) ;
150
+
151
+ expect ( util . _detectSupport ( 'z' ) . iso8601 ) . toBe ( false ) ;
152
+ expect ( util . _detectSupport ( 'acdf' ) . iso8601 ) . toBe ( false ) ;
153
+ } ) ;
154
+ } ) ;
92
155
} ) ;
93
156
} ) ;
0 commit comments