Move zeroPad function to BaseTypes and add tests for it
This commit is contained in:
@@ -278,6 +278,17 @@
|
||||
OpenLayers.Number.decimalSeparator = ",";
|
||||
t.eq(format(num, 3), "12.345,679", "changing thousands/decimal separator globally works");
|
||||
}
|
||||
|
||||
function test_Number_zeroPad(t) {
|
||||
t.plan(6);
|
||||
var pad = OpenLayers.Number.zeroPad;
|
||||
t.eq(pad(15, 4), "0015", "left padding works");
|
||||
t.eq(pad(15, 2), "15", "no left padding when equal to number of digits");
|
||||
t.eq(pad(15, 1), "15", "no left padding when less than number of digits");
|
||||
t.eq(pad(10, 5, 2), "01010", "radix modified and padding works");
|
||||
t.eq(pad(10, 5, 8), "00012", "radix modified and padding works");
|
||||
t.eq(pad(10, 5, 36), "0000a", "radix modified and padding works");
|
||||
}
|
||||
|
||||
function test_Function_bind(t) {
|
||||
t.plan(12);
|
||||
|
||||
Reference in New Issue
Block a user