[Improvement] Rebuild test system (#1051)
This commit is contained in:
@@ -128,10 +128,12 @@ export default create({
|
||||
// initialize swipe position
|
||||
initialize() {
|
||||
clearTimeout(this.timer);
|
||||
const rect = this.$el.getBoundingClientRect();
|
||||
if (this.$el) {
|
||||
const rect = this.$el.getBoundingClientRect();
|
||||
this.width = rect.width;
|
||||
this.height = rect.height;
|
||||
}
|
||||
this.swiping = true;
|
||||
this.width = rect.width;
|
||||
this.height = rect.height;
|
||||
this.active = this.initialSwipe;
|
||||
this.offset = this.count > 1 ? -this.size * this.active : 0;
|
||||
this.swipes.forEach(swipe => {
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`renders swipe correctly 1`] = `
|
||||
<div>
|
||||
<div>
|
||||
<div class="van-swipe">
|
||||
<div class="van-swipe__track" style="width:0px;transition-duration:500ms;transform:translateX(0px);">
|
||||
<div class="van-swipe-item" style="width:0px;height:100%;transform:translateX(0px);">1</div>
|
||||
<div class="van-swipe-item" style="width:0px;height:100%;transform:translateX(0px);">2</div>
|
||||
<div class="van-swipe-item" style="width:0px;height:100%;transform:translateX(0px);">3</div>
|
||||
<div class="van-swipe-item" style="width:0px;height:100%;transform:translateX(0px);">4</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="van-swipe">
|
||||
<div class="van-swipe__track" style="width:0px;transition-duration:500ms;transform:translateX(0px);">
|
||||
<div class="van-swipe-item" style="width:0px;height:100%;transform:translateX(0px);">
|
||||
<img>
|
||||
</div>
|
||||
<div class="van-swipe-item" style="width:0px;height:100%;transform:translateX(0px);">
|
||||
<img>
|
||||
</div>
|
||||
<div class="van-swipe-item" style="width:0px;height:100%;transform:translateX(0px);">
|
||||
<img>
|
||||
</div>
|
||||
<div class="van-swipe-item" style="width:0px;height:100%;transform:translateX(0px);">
|
||||
<img>
|
||||
</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="van-swipe">
|
||||
<div class="van-swipe__track" style="width:0px;transition-duration:500ms;transform:translateX(0px);">
|
||||
<div class="van-swipe-item" style="width:0px;height:100%;transform:translateX(0px);">1</div>
|
||||
<div class="van-swipe-item" style="width:0px;height:100%;transform:translateX(0px);">2</div>
|
||||
<div class="van-swipe-item" style="width:0px;height:100%;transform:translateX(0px);">3</div>
|
||||
<div class="van-swipe-item" style="width:0px;height:100%;transform:translateX(0px);">4</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div class="demo-swipe--vertical van-swipe">
|
||||
<div class="van-swipe__track" style="height:0px;transition-duration:500ms;transform:translateY(0px);">
|
||||
<div class="van-swipe-item" style="width:0px;height:0px;transform:translateY(0px);">1</div>
|
||||
<div class="van-swipe-item" style="width:0px;height:0px;transform:translateY(0px);">2</div>
|
||||
<div class="van-swipe-item" style="width:0px;height:0px;transform:translateY(0px);">3</div>
|
||||
<div class="van-swipe-item" style="width:0px;height:0px;transform:translateY(0px);">4</div>
|
||||
</div>
|
||||
<!---->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
@@ -0,0 +1,4 @@
|
||||
import Swipe from '../';
|
||||
import demoTest from '../../../test/demo-test';
|
||||
|
||||
demoTest(Swipe);
|
||||
Reference in New Issue
Block a user