Skip to content

Commit 58e354b

Browse files
committed
try importing $ from jquery instead of ember
1 parent c5dad12 commit 58e354b

5 files changed

Lines changed: 161 additions & 131 deletions

File tree

addon/helpers/drag.js

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
import Ember from 'ember';
2-
const { $ } = Ember;
1+
import Ember from "ember";
2+
import $ from "jquery";
33

44
/**
55
Drags elements by an offset specified in pixels.
@@ -29,21 +29,17 @@ const { $ } = Ember;
2929
export function drag(app, mode, itemSelector, offsetFn, callbacks = {}) {
3030
let start, move, end, which;
3131

32-
const {
33-
andThen,
34-
findWithAssert,
35-
wait
36-
} = app.testHelpers;
32+
const { andThen, findWithAssert, wait } = app.testHelpers;
3733

38-
if (mode === 'mouse') {
39-
start = 'mousedown';
40-
move = 'mousemove';
41-
end = 'mouseup';
34+
if (mode === "mouse") {
35+
start = "mousedown";
36+
move = "mousemove";
37+
end = "mouseup";
4238
which = 1;
43-
} else if (mode === 'touch') {
44-
start = 'touchstart';
45-
move = 'touchmove';
46-
end = 'touchend';
39+
} else if (mode === "touch") {
40+
start = "touchstart";
41+
move = "touchmove";
42+
end = "touchend";
4743
} else {
4844
throw new Error(`Unsupported mode: '${mode}'`);
4945
}
@@ -58,7 +54,7 @@ export function drag(app, mode, itemSelector, offsetFn, callbacks = {}) {
5854
triggerEvent(app, item, start, {
5955
pageX: itemOffset.left,
6056
pageY: itemOffset.top,
61-
which
57+
which,
6258
});
6359

6460
if (callbacks.dragstart) {
@@ -67,7 +63,7 @@ export function drag(app, mode, itemSelector, offsetFn, callbacks = {}) {
6763

6864
triggerEvent(app, item, move, {
6965
pageX: itemOffset.left,
70-
pageY: itemOffset.top
66+
pageY: itemOffset.top,
7167
});
7268

7369
if (callbacks.dragmove) {
@@ -76,12 +72,12 @@ export function drag(app, mode, itemSelector, offsetFn, callbacks = {}) {
7672

7773
triggerEvent(app, item, move, {
7874
pageX: targetX,
79-
pageY: targetY
75+
pageY: targetY,
8076
});
8177

8278
triggerEvent(app, item, end, {
8379
pageX: targetX,
84-
pageY: targetY
80+
pageY: targetY,
8581
});
8682

8783
if (callbacks.dragend) {
@@ -99,4 +95,4 @@ function triggerEvent(app, el, type, props) {
9995
});
10096
}
10197

102-
export default Ember.Test.registerAsyncHelper('drag', drag);
98+
export default Ember.Test.registerAsyncHelper("drag", drag);

0 commit comments

Comments
 (0)