Skip to content
This repository was archived by the owner on May 15, 2023. It is now read-only.

Commit e758682

Browse files
committed
Merge branch 'test-timeouts'
2 parents 9241b1f + 44b46cc commit e758682

File tree

2 files changed

+27
-16
lines changed

2 files changed

+27
-16
lines changed

iron-swipeable-container.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
/**
8686
* If true, then the container will not allow swiping.
8787
*/
88-
disabled: {type: Boolean, value: false},
88+
disabled: {type: Boolean, value: false, observer: '__NOOP_IE11'},
8989

9090
/**
9191
* The ratio of the width of the element that the translation animation
@@ -109,6 +109,10 @@
109109
transition: {type: String, value: '300ms cubic-bezier(0.4, 0.0, 1, 1)'}
110110
},
111111

112+
// This observer is only here because it prevents a bug that occurs in IE11
113+
// where attributes used to set boolean properties do not otherwise apply.
114+
__NOOP_IE11: function() {},
115+
112116
ready: function() {
113117
this._transitionProperty = 'opacity, transform';
114118
this._swipeComplete = false;

test/basic.html

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@
7171
</test-fixture>
7272

7373
<script>
74+
(function() {
75+
// The maximum number of milliseconds after completing a track action that
76+
// may occur before the 'iron-swipe' event is dispatched, if any would be.
77+
// This value should be longer than the swipe transition.
78+
const SWIPE_TIMEOUT = 500;
79+
7480
suite('native elements', function() {
7581
test('dragging less than halfway does not swipe', function(done) {
7682
var container = fixture('basic');
@@ -89,8 +95,8 @@
8995
expect(Polymer.dom(container).queryDistributedElements('*').length)
9096
.to.be.equal(2);
9197
done();
92-
}, 1);
93-
});
98+
}, SWIPE_TIMEOUT);
99+
}, 1);
94100
});
95101

96102
test('dragging more than halfway swipes it', function(done) {
@@ -108,7 +114,7 @@
108114
});
109115

110116
MockInteractions.track(element, 60, 0);
111-
});
117+
}, 1);
112118
});
113119

114120
test('an element with disable-swipe cannot be swiped', function(done) {
@@ -129,8 +135,8 @@
129135
expect(Polymer.dom(container).queryDistributedElements('*').length)
130136
.to.be.equal(2);
131137
done();
132-
}, 1);
133-
});
138+
}, SWIPE_TIMEOUT);
139+
}, 1);
134140
});
135141
});
136142

@@ -152,8 +158,8 @@
152158
expect(Polymer.dom(container).queryDistributedElements('*').length)
153159
.to.be.equal(2);
154160
done();
155-
}, 1);
156-
});
161+
}, SWIPE_TIMEOUT);
162+
}, 1);
157163
});
158164

159165
test('dragging more than halfway swipes it', function(done) {
@@ -171,7 +177,7 @@
171177
});
172178

173179
MockInteractions.track(element, 60, 0);
174-
});
180+
}, 1);
175181
});
176182

177183
test('an element with disable-swipe cannot be swiped', function(done) {
@@ -192,8 +198,8 @@
192198
expect(Polymer.dom(container).queryDistributedElements('*').length)
193199
.to.be.equal(2);
194200
done();
195-
}, 1);
196-
});
201+
}, SWIPE_TIMEOUT);
202+
}, 1);
197203
});
198204
});
199205

@@ -217,8 +223,8 @@
217223
expect(Polymer.dom(container).queryDistributedElements('*').length)
218224
.to.be.equal(2);
219225
done();
220-
}, 1);
221-
});
226+
}, SWIPE_TIMEOUT);
227+
}, 1);
222228
});
223229

224230
test(
@@ -240,8 +246,8 @@
240246
expect(Polymer.dom(container).queryDistributedElements('*').length)
241247
.to.be.equal(2);
242248
done();
243-
}, 1);
244-
});
249+
}, SWIPE_TIMEOUT);
250+
}, 1);
245251
});
246252
});
247253

@@ -268,9 +274,10 @@
268274
});
269275

270276
MockInteractions.track(element, 60, 0);
271-
});
277+
}, 1);
272278
});
273279
});
280+
})();
274281
</script>
275282
</body>
276283
</html>

0 commit comments

Comments
 (0)