Older IE fixes

Still not green, but getting close. Summary of Older IE discrepancies:
- Older IE doesn't have apply/call on the timing functions
- Older IE doesn't allow applying falsy arguments
- Older IE doesn't allow setting onclick to undefined values
- Older IE doesn't have text property on dom nodes
This commit is contained in:
Sheel Choksi
2013-07-21 18:40:12 -07:00
parent d4f78922cd
commit 61a1f93488
6 changed files with 15 additions and 15 deletions

View File

@@ -38,7 +38,7 @@ jasmineRequire.HtmlReporter = function(j$) {
getContainer = options.getContainer,
createElement = options.createElement,
createTextNode = options.createTextNode,
onRaiseExceptionsClick = options.onRaiseExceptionsClick,
onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
timer = options.timer || noopTimer,
results = [],
specsExecuted = 0,

View File

@@ -790,7 +790,7 @@ getJasmineRequireObj().Clock = function() {
}
return timer.setTimeout(fn, delay);
}
return timer.setTimeout.apply(global, arguments);
return Function.prototype.apply.apply(timer.setTimeout, [global, arguments]);
};
self.setInterval = function(fn, delay, params) {
@@ -800,15 +800,15 @@ getJasmineRequireObj().Clock = function() {
}
return timer.setInterval(fn, delay);
}
return timer.setInterval.apply(global, arguments);
return Function.prototype.apply.apply(timer.setInterval, [global, arguments]);
};
self.clearTimeout = function(id) {
return timer.clearTimeout.call(global, id);
return Function.prototype.call.apply(timer.clearTimeout, [global, id]);
};
self.clearInterval = function(id) {
return timer.clearInterval.call(global, id);
return Function.prototype.call.apply(timer.clearInterval, [global, id]);
};
self.tick = function(millis) {
@@ -962,7 +962,7 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() {
for (var i = 0; i < funcsToRun.length; ++i) {
var funcToRun = funcsToRun[i];
funcToRun.funcToCall.apply(null, funcToRun.params);
funcToRun.funcToCall.apply(null, funcToRun.params || []);
}
}
}

View File

@@ -229,7 +229,7 @@ describe("New HtmlReporter", function() {
var suiteDetail = outerSuite.childNodes[0];
var suiteLink = suiteDetail.childNodes[0];
expect(suiteLink.text).toEqual("A Suite");
expect(suiteLink.innerHTML).toEqual("A Suite");
expect(suiteLink.getAttribute('href')).toEqual("?spec=A%20Suite");
var specs = outerSuite.childNodes[1];
@@ -238,7 +238,7 @@ describe("New HtmlReporter", function() {
expect(spec.getAttribute("id")).toEqual("spec-123");
var specLink = spec.childNodes[0];
expect(specLink.text).toEqual("with a spec");
expect(specLink.innerHTML).toEqual("with a spec");
expect(specLink.getAttribute("href")).toEqual("?spec=A%20Suite%20with%20a%20spec");
// expect(specLink.getAttribute("title")).toEqual("A Suite with a spec");
});
@@ -481,7 +481,7 @@ describe("New HtmlReporter", function() {
expect(menuBar.getAttribute("class")).not.toMatch(/hidden/);
var link = menuBar.querySelector('a');
expect(link.text).toEqual("Failures");
expect(link.innerHTML).toEqual("Failures");
expect(link.getAttribute("href")).toEqual("#");
});

View File

@@ -34,7 +34,7 @@ getJasmineRequireObj().Clock = function() {
}
return timer.setTimeout(fn, delay);
}
return timer.setTimeout.apply(global, arguments);
return Function.prototype.apply.apply(timer.setTimeout, [global, arguments]);
};
self.setInterval = function(fn, delay, params) {
@@ -44,15 +44,15 @@ getJasmineRequireObj().Clock = function() {
}
return timer.setInterval(fn, delay);
}
return timer.setInterval.apply(global, arguments);
return Function.prototype.apply.apply(timer.setInterval, [global, arguments]);
};
self.clearTimeout = function(id) {
return timer.clearTimeout.call(global, id);
return Function.prototype.call.apply(timer.clearTimeout, [global, id]);
};
self.clearInterval = function(id) {
return timer.clearInterval.call(global, id);
return Function.prototype.call.apply(timer.clearInterval, [global, id]);
};
self.tick = function(millis) {

View File

@@ -108,7 +108,7 @@ getJasmineRequireObj().DelayedFunctionScheduler = function() {
for (var i = 0; i < funcsToRun.length; ++i) {
var funcToRun = funcsToRun[i];
funcToRun.funcToCall.apply(null, funcToRun.params);
funcToRun.funcToCall.apply(null, funcToRun.params || []);
}
}
}

View File

@@ -10,7 +10,7 @@ jasmineRequire.HtmlReporter = function(j$) {
getContainer = options.getContainer,
createElement = options.createElement,
createTextNode = options.createTextNode,
onRaiseExceptionsClick = options.onRaiseExceptionsClick,
onRaiseExceptionsClick = options.onRaiseExceptionsClick || function() {},
timer = options.timer || noopTimer,
results = [],
specsExecuted = 0,