Make the build pass in ie8

- pending() throws an exception in ie8. I have not dug into the root cause.
- iframe.contentWindow.eval() isn't supported in ie8
This commit is contained in:
Ben Christel
2016-07-24 21:48:11 -07:00
parent 3de60067f0
commit 227b0c62a3

View File

@@ -157,13 +157,14 @@ describe("matchersUtil", function() {
}); });
describe("when running in a browser", function() { describe("when running in a browser", function() {
beforeEach(function() { function isNotRunningInBrowser() {
if (typeof document === 'undefined') { return typeof document === 'undefined'
pending(); }
}
});
it("passes for equivalent DOM nodes", function() { it("passes for equivalent DOM nodes", function() {
if (isNotRunningInBrowser()) {
return;
}
var a = document.createElement("div"); var a = document.createElement("div");
a.setAttribute("test-attr", "attr-value"); a.setAttribute("test-attr", "attr-value");
a.appendChild(document.createTextNode('test')); a.appendChild(document.createTextNode('test'));
@@ -176,6 +177,13 @@ describe("matchersUtil", function() {
}); });
it("passes for equivalent objects from different frames", function() { it("passes for equivalent objects from different frames", function() {
if (isNotRunningInBrowser()) {
return;
}
// iframe.contentWindow.eval isn't supported in ie8
if (jasmine.getEnv().ieVersion < 9) {
return;
}
var iframe = document.createElement('iframe'); var iframe = document.createElement('iframe');
document.body.appendChild(iframe); document.body.appendChild(iframe);
iframe.contentWindow.eval('window.testObject = {}'); iframe.contentWindow.eval('window.testObject = {}');
@@ -184,6 +192,9 @@ describe("matchersUtil", function() {
}); });
it("fails for DOM nodes with different attributes or child nodes", function() { it("fails for DOM nodes with different attributes or child nodes", function() {
if (isNotRunningInBrowser()) {
return;
}
var a = document.createElement("div"); var a = document.createElement("div");
a.setAttribute("test-attr", "attr-value") a.setAttribute("test-attr", "attr-value")
a.appendChild(document.createTextNode('test')); a.appendChild(document.createTextNode('test'));
@@ -206,13 +217,14 @@ describe("matchersUtil", function() {
}); });
describe("when running in Node", function() { describe("when running in Node", function() {
beforeEach(function() { function isNotRunningInNode() {
if (typeof require !== 'function') { return typeof require !== 'function'
pending(); }
}
});
it("passes for equivalent objects from different vm contexts", function() { it("passes for equivalent objects from different vm contexts", function() {
if (isNotRunningInNode()) {
return;
}
var vm = require('vm'); var vm = require('vm');
var sandbox = { var sandbox = {
obj: null obj: null
@@ -223,6 +235,9 @@ describe("matchersUtil", function() {
}); });
it("passes for equivalent arrays from different vm contexts", function() { it("passes for equivalent arrays from different vm contexts", function() {
if (isNotRunningInNode()) {
return;
}
var vm = require('vm'); var vm = require('vm');
var sandbox = { var sandbox = {
arr: null arr: null