Skip to content

Commit 75025fb

Browse files
authored
Merge pull request #26 from UiPath/feature/testing_cursor
Feature / Expose testing cursor utility
2 parents 6e2e07a + cd1b98d commit 75025fb

File tree

4 files changed

+60
-17
lines changed

4 files changed

+60
-17
lines changed

CHANGELOG.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# v0.9.2 (2019-06-01)
2+
3+
### Features:
4+
5+
* **EventGenerator** expose the `cursor` utility that injects a cursor image, to help visualize UTs.
6+
7+
# v0.9.1 (2019-06-01)
8+
9+
### First Official Release
10+
11+
#### Components
12+
13+
* [grid](https://uipath.github.io/angular-components/modules/UiGridModule.html)
14+
* [suggest](https://uipath.github.io/angular-components/modules/UiSuggestModule.html)
15+
16+
#### Directives
17+
18+
* [autofocus](https://uipath.github.io/angular-components/modules/UiAutofocusModule.html)
19+
* [click-outside](https://uipath.github.io/angular-components/modules/UiClickOutsideModule.html)
20+
* [clipboard](https://uipath.github.io/angular-components/modules/UiClipboardModule.html)
21+
* [date-format](https://uipath.github.io/angular-components/modules/UiDateFormatModule.html)
22+
* [second-format](https://uipath.github.io/angular-components/modules/UiSecondFormatModule.html)
23+
* [drag-and-drop](https://uipath.github.io/angular-components/modules/UiDragAndDropModule.html)
24+
* [ng-let](https://uipath.github.io/angular-components/modules/UiNgLetModule.html)
25+
* [scroll-into-view](https://uipath.github.io/angular-components/modules/UiScrollIntoViewModule.html)
26+
* [virtual-scroll-range-loader](https://uipath.github.io/angular-components/modules/UiVirtualScrollRangeLoaderModule.html)
27+
* [virtual-scroll-viewport-resize](https://uipath.github.io/angular-components/modules/UiVirtualScrollViewportResizeModule.html)
28+
29+
#### a11y
30+
31+
* [queued-announcer](https://uipath.github.io/angular-components/injectables/QueuedAnnouncer.html)
32+
33+
#### Testing
34+
35+
* [EventGenerator](https://uipath.github.io/angular-components/classes/EventGenerator.html)
36+
* [Key](https://uipath.github.io/angular-components/classes/Key.html)
37+
* [FakeFileList](https://uipath.github.io/angular-components/classes/FakeFileList.html)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "angular-components",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"author": {
55
"name": "UiPath Inc",
66
"url": "https://github.com/UiPath/angular-components"

projects/angular/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@uipath/angular",
3-
"version": "0.9.1",
3+
"version": "0.9.2",
44
"license": "MIT",
55
"author": {
66
"name": "UiPath Inc",

projects/angular/testing/src/utilities/event-generator.ts

Lines changed: 21 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,36 @@ type KeyOrKeyName = (IKey | keyof Key);
1717
* @dynamic
1818
*/
1919
export class EventGenerator {
20-
private static _cursor = {
20+
/**
21+
* A cursor utility that draws a cursor icon over the tested component.
22+
*
23+
* Very useful when testing hover effects.
24+
*
25+
*/
26+
public static cursor = {
2127
ref: {} as HTMLElement,
2228
initialize: (parent?: HTMLElement) => {
2329
if (!parent) { return; }
24-
EventGenerator._cursor.ref = document.createElement('div') as HTMLElement;
30+
EventGenerator.cursor.ref = document.createElement('div') as HTMLElement;
2531

26-
EventGenerator._cursor.ref.style.position = 'absolute';
27-
EventGenerator._cursor.ref.style.display = 'block';
28-
EventGenerator._cursor.ref.style.left = '0px';
29-
EventGenerator._cursor.ref.style.top = '0px';
30-
EventGenerator._cursor.ref.style.width = '20px';
31-
EventGenerator._cursor.ref.style.height = '20px';
32-
EventGenerator._cursor.ref.style.background = CURSOR_IMG;
32+
EventGenerator.cursor.ref.style.position = 'absolute';
33+
EventGenerator.cursor.ref.style.display = 'block';
34+
EventGenerator.cursor.ref.style.left = '0px';
35+
EventGenerator.cursor.ref.style.top = '0px';
36+
EventGenerator.cursor.ref.style.width = '20px';
37+
EventGenerator.cursor.ref.style.height = '20px';
38+
EventGenerator.cursor.ref.style.background = CURSOR_IMG;
3339

34-
parent.appendChild(EventGenerator._cursor.ref);
40+
parent.appendChild(EventGenerator.cursor.ref);
3541
},
3642
destroy: (parent?: HTMLElement) => {
3743
if (!parent) { return; }
3844

39-
parent.removeChild(EventGenerator._cursor.ref);
45+
parent.removeChild(EventGenerator.cursor.ref);
4046
},
4147
update: (x: number, y: number) => {
42-
EventGenerator._cursor.ref.style.left = `${x - 10}px`;
43-
EventGenerator._cursor.ref.style.top = `${y - 10}px`;
48+
EventGenerator.cursor.ref.style.left = `${x - 10}px`;
49+
EventGenerator.cursor.ref.style.top = `${y - 10}px`;
4450
},
4551
};
4652

@@ -208,7 +214,7 @@ export class EventGenerator {
208214
value: offsetY,
209215
});
210216

211-
this._cursor.update(offsetX, offsetY);
217+
this.cursor.update(offsetX, offsetY);
212218
return event;
213219
}
214220

@@ -231,7 +237,7 @@ export class EventGenerator {
231237
value: offsetY,
232238
});
233239

234-
this._cursor.update(offsetX, offsetY);
240+
this.cursor.update(offsetX, offsetY);
235241
return event;
236242
}
237243

0 commit comments

Comments
 (0)