angular-test Questions

2

Using Angular 8, @angular-builders/jest 8.0.2, jest 24.8, and given the following test passes import { tick, fakeAsync } from '@angular/core/testing'; it('test 1000 milliseconds', fakeAsync(() =&...
Esteban asked 10/6, 2019 at 15:30

1

Note this is not specific to Protractor. The issue is with Angular 2's built-in Testability service which Protractor happens to use. Protractor invokes Testability.whenStable via a call to waitForA...
Cadmar asked 4/2, 2019 at 2:51

4

I have a project on Angular 5 and I encountered with following issue. I have a component ComponentWithSnackBar which triggers displaying of a snack-bar: showSnackBar() { this.snackBar.open('Mess...
Marcosmarcotte asked 3/4, 2018 at 22:40

2

I am writing unit test for html div having a *ngIf condition. <div *ngIf="clientSearchResults$ | async as searchResults" class = 'fgf' #datalist id="mydata" > <app-client-list id="clien...
Pneumatology asked 1/4, 2018 at 11:24

0

I'm trying to test an Angular Resolver which accesses children routes param. My guard works fine but I cannot create an unit test easily because I cannot create an ActivatedRouteSnapshot with chil...
Headset asked 19/7, 2019 at 7:52

2

Solved

I'm trying to write a test for my mat-menu in my application's toolbar. When I call button.click() in my test, I get a Cannot read property 'templateRef' of undefined error in the console. As all ...
Luftwaffe asked 10/8, 2018 at 10:57

2

Solved

I am trying to unit test this material dialog to test if the template is rendering the right injected object. The component works fine when used properly Component - The Dialog export class Confi...

1

I have an angular component that will POST some data to a URL in our app, and then does nothing else since no data is returned back from that post. I am having trouble testing this since normally H...
Decline asked 29/4, 2019 at 19:3

1

As far as my understanding goes from reading the Angular testing docs, calling tick() flushes both (supported) macro tasks, and micro-task queues within the fakeAsync block. In which case, under th...
Augustaugusta asked 16/9, 2018 at 22:41

1

Solved

I've been trying to setup testing in our Hybrid AngularJS/NG6 App but wow is this difficult to do. I keep getting constant errors. The latest is the following: Error: StaticInjectorError(Dynamic...
Erhard asked 12/2, 2019 at 13:30

3

I have a Component which embeds an Angular Material MatSelect element. In a test that I am writing, I need to simulate the selection of a certain option and make sure that the selectionChange Obse...
Studley asked 1/2, 2019 at 7:1

1

I have a component which uses Routes. I want to unit test the routes but am unale to do so using RouterTestingModule. The spec I have written is import {async, ComponentFixture, fakeAsync, TestBe...
Rascal asked 17/12, 2018 at 21:15

2

Solved

Just want to say that I recognize that there are many SO posts related to "Can't bind to X since it isn't a known property of Y" errors. I've looked at a ton of them, and have found a number of ans...
Emendation asked 16/11, 2018 at 20:40

1

Solved

I'm looking to the right way to end to end test (e2e) an ag-grid angular application. protractor documentation says that you can use by.model(modelName) to sendKeys to an input field using ng-mode...
Intellectualism asked 9/11, 2018 at 4:39

1

I am testing the call function below in angular 4. import { Component, OnInit } from '@angular/core'; import { AppService } from './app.service'; @Component({ selector: 'app-root', templateUrl:...
Resentful asked 1/11, 2018 at 21:49

2

Solved

I am currently using a autocomplete mechanism (typeahead) of ngBootstrap. Now I want to unit test if a method is called on every sequence of an input event. The error on my test case is currently: ...
Ingraham asked 21/10, 2018 at 11:20

1

Solved

I am using Angular 6 and I have one concern regarding every test which I have seen so far. Here's a simple test of simple component which is generated by cli. describe('CompComponent', () => { ...
Underexpose asked 17/10, 2018 at 22:29

1

Solved

I have written my first angular application in Angular 6. I have not written any test yet but there are some default test files created automatically while generating components and services. Whe...
Plank asked 10/10, 2018 at 4:30

1

Solved

I have a simple case. The standard AppComponent of an Angular app contains a ChildComponent which is defined in its own module ChildModule. The template of ChildComponent is very simple <div c...
Erastianism asked 22/7, 2018 at 8:43

1

I am unit testing an angular application and there is a service I need to mock. I am able to mock service methods without any problem but when I try to mock properties in the same way it give me er...
Prohibitory asked 3/10, 2017 at 17:6

1

I have a form like this: <form id="save_form" (ngSubmit)="save()"> <input id="input_user" type="text" [formControl]="myForm" /> <button type="submit">save</button> </f...

1

I wanted to use template forms and [min] and [max] directives, so I have created them and they work. But the test confuses me: validation is not executed asynchronously, yet after changing my value...
Heliopolis asked 15/3, 2018 at 11:23

0

I hope this question clarifies so many people about testing template driven forms that Angular documentation barely mentions. I have an input inside this form that I want to test. I want to test a ...
Favus asked 22/4, 2018 at 20:52

1

Solved

I want to test an HTTP call error response with the HttpClientTestingModule. This works fine until I add a rxjs retry(2) to the HTTP call. Then, the test obviously complains that an unexpected requ...

1

Solved

I have the following directive. When applied to an input element, it checks for characters and calls preventDefault when the character is forbidden: @Directive({ selector: '[cdtPreventInput]' }) ...
Tocharian asked 22/2, 2018 at 15:28

© 2022 - 2024 — McMap. All rights reserved.