How to use the @uipath/angular/testing.EventGenerator.input function in @uipath/angular

To help you get started, we’ve selected a few @uipath/angular examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github UiPath / angular-components / projects / angular / components / ui-suggest / src / ui-suggest.component.spec.ts View on Github external
it('should set value', async(async () => {
                fixture.detectChanges();

                const display = fixture.debugElement.query(By.css('.display'));
                display.nativeElement.dispatchEvent(EventGenerator.click);
                fixture.detectChanges();

                const searchInput = fixture.debugElement.query(By.css('.mat-input-element')).nativeElement;
                searchInput.value = randomString;
                searchInput.dispatchEvent(EventGenerator.input());
                fixture.detectChanges();
                await fixture.whenStable();

                const [query] = sourceSpy.calls.mostRecent().args;
                expect(query).toBe(randomString);

                const itemContainer = fixture.debugElement.query(By.css('.item-list-container'));
                itemContainer.nativeElement.dispatchEvent(
                    EventGenerator.keyDown(Key.Enter),
                );
                fixture.detectChanges();

                expect(uiSuggest.value[0].text).toBe(randomString);
            }));
github UiPath / angular-components / projects / angular / components / ui-grid / src / components / ui-grid-search / ui-grid-search.component.spec.ts View on Github external
it('should clear value if the user presses the ENTER key on the clear button', () => {
                const input = fixture.debugElement.query(By.css('input'));

                input.nativeElement.value = value;
                input.nativeElement.dispatchEvent(EventGenerator.input());

                fixture.detectChanges();

                expect(search.value).not.toEqual('');

                const clear = fixture.debugElement.query(By.css('.ui-grid-search-cancel'));

                clear.nativeElement.dispatchEvent(EventGenerator.keyUp(Key.Enter));

                fixture.detectChanges();

                expect(search.value).toEqual('');
            });
        });
github UiPath / angular-components / projects / angular / components / ui-grid / src / ui-grid.component.spec.ts View on Github external
const searchTerm = faker.random.word();

                grid.header!.searchFilter
                    .pipe(
                        take(1),
                        finalize(done),
                    ).subscribe(([filter]) => {
                        expect(filter.property).toEqual('myNumber');
                        expect(filter.value).toEqual(searchTerm);
                    });

                const search = fixture.debugElement.query(By.css('ui-grid-search'));
                const input = search.query(By.css('input'));

                input.nativeElement.value = searchTerm;
                input.nativeElement.dispatchEvent(EventGenerator.input());
                fixture.detectChanges();
            });
        });