How to JUnit test HttpErrorInterceptor in angular-jasmine

I want to JUnit test my Interceptor, I developed two different way and both are passing but none of them got reach the catchError that is the part that I want really test. How can I really test that the interceptor throw the error message that I expect.Why the test is passing when is not […]

Table does not show all lines with ngFor-Angular 11

I’m trying to create a table to show dates of the week, everyday has his own available appointments, but I don’t know why if the array has 9 records, the table shows only 3 and I can see in the image how the table looks truncated: result The Html code is: <table> <colgroup span="6" width="100"></colgroup> […]

By Perez Ch
Categorized as angular, angular11, css, html, typescript Tagged , , , ,

How to test routing navigation with RouterTestingModule

I want to test the methode that sends me to an specific page. I have check several examples and all are done in the same way I did, but I receive an error: Expected spy navigate to have been called with: [ ‘/themen’ ] but it was never called. Error: Expected spy navigate to have […]

How to test a methode with an event param in angular-jasmine

I show a button when the user is on the top of the page and when is on the bottom the button is hidden. And I want to create a test for that methode but I have no idea how to mock the event data (,, I have this html: <mat-list class="availability" (scroll)="onWindowScroll($event)"> […]

How to apply mask to a default value in Typescript

I have a mask-phone directive that works perfectly in the input when the user write a value, but I need to set a default value and I don’t know how to apply the mask directive in the component method. The value is show it in the input without the mask and only if I modify […]

Undefined validation does not work-angular 11

I have a component where I subscribe to get an Customer object, this customer has a telephone that is string but It can comes undefined, because in the database is empty so the backend does not send it. That is why I need to make a validation before I print the data in the html. […]

How to fetch a value as default value in mat-select in Angular when coming from other component

I have a component with a mat-select, once I choose the option and click the button next the selected value travel to the other component perfectly, but If I want to go back to change my selection, then I would like this time to have in the mat-select the old value as default value. Using […]

Angular 9-WebComponent and i18n (Translation Modul)

I made a webComponent, so I can use it in other applications. But I have two problems, when I call the WebComponent in the host application the translations file (../assets/i18n/de.json) and the styles from my webComponent are not being found. import {CommonModule, registerLocaleData} from ‘@angular/common’; import {HTTP_INTERCEPTORS, HttpClientModule} from ‘@angular/common/http’; import {DoBootstrap, Injector, LOCALE_ID, NgModule} […]

By Perez Ch
Categorized as angular, angular10, web-component Tagged , ,

Child Component with EventEmitter test

I have this child component that emit true or false when the style change to a parent component: export class PruebaComponent implements OnInit, OnChanges { @Output() statusEvent = new EventEmitter<boolean>(); getSytle(): string { return this.valueStyle; } private calcStyle(): void { this.calcPopUpStyle(); if (this.isEngReady) { this.valueStyle = ‘icon-green’; this.statusEvent .emit(true); } else { this.valueStyle = ‘icon-red’; […]

Still Have Questions?

Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us