diff --git a/src/swipe/index.js b/src/swipe/index.js index bd74a4843..401db97cd 100644 --- a/src/swipe/index.js +++ b/src/swipe/index.js @@ -166,7 +166,10 @@ export default createComponent({ clearTimeout(this.timer); - const rect = this.$el.getBoundingClientRect(); + const rect = { + width: this.$el.offsetWidth, + height: this.$el.offsetHeight, + }; this.rect = rect; this.swiping = true; diff --git a/src/swipe/test/__snapshots__/demo.spec.js.snap b/src/swipe/test/__snapshots__/demo.spec.js.snap index 745aef78c..2d41fe2cd 100644 --- a/src/swipe/test/__snapshots__/demo.spec.js.snap +++ b/src/swipe/test/__snapshots__/demo.spec.js.snap @@ -4,44 +4,44 @@ exports[`renders demo correctly 1`] = `
-
-
1
-
2
-
3
-
4
+
+
1
+
2
+
3
+
4
-
-
-
-
-
+
+
+
+
+
-
-
1
-
2
-
3
-
4
+
+
1
+
2
+
3
+
4
-
-
1
-
2
-
3
-
4
+
+
1
+
2
+
3
+
4
@@ -59,11 +59,11 @@ exports[`renders demo correctly 1`] = `
-
-
1
-
2
-
3
-
4
+
+
1
+
2
+
3
+
4
1/4
diff --git a/src/swipe/test/demo.spec.js b/src/swipe/test/demo.spec.js index 43aab9265..5c70922b5 100644 --- a/src/swipe/test/demo.spec.js +++ b/src/swipe/test/demo.spec.js @@ -1,17 +1,4 @@ import Demo from '../demo'; import { snapshotDemo } from '../../../test/demo'; -import { mockGetBoundingClientRect } from '../../../test'; -let restore; - -snapshotDemo(Demo, { - beforeTest: () => { - restore = mockGetBoundingClientRect({ - width: 100, - height: 100, - }); - }, - afterTest: () => { - restore(); - }, -}); +snapshotDemo(Demo);