Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Commit acc2fb8

Browse files
matskomhevery
authored andcommitted
feat(browserTrigger): allow support for custom timeStamps in events
1 parent 3b3e89d commit acc2fb8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/ngScenario/browserTrigger.js

+7-2
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@
101101
}
102102
catch(e) {
103103
evnt = document.createEvent('TransitionEvent');
104-
evnt.initTransitionEvent(eventType, null, null, null, eventData.elapsedTime);
104+
evnt.initTransitionEvent(eventType, null, null, null, eventData.elapsedTime || 0);
105105
}
106106
}
107107
}
@@ -116,7 +116,7 @@
116116
}
117117
catch(e) {
118118
evnt = document.createEvent('AnimationEvent');
119-
evnt.initAnimationEvent(eventType, null, null, null, eventData.elapsedTime);
119+
evnt.initAnimationEvent(eventType, null, null, null, eventData.elapsedTime || 0);
120120
}
121121
}
122122
}
@@ -128,6 +128,11 @@
128128
pressed('shift'), pressed('meta'), 0, element);
129129
}
130130

131+
/* we're unable to change the timeStamp value directly so this
132+
* is only here to allow for testing where the timeStamp value is
133+
* read */
134+
evnt.$manualTimeStamp = eventData.timeStamp;
135+
131136
if(!evnt) return;
132137

133138
var originalPreventDefault = evnt.preventDefault,

0 commit comments

Comments
 (0)