jasmine-core 1.2.0.rc1 → 1.2.0.rc2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/jasmine-core/example/SpecRunner.html +2 -2
- data/lib/jasmine-core/jasmine-html.js +42 -87
- data/lib/jasmine-core/jasmine.css +79 -411
- data/lib/jasmine-core/jasmine.js +245 -192
- data/lib/jasmine-core/spec/core/MatchersSpec.js +273 -0
- data/lib/jasmine-core/spec/core/PrettyPrintSpec.js +7 -0
- data/lib/jasmine-core/spec/html/HTMLReporterSpec.js +23 -8
- data/lib/jasmine-core/spec/node_suite.js +2 -2
- data/lib/jasmine-core/version.rb +1 -1
- metadata +120 -62
data/lib/jasmine-core/jasmine.js
CHANGED
@@ -196,6 +196,21 @@ jasmine.any = function(clazz) {
|
|
196
196
|
return new jasmine.Matchers.Any(clazz);
|
197
197
|
};
|
198
198
|
|
199
|
+
/**
|
200
|
+
* Returns a matchable subset of a JSON object. For use in expectations when you don't care about all of the
|
201
|
+
* attributes on the object.
|
202
|
+
*
|
203
|
+
* @example
|
204
|
+
* // don't care about any other attributes than foo.
|
205
|
+
* expect(mySpy).toHaveBeenCalledWith(jasmine.objectContaining({foo: "bar"});
|
206
|
+
*
|
207
|
+
* @param sample {Object} sample
|
208
|
+
* @returns matchable object for the sample
|
209
|
+
*/
|
210
|
+
jasmine.objectContaining = function (sample) {
|
211
|
+
return new jasmine.Matchers.ObjectContaining(sample);
|
212
|
+
};
|
213
|
+
|
199
214
|
/**
|
200
215
|
* Jasmine Spies are test doubles that can act as stubs, spies, fakes or when used in an expecation, mocks.
|
201
216
|
*
|
@@ -914,11 +929,19 @@ jasmine.Env.prototype.equals_ = function(a, b, mismatchKeys, mismatchValues) {
|
|
914
929
|
return a.getTime() == b.getTime();
|
915
930
|
}
|
916
931
|
|
917
|
-
if (a
|
932
|
+
if (a.jasmineMatches) {
|
933
|
+
return a.jasmineMatches(b);
|
934
|
+
}
|
935
|
+
|
936
|
+
if (b.jasmineMatches) {
|
937
|
+
return b.jasmineMatches(a);
|
938
|
+
}
|
939
|
+
|
940
|
+
if (a instanceof jasmine.Matchers.ObjectContaining) {
|
918
941
|
return a.matches(b);
|
919
942
|
}
|
920
943
|
|
921
|
-
if (b instanceof jasmine.Matchers.
|
944
|
+
if (b instanceof jasmine.Matchers.ObjectContaining) {
|
922
945
|
return b.matches(a);
|
923
946
|
}
|
924
947
|
|
@@ -1212,7 +1235,7 @@ jasmine.Matchers.prototype.toEqual = function(expected) {
|
|
1212
1235
|
/**
|
1213
1236
|
* toNotEqual: compares the actual to the expected using the ! of jasmine.Matchers.toEqual
|
1214
1237
|
* @param expected
|
1215
|
-
* @deprecated as of 1.0. Use not.
|
1238
|
+
* @deprecated as of 1.0. Use not.toEqual() instead.
|
1216
1239
|
*/
|
1217
1240
|
jasmine.Matchers.prototype.toNotEqual = function(expected) {
|
1218
1241
|
return !this.env.equals_(this.actual, expected);
|
@@ -1385,7 +1408,7 @@ jasmine.Matchers.prototype.toContain = function(expected) {
|
|
1385
1408
|
* Matcher that checks that the expected item is NOT an element in the actual Array.
|
1386
1409
|
*
|
1387
1410
|
* @param {Object} expected
|
1388
|
-
* @deprecated as of 1.0. Use not.
|
1411
|
+
* @deprecated as of 1.0. Use not.toContain() instead.
|
1389
1412
|
*/
|
1390
1413
|
jasmine.Matchers.prototype.toNotContain = function(expected) {
|
1391
1414
|
return !this.env.contains_(this.actual, expected);
|
@@ -1453,7 +1476,7 @@ jasmine.Matchers.Any = function(expectedClass) {
|
|
1453
1476
|
this.expectedClass = expectedClass;
|
1454
1477
|
};
|
1455
1478
|
|
1456
|
-
jasmine.Matchers.Any.prototype.
|
1479
|
+
jasmine.Matchers.Any.prototype.jasmineMatches = function(other) {
|
1457
1480
|
if (this.expectedClass == String) {
|
1458
1481
|
return typeof other == 'string' || other instanceof String;
|
1459
1482
|
}
|
@@ -1473,10 +1496,222 @@ jasmine.Matchers.Any.prototype.matches = function(other) {
|
|
1473
1496
|
return other instanceof this.expectedClass;
|
1474
1497
|
};
|
1475
1498
|
|
1476
|
-
jasmine.Matchers.Any.prototype.
|
1499
|
+
jasmine.Matchers.Any.prototype.jasmineToString = function() {
|
1477
1500
|
return '<jasmine.any(' + this.expectedClass + ')>';
|
1478
1501
|
};
|
1479
1502
|
|
1503
|
+
jasmine.Matchers.ObjectContaining = function (sample) {
|
1504
|
+
this.sample = sample;
|
1505
|
+
};
|
1506
|
+
|
1507
|
+
jasmine.Matchers.ObjectContaining.prototype.jasmineMatches = function(other, mismatchKeys, mismatchValues) {
|
1508
|
+
mismatchKeys = mismatchKeys || [];
|
1509
|
+
mismatchValues = mismatchValues || [];
|
1510
|
+
|
1511
|
+
var env = jasmine.getEnv();
|
1512
|
+
|
1513
|
+
var hasKey = function(obj, keyName) {
|
1514
|
+
return obj != null && obj[keyName] !== jasmine.undefined;
|
1515
|
+
};
|
1516
|
+
|
1517
|
+
for (var property in this.sample) {
|
1518
|
+
if (!hasKey(other, property) && hasKey(this.sample, property)) {
|
1519
|
+
mismatchKeys.push("expected has key '" + property + "', but missing from actual.");
|
1520
|
+
}
|
1521
|
+
else if (!env.equals_(this.sample[property], other[property], mismatchKeys, mismatchValues)) {
|
1522
|
+
mismatchValues.push("'" + property + "' was '" + (other[property] ? jasmine.util.htmlEscape(other[property].toString()) : other[property]) + "' in expected, but was '" + (this.sample[property] ? jasmine.util.htmlEscape(this.sample[property].toString()) : this.sample[property]) + "' in actual.");
|
1523
|
+
}
|
1524
|
+
}
|
1525
|
+
|
1526
|
+
return (mismatchKeys.length === 0 && mismatchValues.length === 0);
|
1527
|
+
};
|
1528
|
+
|
1529
|
+
jasmine.Matchers.ObjectContaining.prototype.jasmineToString = function () {
|
1530
|
+
return "<jasmine.objectContaining(" + jasmine.pp(this.sample) + ")>";
|
1531
|
+
};
|
1532
|
+
// Mock setTimeout, clearTimeout
|
1533
|
+
// Contributed by Pivotal Computer Systems, www.pivotalsf.com
|
1534
|
+
|
1535
|
+
jasmine.FakeTimer = function() {
|
1536
|
+
this.reset();
|
1537
|
+
|
1538
|
+
var self = this;
|
1539
|
+
self.setTimeout = function(funcToCall, millis) {
|
1540
|
+
self.timeoutsMade++;
|
1541
|
+
self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
|
1542
|
+
return self.timeoutsMade;
|
1543
|
+
};
|
1544
|
+
|
1545
|
+
self.setInterval = function(funcToCall, millis) {
|
1546
|
+
self.timeoutsMade++;
|
1547
|
+
self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
|
1548
|
+
return self.timeoutsMade;
|
1549
|
+
};
|
1550
|
+
|
1551
|
+
self.clearTimeout = function(timeoutKey) {
|
1552
|
+
self.scheduledFunctions[timeoutKey] = jasmine.undefined;
|
1553
|
+
};
|
1554
|
+
|
1555
|
+
self.clearInterval = function(timeoutKey) {
|
1556
|
+
self.scheduledFunctions[timeoutKey] = jasmine.undefined;
|
1557
|
+
};
|
1558
|
+
|
1559
|
+
};
|
1560
|
+
|
1561
|
+
jasmine.FakeTimer.prototype.reset = function() {
|
1562
|
+
this.timeoutsMade = 0;
|
1563
|
+
this.scheduledFunctions = {};
|
1564
|
+
this.nowMillis = 0;
|
1565
|
+
};
|
1566
|
+
|
1567
|
+
jasmine.FakeTimer.prototype.tick = function(millis) {
|
1568
|
+
var oldMillis = this.nowMillis;
|
1569
|
+
var newMillis = oldMillis + millis;
|
1570
|
+
this.runFunctionsWithinRange(oldMillis, newMillis);
|
1571
|
+
this.nowMillis = newMillis;
|
1572
|
+
};
|
1573
|
+
|
1574
|
+
jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
|
1575
|
+
var scheduledFunc;
|
1576
|
+
var funcsToRun = [];
|
1577
|
+
for (var timeoutKey in this.scheduledFunctions) {
|
1578
|
+
scheduledFunc = this.scheduledFunctions[timeoutKey];
|
1579
|
+
if (scheduledFunc != jasmine.undefined &&
|
1580
|
+
scheduledFunc.runAtMillis >= oldMillis &&
|
1581
|
+
scheduledFunc.runAtMillis <= nowMillis) {
|
1582
|
+
funcsToRun.push(scheduledFunc);
|
1583
|
+
this.scheduledFunctions[timeoutKey] = jasmine.undefined;
|
1584
|
+
}
|
1585
|
+
}
|
1586
|
+
|
1587
|
+
if (funcsToRun.length > 0) {
|
1588
|
+
funcsToRun.sort(function(a, b) {
|
1589
|
+
return a.runAtMillis - b.runAtMillis;
|
1590
|
+
});
|
1591
|
+
for (var i = 0; i < funcsToRun.length; ++i) {
|
1592
|
+
try {
|
1593
|
+
var funcToRun = funcsToRun[i];
|
1594
|
+
this.nowMillis = funcToRun.runAtMillis;
|
1595
|
+
funcToRun.funcToCall();
|
1596
|
+
if (funcToRun.recurring) {
|
1597
|
+
this.scheduleFunction(funcToRun.timeoutKey,
|
1598
|
+
funcToRun.funcToCall,
|
1599
|
+
funcToRun.millis,
|
1600
|
+
true);
|
1601
|
+
}
|
1602
|
+
} catch(e) {
|
1603
|
+
}
|
1604
|
+
}
|
1605
|
+
this.runFunctionsWithinRange(oldMillis, nowMillis);
|
1606
|
+
}
|
1607
|
+
};
|
1608
|
+
|
1609
|
+
jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
|
1610
|
+
this.scheduledFunctions[timeoutKey] = {
|
1611
|
+
runAtMillis: this.nowMillis + millis,
|
1612
|
+
funcToCall: funcToCall,
|
1613
|
+
recurring: recurring,
|
1614
|
+
timeoutKey: timeoutKey,
|
1615
|
+
millis: millis
|
1616
|
+
};
|
1617
|
+
};
|
1618
|
+
|
1619
|
+
/**
|
1620
|
+
* @namespace
|
1621
|
+
*/
|
1622
|
+
jasmine.Clock = {
|
1623
|
+
defaultFakeTimer: new jasmine.FakeTimer(),
|
1624
|
+
|
1625
|
+
reset: function() {
|
1626
|
+
jasmine.Clock.assertInstalled();
|
1627
|
+
jasmine.Clock.defaultFakeTimer.reset();
|
1628
|
+
},
|
1629
|
+
|
1630
|
+
tick: function(millis) {
|
1631
|
+
jasmine.Clock.assertInstalled();
|
1632
|
+
jasmine.Clock.defaultFakeTimer.tick(millis);
|
1633
|
+
},
|
1634
|
+
|
1635
|
+
runFunctionsWithinRange: function(oldMillis, nowMillis) {
|
1636
|
+
jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
|
1637
|
+
},
|
1638
|
+
|
1639
|
+
scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
|
1640
|
+
jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
|
1641
|
+
},
|
1642
|
+
|
1643
|
+
useMock: function() {
|
1644
|
+
if (!jasmine.Clock.isInstalled()) {
|
1645
|
+
var spec = jasmine.getEnv().currentSpec;
|
1646
|
+
spec.after(jasmine.Clock.uninstallMock);
|
1647
|
+
|
1648
|
+
jasmine.Clock.installMock();
|
1649
|
+
}
|
1650
|
+
},
|
1651
|
+
|
1652
|
+
installMock: function() {
|
1653
|
+
jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
|
1654
|
+
},
|
1655
|
+
|
1656
|
+
uninstallMock: function() {
|
1657
|
+
jasmine.Clock.assertInstalled();
|
1658
|
+
jasmine.Clock.installed = jasmine.Clock.real;
|
1659
|
+
},
|
1660
|
+
|
1661
|
+
real: {
|
1662
|
+
setTimeout: jasmine.getGlobal().setTimeout,
|
1663
|
+
clearTimeout: jasmine.getGlobal().clearTimeout,
|
1664
|
+
setInterval: jasmine.getGlobal().setInterval,
|
1665
|
+
clearInterval: jasmine.getGlobal().clearInterval
|
1666
|
+
},
|
1667
|
+
|
1668
|
+
assertInstalled: function() {
|
1669
|
+
if (!jasmine.Clock.isInstalled()) {
|
1670
|
+
throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
|
1671
|
+
}
|
1672
|
+
},
|
1673
|
+
|
1674
|
+
isInstalled: function() {
|
1675
|
+
return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer;
|
1676
|
+
},
|
1677
|
+
|
1678
|
+
installed: null
|
1679
|
+
};
|
1680
|
+
jasmine.Clock.installed = jasmine.Clock.real;
|
1681
|
+
|
1682
|
+
//else for IE support
|
1683
|
+
jasmine.getGlobal().setTimeout = function(funcToCall, millis) {
|
1684
|
+
if (jasmine.Clock.installed.setTimeout.apply) {
|
1685
|
+
return jasmine.Clock.installed.setTimeout.apply(this, arguments);
|
1686
|
+
} else {
|
1687
|
+
return jasmine.Clock.installed.setTimeout(funcToCall, millis);
|
1688
|
+
}
|
1689
|
+
};
|
1690
|
+
|
1691
|
+
jasmine.getGlobal().setInterval = function(funcToCall, millis) {
|
1692
|
+
if (jasmine.Clock.installed.setInterval.apply) {
|
1693
|
+
return jasmine.Clock.installed.setInterval.apply(this, arguments);
|
1694
|
+
} else {
|
1695
|
+
return jasmine.Clock.installed.setInterval(funcToCall, millis);
|
1696
|
+
}
|
1697
|
+
};
|
1698
|
+
|
1699
|
+
jasmine.getGlobal().clearTimeout = function(timeoutKey) {
|
1700
|
+
if (jasmine.Clock.installed.clearTimeout.apply) {
|
1701
|
+
return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
|
1702
|
+
} else {
|
1703
|
+
return jasmine.Clock.installed.clearTimeout(timeoutKey);
|
1704
|
+
}
|
1705
|
+
};
|
1706
|
+
|
1707
|
+
jasmine.getGlobal().clearInterval = function(timeoutKey) {
|
1708
|
+
if (jasmine.Clock.installed.clearTimeout.apply) {
|
1709
|
+
return jasmine.Clock.installed.clearInterval.apply(this, arguments);
|
1710
|
+
} else {
|
1711
|
+
return jasmine.Clock.installed.clearInterval(timeoutKey);
|
1712
|
+
}
|
1713
|
+
};
|
1714
|
+
|
1480
1715
|
/**
|
1481
1716
|
* @constructor
|
1482
1717
|
*/
|
@@ -1617,8 +1852,8 @@ jasmine.PrettyPrinter.prototype.format = function(value) {
|
|
1617
1852
|
this.emitScalar('null');
|
1618
1853
|
} else if (value === jasmine.getGlobal()) {
|
1619
1854
|
this.emitScalar('<global>');
|
1620
|
-
} else if (value
|
1621
|
-
this.emitScalar(value.
|
1855
|
+
} else if (value.jasmineToString) {
|
1856
|
+
this.emitScalar(value.jasmineToString());
|
1622
1857
|
} else if (typeof value === 'string') {
|
1623
1858
|
this.emitString(value);
|
1624
1859
|
} else if (jasmine.isSpy(value)) {
|
@@ -2285,193 +2520,11 @@ jasmine.WaitsForBlock.prototype.execute = function(onComplete) {
|
|
2285
2520
|
}, jasmine.WaitsForBlock.TIMEOUT_INCREMENT);
|
2286
2521
|
}
|
2287
2522
|
};
|
2288
|
-
// Mock setTimeout, clearTimeout
|
2289
|
-
// Contributed by Pivotal Computer Systems, www.pivotalsf.com
|
2290
|
-
|
2291
|
-
jasmine.FakeTimer = function() {
|
2292
|
-
this.reset();
|
2293
|
-
|
2294
|
-
var self = this;
|
2295
|
-
self.setTimeout = function(funcToCall, millis) {
|
2296
|
-
self.timeoutsMade++;
|
2297
|
-
self.scheduleFunction(self.timeoutsMade, funcToCall, millis, false);
|
2298
|
-
return self.timeoutsMade;
|
2299
|
-
};
|
2300
|
-
|
2301
|
-
self.setInterval = function(funcToCall, millis) {
|
2302
|
-
self.timeoutsMade++;
|
2303
|
-
self.scheduleFunction(self.timeoutsMade, funcToCall, millis, true);
|
2304
|
-
return self.timeoutsMade;
|
2305
|
-
};
|
2306
|
-
|
2307
|
-
self.clearTimeout = function(timeoutKey) {
|
2308
|
-
self.scheduledFunctions[timeoutKey] = jasmine.undefined;
|
2309
|
-
};
|
2310
|
-
|
2311
|
-
self.clearInterval = function(timeoutKey) {
|
2312
|
-
self.scheduledFunctions[timeoutKey] = jasmine.undefined;
|
2313
|
-
};
|
2314
|
-
|
2315
|
-
};
|
2316
|
-
|
2317
|
-
jasmine.FakeTimer.prototype.reset = function() {
|
2318
|
-
this.timeoutsMade = 0;
|
2319
|
-
this.scheduledFunctions = {};
|
2320
|
-
this.nowMillis = 0;
|
2321
|
-
};
|
2322
|
-
|
2323
|
-
jasmine.FakeTimer.prototype.tick = function(millis) {
|
2324
|
-
var oldMillis = this.nowMillis;
|
2325
|
-
var newMillis = oldMillis + millis;
|
2326
|
-
this.runFunctionsWithinRange(oldMillis, newMillis);
|
2327
|
-
this.nowMillis = newMillis;
|
2328
|
-
};
|
2329
|
-
|
2330
|
-
jasmine.FakeTimer.prototype.runFunctionsWithinRange = function(oldMillis, nowMillis) {
|
2331
|
-
var scheduledFunc;
|
2332
|
-
var funcsToRun = [];
|
2333
|
-
for (var timeoutKey in this.scheduledFunctions) {
|
2334
|
-
scheduledFunc = this.scheduledFunctions[timeoutKey];
|
2335
|
-
if (scheduledFunc != jasmine.undefined &&
|
2336
|
-
scheduledFunc.runAtMillis >= oldMillis &&
|
2337
|
-
scheduledFunc.runAtMillis <= nowMillis) {
|
2338
|
-
funcsToRun.push(scheduledFunc);
|
2339
|
-
this.scheduledFunctions[timeoutKey] = jasmine.undefined;
|
2340
|
-
}
|
2341
|
-
}
|
2342
|
-
|
2343
|
-
if (funcsToRun.length > 0) {
|
2344
|
-
funcsToRun.sort(function(a, b) {
|
2345
|
-
return a.runAtMillis - b.runAtMillis;
|
2346
|
-
});
|
2347
|
-
for (var i = 0; i < funcsToRun.length; ++i) {
|
2348
|
-
try {
|
2349
|
-
var funcToRun = funcsToRun[i];
|
2350
|
-
this.nowMillis = funcToRun.runAtMillis;
|
2351
|
-
funcToRun.funcToCall();
|
2352
|
-
if (funcToRun.recurring) {
|
2353
|
-
this.scheduleFunction(funcToRun.timeoutKey,
|
2354
|
-
funcToRun.funcToCall,
|
2355
|
-
funcToRun.millis,
|
2356
|
-
true);
|
2357
|
-
}
|
2358
|
-
} catch(e) {
|
2359
|
-
}
|
2360
|
-
}
|
2361
|
-
this.runFunctionsWithinRange(oldMillis, nowMillis);
|
2362
|
-
}
|
2363
|
-
};
|
2364
|
-
|
2365
|
-
jasmine.FakeTimer.prototype.scheduleFunction = function(timeoutKey, funcToCall, millis, recurring) {
|
2366
|
-
this.scheduledFunctions[timeoutKey] = {
|
2367
|
-
runAtMillis: this.nowMillis + millis,
|
2368
|
-
funcToCall: funcToCall,
|
2369
|
-
recurring: recurring,
|
2370
|
-
timeoutKey: timeoutKey,
|
2371
|
-
millis: millis
|
2372
|
-
};
|
2373
|
-
};
|
2374
|
-
|
2375
|
-
/**
|
2376
|
-
* @namespace
|
2377
|
-
*/
|
2378
|
-
jasmine.Clock = {
|
2379
|
-
defaultFakeTimer: new jasmine.FakeTimer(),
|
2380
|
-
|
2381
|
-
reset: function() {
|
2382
|
-
jasmine.Clock.assertInstalled();
|
2383
|
-
jasmine.Clock.defaultFakeTimer.reset();
|
2384
|
-
},
|
2385
|
-
|
2386
|
-
tick: function(millis) {
|
2387
|
-
jasmine.Clock.assertInstalled();
|
2388
|
-
jasmine.Clock.defaultFakeTimer.tick(millis);
|
2389
|
-
},
|
2390
|
-
|
2391
|
-
runFunctionsWithinRange: function(oldMillis, nowMillis) {
|
2392
|
-
jasmine.Clock.defaultFakeTimer.runFunctionsWithinRange(oldMillis, nowMillis);
|
2393
|
-
},
|
2394
|
-
|
2395
|
-
scheduleFunction: function(timeoutKey, funcToCall, millis, recurring) {
|
2396
|
-
jasmine.Clock.defaultFakeTimer.scheduleFunction(timeoutKey, funcToCall, millis, recurring);
|
2397
|
-
},
|
2398
|
-
|
2399
|
-
useMock: function() {
|
2400
|
-
if (!jasmine.Clock.isInstalled()) {
|
2401
|
-
var spec = jasmine.getEnv().currentSpec;
|
2402
|
-
spec.after(jasmine.Clock.uninstallMock);
|
2403
|
-
|
2404
|
-
jasmine.Clock.installMock();
|
2405
|
-
}
|
2406
|
-
},
|
2407
|
-
|
2408
|
-
installMock: function() {
|
2409
|
-
jasmine.Clock.installed = jasmine.Clock.defaultFakeTimer;
|
2410
|
-
},
|
2411
|
-
|
2412
|
-
uninstallMock: function() {
|
2413
|
-
jasmine.Clock.assertInstalled();
|
2414
|
-
jasmine.Clock.installed = jasmine.Clock.real;
|
2415
|
-
},
|
2416
|
-
|
2417
|
-
real: {
|
2418
|
-
setTimeout: jasmine.getGlobal().setTimeout,
|
2419
|
-
clearTimeout: jasmine.getGlobal().clearTimeout,
|
2420
|
-
setInterval: jasmine.getGlobal().setInterval,
|
2421
|
-
clearInterval: jasmine.getGlobal().clearInterval
|
2422
|
-
},
|
2423
|
-
|
2424
|
-
assertInstalled: function() {
|
2425
|
-
if (!jasmine.Clock.isInstalled()) {
|
2426
|
-
throw new Error("Mock clock is not installed, use jasmine.Clock.useMock()");
|
2427
|
-
}
|
2428
|
-
},
|
2429
|
-
|
2430
|
-
isInstalled: function() {
|
2431
|
-
return jasmine.Clock.installed == jasmine.Clock.defaultFakeTimer;
|
2432
|
-
},
|
2433
|
-
|
2434
|
-
installed: null
|
2435
|
-
};
|
2436
|
-
jasmine.Clock.installed = jasmine.Clock.real;
|
2437
|
-
|
2438
|
-
//else for IE support
|
2439
|
-
jasmine.getGlobal().setTimeout = function(funcToCall, millis) {
|
2440
|
-
if (jasmine.Clock.installed.setTimeout.apply) {
|
2441
|
-
return jasmine.Clock.installed.setTimeout.apply(this, arguments);
|
2442
|
-
} else {
|
2443
|
-
return jasmine.Clock.installed.setTimeout(funcToCall, millis);
|
2444
|
-
}
|
2445
|
-
};
|
2446
|
-
|
2447
|
-
jasmine.getGlobal().setInterval = function(funcToCall, millis) {
|
2448
|
-
if (jasmine.Clock.installed.setInterval.apply) {
|
2449
|
-
return jasmine.Clock.installed.setInterval.apply(this, arguments);
|
2450
|
-
} else {
|
2451
|
-
return jasmine.Clock.installed.setInterval(funcToCall, millis);
|
2452
|
-
}
|
2453
|
-
};
|
2454
|
-
|
2455
|
-
jasmine.getGlobal().clearTimeout = function(timeoutKey) {
|
2456
|
-
if (jasmine.Clock.installed.clearTimeout.apply) {
|
2457
|
-
return jasmine.Clock.installed.clearTimeout.apply(this, arguments);
|
2458
|
-
} else {
|
2459
|
-
return jasmine.Clock.installed.clearTimeout(timeoutKey);
|
2460
|
-
}
|
2461
|
-
};
|
2462
|
-
|
2463
|
-
jasmine.getGlobal().clearInterval = function(timeoutKey) {
|
2464
|
-
if (jasmine.Clock.installed.clearTimeout.apply) {
|
2465
|
-
return jasmine.Clock.installed.clearInterval.apply(this, arguments);
|
2466
|
-
} else {
|
2467
|
-
return jasmine.Clock.installed.clearInterval(timeoutKey);
|
2468
|
-
}
|
2469
|
-
};
|
2470
2523
|
|
2471
2524
|
jasmine.version_= {
|
2472
2525
|
"major": 1,
|
2473
2526
|
"minor": 2,
|
2474
2527
|
"build": 0,
|
2475
|
-
"revision":
|
2476
|
-
"release_candidate":
|
2528
|
+
"revision": 1333492179,
|
2529
|
+
"release_candidate": 2
|
2477
2530
|
};
|