Skip to content

Commit 3ad5425

Browse files
authored
adding before each so that tests doesn't share states between them
1 parent d401412 commit 3ad5425

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

test/unit/events/touch.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,13 @@ suite('Touch Events', function() {
3232
myp5.remove();
3333
});
3434

35+
beforeEach(function() {
36+
// Reset pointer state so tests don't leak active pointers into each other.
37+
myp5._activePointers.clear();
38+
myp5.touches = [];
39+
myp5.mouseIsPressed = false;
40+
});
41+
3542
suite('p5.prototype.touches', function() {
3643
test('should be an empty array', function() {
3744
assert.deepEqual(myp5.touches, []);
@@ -44,6 +51,7 @@ suite('Touch Events', function() {
4451
});
4552

4653
test('should contain the touch registered', function() {
54+
window.dispatchEvent(touchEvent1);
4755
assert.strictEqual(myp5.touches[0].id, 1);
4856
});
4957
});

0 commit comments

Comments
 (0)