1
0
mirror of https://github.com/videojs/video.js.git synced 2025-01-08 07:00:10 +02:00
video.js/test/unit/utils/custom-element.test.js
weiz18 9946a197eb
fix(dom): handle slotted parent transform position (#8158)
* fix(dom): handle slotted parent transform position

* fix(test): add test to cover getPointerPosition

* run all tests

---------

Co-authored-by: mister-ben <git@misterben.me>
2024-05-03 14:23:30 +02:00

46 lines
1.2 KiB
JavaScript

/* eslint-env browser */
import videojs from '../../../src/js/video.js';
export class TestCustomElement extends HTMLElement {
constructor() {
super();
const shadowRoot = this.attachShadow({ mode: 'closed' });
const containerElem = document.createElement('div');
containerElem.setAttribute('data-vjs-player', '');
shadowRoot.appendChild(containerElem);
const videoElem = document.createElement('video');
videoElem.setAttribute('width', 640);
videoElem.setAttribute('height', 260);
containerElem.appendChild(videoElem);
this.innerPlayer = videojs(videoElem);
}
}
export class TestSlotElement extends HTMLElement {
constructor() {
super();
const shadowRoot = this.attachShadow({ mode: 'open' });
const wrapperEl = document.createElement('div');
wrapperEl.style = this.dataset.style;
const slot = document.createElement('slot');
wrapperEl.appendChild(slot);
shadowRoot.appendChild(wrapperEl);
}
}
// Not supported on Chrome < 54
if ('customElements' in window) {
window.customElements.define('test-custom-element', TestCustomElement);
window.customElements.define('test-slot-element', TestSlotElement);
}