Skip to content

armgit / anime

Public Imported from GitHub
0

JavaScript animation engine

Add draggables test

Julian Garnier57e3ba1221e3
diff --git a/tests/run.js b/tests/run.js
index 528bf6f7..0ebf2b9d 100644
--- a/tests/run.js
+++ b/tests/run.js
@@ -1,5 +1,6 @@
import './suites/engine.test.js';
import './suites/seconds.test.js';
+import './suites/draggables.test.js';
import './suites/waapi.test.js';
import './suites/scope.test.js';
import './suites/targets.test.js';
diff --git a/tests/suites/draggables.test.js b/tests/suites/draggables.test.js
new file mode 100644
index 00000000..ff53a6c5
--- /dev/null
+++ b/tests/suites/draggables.test.js
@@ -0,0 +1,27 @@
+import {
+ expect,
+ getChildAtIndex,
+ forEachChildren,
+} from '../utils.js';
+
+import {
+ createDraggable,
+ utils,
+} from '../../src/anime.js';
+
+suite('Draggables', () => {
+ test('Triggering a reset in the onSettle callback should correctly set the values', resolve => {
+ const draggable = createDraggable('#target-id', {
+ container: '#css-tests',
+ onSettle: self => {
+ self.reset();
+ expect(utils.get('#target-id', 'x', false)).to.equal(0);
+ expect(utils.get('#target-id', 'y', false)).to.equal(0);
+ resolve();
+ }
+ });
+
+ draggable.animate.translateX(100, 10);
+ draggable.animate.translateY(100, 10);
+ });
+});