mirror of
https://github.com/webrecorder/pywb.git
synced 2025-03-15 00:03:28 +01:00
Enable running Karma tests against Safari
Detect in the test whether overriding of DOM properties is supported in the current environment and skip testing for the baseURI override in that case.
This commit is contained in:
parent
f2fdbcc511
commit
9c88b1fd20
@ -44,8 +44,21 @@ function runWombatTest(testCase, done) {
|
||||
};
|
||||
|
||||
// expose chai's assertion testing API to the test script
|
||||
assert = window.parent.assert;
|
||||
reportError = window.parent.reportError;
|
||||
window.assert = window.parent.assert;
|
||||
window.reportError = window.parent.reportError;
|
||||
|
||||
// helpers which check whether DOM property overrides are supported
|
||||
// in the current browser
|
||||
window.domTests = {
|
||||
areDOMPropertiesConfigurable: function () {
|
||||
var descriptor = Object.getOwnPropertyDescriptor(Node.prototype, 'baseURI');
|
||||
if (descriptor && !descriptor.configurable) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
try {
|
||||
@ -123,7 +136,9 @@ describe('WombatJS', function () {
|
||||
if (typeof baseURI !== 'string') {
|
||||
throw new Error('baseURI is not a string');
|
||||
}
|
||||
assert.equal(baseURI, 'http:///dummy.html');
|
||||
if (domTests.areDOMPropertiesConfigurable()) {
|
||||
assert.equal(baseURI, 'http:///dummy.html');
|
||||
}
|
||||
},
|
||||
}, done);
|
||||
});
|
||||
@ -141,7 +156,9 @@ describe('WombatJS', function () {
|
||||
html: '<a href="foobar.html" id="link">A link</a>',
|
||||
testScript: function () {
|
||||
var link = document.getElementById('link');
|
||||
assert.equal(link.href, 'http:///foobar.html');
|
||||
if (domTests.areDOMPropertiesConfigurable()) {
|
||||
assert.equal(link.href, 'http:///foobar.html');
|
||||
}
|
||||
},
|
||||
}, done);
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user