sproutcore 1.4.0.rc.3 → 1.4.0.rc.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION.yml
CHANGED
@@ -210,8 +210,13 @@ test("writing a string to a number attribute should store a number" ,function()
|
|
210
210
|
|
211
211
|
test("writing a date should generate an ISO date" ,function() {
|
212
212
|
var date = new Date(1238650083966);
|
213
|
-
|
214
|
-
|
213
|
+
|
214
|
+
// Work with timezones
|
215
|
+
var utcDate = new Date(Number(date) + (date.getTimezoneOffset() * 60000)); // Adjust for timezone offset
|
216
|
+
utcDate.getTimezoneOffset = function(){ return 0; }; // Hack the offset to respond 0
|
217
|
+
|
218
|
+
equals(rec.set('date', utcDate), rec, 'returns reciever');
|
219
|
+
equals(rec.readAttribute('date'), '2009-04-02T05:28:03Z', 'should have time in ISO format');
|
215
220
|
});
|
216
221
|
|
217
222
|
test("writing an attribute should make relationship aggregate dirty" ,function() {
|
@@ -9,15 +9,18 @@
|
|
9
9
|
module("SC.Validator.Date");
|
10
10
|
|
11
11
|
test("Converts into date if a value is given",function(){
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
12
|
+
var date = new Date(1234947136000),
|
13
|
+
utcDate = new Date(Number(date) + (date.getTimezoneOffset() * 60000)); // Adjust for timezone offset
|
14
|
+
|
15
|
+
var c = SC.Validator.Date.fieldValueForObject(Number(utcDate),'','');
|
16
|
+
var expected = "Feb 18, 2009 8:52:16 AM";
|
17
|
+
ok(c === expected, "Number converted to date format. Expected: (%@) but got (%@)".fmt(expected, c));
|
16
18
|
});
|
17
19
|
|
18
20
|
test("Converts into number when date string is given", function(){
|
19
|
-
var
|
20
|
-
var
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
var expected = 1234918336000;
|
22
|
+
var date = new Date(expected);
|
23
|
+
var d = SC.Validator.Date.objectForFieldValue(date.format('NNN d, yyyy h:mm:ss a'),'','');
|
24
|
+
ok(d === expected, "Date String compared with value in seconds. Expected: (%@) but got (%@)".fmt(expected, d));
|
25
|
+
ok(SC.typeOf(d) == "number", "Number is obtained");
|
26
|
+
});
|
@@ -175,7 +175,7 @@ test("Multiple arguments", function() {
|
|
175
175
|
SC.guidFor(obj1),
|
176
176
|
obj2.hash(),
|
177
177
|
SC.guidFor(str),
|
178
|
-
SC.guidFor(
|
178
|
+
SC.guidFor(arr)
|
179
179
|
].join('');
|
180
180
|
|
181
181
|
equals(h, SC.hashFor(obj1, obj2, str, arr), "hashFor should concatenate the arguments' hashes when there are more than one");
|