Compare commits

...

7 Commits

Author SHA1 Message Date
Gregg Van Hove
a4b92b34f4 Update to 2.5.1 2016-09-07 14:31:18 -07:00
Gregg Van Hove
3486e8d166 Merge branch '1189' of https://github.com/seanparmelee/jasmine into seanparmelee-1189
- Merges #1193 from @seanparmlee
- Fixes #1189
2016-09-01 21:11:07 -07:00
Gregg Van Hove
8366ef9be5 Merge branch 'fix' of https://github.com/logankd/jasmine into logankd-fix
- Merges #1192 from @logankd
- Fixes #1188
2016-09-01 20:44:13 -07:00
Gregg Van Hove
ab0567c665 Generated file for date tick fix 2016-09-01 20:41:51 -07:00
Sean Parmelee
8676bbf11a fallback on assignment when a spy cannot be deleted 2016-09-01 13:39:25 -05:00
Kevin Logan
c0a9d20a02 fix for issue #1188 2016-09-01 10:59:19 -05:00
Gregg Van Hove
c7cc3b4a29 Properly tick date along with clock
- Specifically when there aren't functions scheduled at the ticks

Fixes #1190
2016-08-31 21:24:01 -07:00
9 changed files with 91 additions and 19 deletions

View File

@@ -1428,7 +1428,7 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() {
function runScheduledFunctions(endTime, tickDate) {
tickDate = tickDate || function() {};
if (scheduledLookup.length === 0 || scheduledLookup[0] > endTime) {
tickDate(endTime);
tickDate(endTime - currentTime);
return;
}
@@ -1455,6 +1455,11 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() {
// scheduled in a funcToRun from forcing an extra iteration
currentTime !== endTime &&
scheduledLookup[0] <= endTime);
// ran out of functions to call, but still time left on the clock
if (currentTime !== endTime) {
tickDate(endTime - currentTime);
}
}
}
@@ -2088,7 +2093,9 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
};
} else {
restoreStrategy = function() {
delete obj[methodName];
if (!delete obj[methodName]) {
obj[methodName] = originalMethod;
}
};
}
@@ -2984,16 +2991,20 @@ getJasmineRequireObj().matchersUtil = function(j$) {
}
var extraKeys = [];
for (var i in allKeys) {
if (!allKeys[i].match(/^[0-9]+$/)) {
extraKeys.push(allKeys[i]);
}
if (allKeys.length === 0) {
return allKeys;
}
for (var x = 0; x < allKeys.length; x++) {
if (!allKeys[x].match(/^[0-9]+$/)) {
extraKeys.push(allKeys[x]);
}
}
return extraKeys;
}
}
function has(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}
@@ -3629,5 +3640,5 @@ getJasmineRequireObj().interface = function(jasmine, env) {
};
getJasmineRequireObj().version = function() {
return '2.5.0';
return '2.5.1';
};

View File

@@ -4,6 +4,6 @@
#
module Jasmine
module Core
VERSION = "2.5.0"
VERSION = "2.5.1"
end
end

View File

@@ -1,7 +1,7 @@
{
"name": "jasmine-core",
"license": "MIT",
"version": "2.5.0",
"version": "2.5.1",
"repository": {
"type": "git",
"url": "https://github.com/jasmine/jasmine.git"

19
release_notes/2.5.1.md Normal file
View File

@@ -0,0 +1,19 @@
# Jasmine 2.5.1 Release Notes
## Pull Requests & Issues
* fallback on assignment when a spy cannot be deleted
- Merges [#1193](https://github.com/jasmine/jasmine/issues/1193) from @seanparmlee
- Fixes [#1189](https://github.com/jasmine/jasmine/issues/1189)
* Fix issue with equality of Arrays in PhantomJS
- Merges [#1192](https://github.com/jasmine/jasmine/issues/1192) from @logankd
- Fixes [#1188](https://github.com/jasmine/jasmine/issues/1188)
* Properly tick date along with clock
- Fixes [#1190](https://github.com/jasmine/jasmine/issues/1190)
------
_Release Notes generated with _[Anchorman](http://github.com/infews/anchorman)_

View File

@@ -666,9 +666,17 @@ describe("Clock (acceptance)", function() {
var pushCurrentTime = function() { actualTimes.push(global.Date().getTime()); };
delayedFunctionScheduler.scheduleFunction(pushCurrentTime);
delayedFunctionScheduler.scheduleFunction(pushCurrentTime, 1);
delayedFunctionScheduler.scheduleFunction(pushCurrentTime, 3);
clock.tick(1);
expect(global.Date().getTime()).toEqual(baseTime.getTime() + 1);
expect(actualTimes).toEqual([baseTime.getTime(), baseTime.getTime() + 1]);
clock.tick(3);
expect(global.Date().getTime()).toEqual(baseTime.getTime() + 4);
clock.tick(1);
expect(global.Date().getTime()).toEqual(baseTime.getTime() + 5);
expect(actualTimes).toEqual([baseTime.getTime(), baseTime.getTime() + 1, baseTime.getTime() + 3]);
})
});

View File

@@ -127,6 +127,29 @@ describe("SpyRegistry", function() {
expect(subject.hasOwnProperty('spiedFunc')).toBe(false);
expect(subject.spiedFunc).toBe(originalFunction);
})
});
it("restores the original function when it\'s inherited and cannot be deleted", function() {
// IE 8 doesn't support `Object.create` or `Object.defineProperty`
if (jasmine.getEnv().ieVersion < 9) { return; }
var spies = [],
spyRegistry = new jasmineUnderTest.SpyRegistry({currentSpies: function() { return spies; }}),
originalFunction = function() {},
subjectParent = {spiedFunc: originalFunction};
var subject = Object.create(subjectParent);
spyRegistry.spyOn(subject, 'spiedFunc');
// simulate a spy that cannot be deleted
Object.defineProperty(subject, 'spiedFunc', {
configurable: false
});
spyRegistry.clearSpies();
expect(jasmineUnderTest.isSpy(subject.spiedFunc)).toBe(false);
});
});
});

View File

@@ -116,7 +116,7 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() {
function runScheduledFunctions(endTime, tickDate) {
tickDate = tickDate || function() {};
if (scheduledLookup.length === 0 || scheduledLookup[0] > endTime) {
tickDate(endTime);
tickDate(endTime - currentTime);
return;
}
@@ -143,6 +143,11 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() {
// scheduled in a funcToRun from forcing an extra iteration
currentTime !== endTime &&
scheduledLookup[0] <= endTime);
// ran out of functions to call, but still time left on the clock
if (currentTime !== endTime) {
tickDate(endTime - currentTime);
}
}
}

View File

@@ -53,7 +53,9 @@ getJasmineRequireObj().SpyRegistry = function(j$) {
};
} else {
restoreStrategy = function() {
delete obj[methodName];
if (!delete obj[methodName]) {
obj[methodName] = originalMethod;
}
};
}

View File

@@ -223,16 +223,20 @@ getJasmineRequireObj().matchersUtil = function(j$) {
}
var extraKeys = [];
for (var i in allKeys) {
if (!allKeys[i].match(/^[0-9]+$/)) {
extraKeys.push(allKeys[i]);
}
if (allKeys.length === 0) {
return allKeys;
}
for (var x = 0; x < allKeys.length; x++) {
if (!allKeys[x].match(/^[0-9]+$/)) {
extraKeys.push(allKeys[x]);
}
}
return extraKeys;
}
}
function has(obj, key) {
return Object.prototype.hasOwnProperty.call(obj, key);
}