MCPcopy
hub / github.com/angular/components / hover

Function hover

src/cdk/menu/menu.spec.ts:192–215  ·  view source on GitHub ↗

* Fakes mouse hover events from some source point to some target point. Along the way, emits * mouse move events and mouse enter events when the element under the mouse changes. * * It assumes that moves will occur left to right and down. * @param from the starting point

(from: Point, to: Point, inMenu: HTMLElement, duration: number)

Source from the content-addressed store, hash-verified

190 * @return the number of elements the mouse entered into.
191 */
192 function hover(from: Point, to: Point, inMenu: HTMLElement, duration: number) {
193 const getNextPoint = getNextPointIterator(from, to);
194
195 let currentPoint: Point | null = from;
196 let currElement = getElementAt(currentPoint);
197
198 const timeout = duration / (to.x - from.x);
199
200 let numEnters = 0;
201 while (currentPoint) {
202 mousemove(inMenu, currentPoint);
203 const nextElement = getElementAt(currentPoint);
204 if (nextElement !== currElement && nextElement instanceof HTMLButtonElement) {
205 numEnters++;
206 mouseout(currElement);
207 mouseenter(nextElement, currentPoint);
208 currElement = nextElement;
209 fixture.detectChanges();
210 }
211 currentPoint = getNextPoint();
212 tick(timeout);
213 }
214 return numEnters;
215 }
216
217 /**
218 * Get a function which determines the next point to generate when moving from one point to

Callers 1

menu.spec.tsFile · 0.85

Calls 5

getNextPointIteratorFunction · 0.85
getElementAtFunction · 0.85
mousemoveFunction · 0.85
mouseenterFunction · 0.85
mouseoutFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…