Commit 5c29bd9b authored by Robert Knight's avatar Robert Knight

Disable native Shadow DOM methods for test element

Fix adder toolbar tests in browsers (eg. Chrome) which natively support
Shadow DOM v1. The test for Shadow DOM v0 failed because the implementation
feature-detected and used the Shadow DOM v1 method
`Element.prototype.attachShadow` instead.

Fix the issue by patching the test element to hide the native Shadow DOM
methods if they exist.
parent 10eef00e
......@@ -58,9 +58,14 @@ describe('annotator.adder', function () {
}
context('when Shadow DOM is supported', function () {
unroll('creates the adder DOM in a shadow root', function (testCase) {
unroll('creates the adder DOM in a shadow root (using #attachFn)', function (testCase) {
var adderEl = document.createElement('div');
var shadowEl;
// Disable use of native Shadow DOM for this element, if supported.
adderEl.createShadowRoot = null;
adderEl.attachShadow = null;
adderEl[testCase.attachFn] = sinon.spy(function () {
shadowEl = document.createElement('shadow-root');
adderEl.appendChild(shadowEl);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment