only run shadow dom test if brower supports shadow dom

This commit is contained in:
David McAlpine 2019-07-19 16:20:55 -04:00
parent daa387f4b7
commit ab33cd502e

View File

@ -46,28 +46,32 @@
// ----------
QUnit.test('shadow dom', function(assert) {
var done = assert.async();
if (document.head && document.head.attachShadow) {
var done = assert.async();
var shadowDiv = document.createElement('div');
shadowDiv.attachShadow({
mode: 'open'
});
shadowDiv.shadowRoot.innerHTML = `<div id="shadow-example"></div>`
var shadowDiv = document.createElement('div');
shadowDiv.attachShadow({
mode: 'open'
});
shadowDiv.shadowRoot.innerHTML = `<div id="shadow-example"></div>`
createViewer({
element: shadowDiv.shadowRoot.querySelector('#shadow-example'),
sequenceMode: true,
showReferenceStrip: true,
tileSources: [
'/test/data/tall.dzi',
'/test/data/wide.dzi'
]
});
createViewer({
element: shadowDiv.shadowRoot.querySelector('#shadow-example'),
sequenceMode: true,
showReferenceStrip: true,
tileSources: [
'/test/data/tall.dzi',
'/test/data/wide.dzi'
]
});
$(shadowDiv).appendTo("#qunit-fixture");
$(shadowDiv).appendTo("#qunit-fixture");
assert.ok(viewer.referenceStrip, 'referenceStrip exists');
done();
assert.ok(viewer.referenceStrip, 'referenceStrip exists');
done();
} else {
assert.expect(0);
}
})
})();