JavaScript animation engine
Merge branch 'dev' into pr/1067
Julian Garnier9eb44ebe36f1
diff --cc tests/suites/draggables.test.jsindex 03851b5b,f48385c9..7bbf9c9d--- a/tests/suites/draggables.test.js+++ b/tests/suites/draggables.test.js@@@ -92,57 -136,4 +136,58 @@@ suite('Draggables', () =>});});+ test('Touch dragging should work in Shadow DOM', resolve => {+ const $container = document.querySelector('#css-tests');+ const $host = document.createElement('div');+ $container.appendChild($host);-+++ const shadowRoot = $host.attachShadow({ mode: 'open' });+ const $target = document.createElement('div');+ $target.style.cssText = 'width: 100px; height: 100px;';+ shadowRoot.appendChild($target);-+++ let updates = 0;-+++ const draggable = createDraggable($target, {+ onUpdate: () => updates++,+ onSettle: () => {+ expect(updates).to.be.above(0);+ draggable.revert();+ $host.remove();+ resolve();+ }+ });-+++ const createTouchEvent = ($el, type, x, y) => {+ const touch = new Touch({+ identifier: 1,+ target: $el,+ clientX: x,+ clientY: y,+ pageX: x,+ pageY: y,+ });-+++ $el.dispatchEvent(new TouchEvent('touch' + type, {+ touches: type === 'end' ? [] : [touch],+ changedTouches: [touch],+ bubbles: true,+ composed: true,+ cancelable: true+ }));+ };-+++ createTouchEvent($target, 'start', 50, 50);-+++ createTimer({+ duration: 50,+ onUpdate: self => {+ createTouchEvent($target, 'move', 50, 50 + (self.progress * 50));+ },+ onComplete: () => {+ createTouchEvent($target, 'end', 50, 100);+ }+ });+ });++});