angular2-testing Questions
2
i have a homecomponent where the html is
//home.component.html
<router-outlet></router-outlet>
//home.component.ts
import { Component, OnInit } from '@angular/core';
import { Route...
Vilayet asked 30/9, 2016 at 13:30
1
Solved
I want to actually check, that the selected attribute has been rendered with a true instead of an undefined.
My working (manually tested) Component functionality:
export class PlayerSelectorCompo...
Redmond asked 18/6, 2017 at 15:13
1
I am testing a simple service. The service uses 2 values from another service.
Basically, I would like to test those 2 values : isLogged = false and isLogged = true.
Is it possible to just chang...
Dextrality asked 27/3, 2017 at 12:10
2
Solved
I am trying to write unit tests for my API service but have some trouble catching HTTP errors. I am following this guide along with the Angular2 docs since the guide is (slightly) out of date in so...
Pectin asked 28/12, 2016 at 15:27
1
Solved
I'm trying to test a simple header component that has a button and when being focused - opens a dropdown using just css visibility property.
This is the html:
<nav class="navigation">
<...
Labile asked 20/2, 2017 at 15:59
1
Testing with Jasmine and Karma,
I am using the zxcvbn library to do some password strength calculations.
This fails when I try to run a spec on it, by calling the updateScore() function below.
pr...
Electrosurgery asked 19/1, 2017 at 19:38
1
Solved
i have a component to test as follow :
import {Component, OnInit, Input} from "@angular/core";
@Component({
selector: 'column',
template: '<ng-content></ng-content>',
host: {
'[c...
Throstle asked 24/2, 2017 at 13:48
1
Solved
I have a question about testing a routed component in angular2.
Here is a simple component, which depends on a route with a parameter 'foo'. The attribute foo in the component will be set to the v...
Elroy asked 22/2, 2017 at 8:6
1
Solved
Our project structure follows this: Angular2-webpack-starter.
Our project successfully compiles, build and can be seen in the browser. No problems here.
But when we try to run the test cases usin...
Courier asked 25/1, 2017 at 0:15
3
Solved
I have the following code...
export class LoginComponent {
userName: string;
password: string;
rememberMe: boolean = false;
constructor( private auth: AuthenticationService,
private router: R...
Cow asked 28/11, 2016 at 21:1
2
Solved
I am trying to test a component which has ngOnDestroy() method which has all the unsubscribe() method calls. But, while testing, when I run my testing file (spec file) it gives me error saying:
ca...
Saccharometer asked 28/10, 2016 at 17:15
1
Solved
I need to test my service where I'm using @ionic/storage to get and set data in a method. Do I need to mock the whole storage mechanism or what would be the best practice for that?
Prunelle asked 9/1, 2017 at 14:41
1
Solved
I'm writing some tests for a service and I'm altering the response from mock functions to test various cases. At the moment, every time I want to change the response of a mock, I need to reset the ...
Venavenable asked 10/1, 2017 at 11:33
2
Solved
I'm trying to unit test my auth guard service. From this answer I was able to get this far, but now when I run the unit test for this, it says Expected spy navigate to have been called.
How to I g...
Lethe asked 5/1, 2017 at 22:57
1
Solved
I am testing an Angular2 component and want to assert nativeElement's property of the component, but there is no typescript definition for it. My test looks like this:
beforeEach( () => {
myCo...
Ardatharde asked 8/12, 2016 at 12:34
1
Solved
I've just started to add unit tests to my angular 2 app and I am having a nightmare, every time I have to import something new into my app that I haven't used before, it adds "/testing" to the end ...
Zenaidazenana asked 20/11, 2016 at 2:42
1
Solved
I'm getting this error when running a jasmine spec in angular 2:
Cannot read property 'injector' of null jasmine angular 2
stack trace:
TypeError: Cannot read property 'injector' of null
at ...
Citriculture asked 20/11, 2016 at 1:3
1
Solved
I am writing test cases for angular2 components.
I had created a service which uses observable stream as below:
import {Injectable} from '@angular/core'
import {Subject} from 'rxjs/Subject';
impo...
Thumbnail asked 25/10, 2016 at 12:52
1
I am creating unit-testcases for my angular2 components.
so far test cases are running correctly.
but I am facing issues regarding my asynchronous calls.
For ex. I have following method for crea...
Priceless asked 24/10, 2016 at 11:22
1
Solved
I've created a testing (spec) file for a component I'm testing. But when I run the test, it gives me an error saying
Cannot read property 'subscribe' of undefined
TypeError: Cannot read property 's...
Falsify asked 19/10, 2016 at 22:5
2
Solved
When do you use the async function in the TestBed when testing in Angular 2?
When do you use this?
beforeEach(() => {
TestBed.configureTestingModule({
declarations: [MyModule],
schemas: [N...
Ventral asked 19/10, 2016 at 9:1
1
Solved
This time I'm trying to mock a service (that does http calls) to test a component.
@Component({
selector: 'ub-funding-plan',
templateUrl: './funding-plan.component.html',
styleUrls: ['./funding...
Zenas asked 13/10, 2016 at 12:43
1
Solved
I am using Angular-CLI (webpack version) for my Angular 2 project and I also need to use jQuery (sadly. In my case, it's a dependency of Semantic-UI and I am using it for handling menu dropdowns).
...
Simplify asked 13/10, 2016 at 5:44
1
Solved
I wrote a very simple custom validator for an input field:
import { Directive } from '@angular/core';
import { AbstractControl, NG_VALIDATORS } from '@angular/forms';
function numberValidator(c: A...
Spend asked 10/10, 2016 at 11:59
1
I am writing unit tests for Angular 2 component with Jasmine. I would like to test if my document title has been set to a specific value when my component is instantiated.
Here is my component
impo...
Velocipede asked 28/9, 2016 at 22:57
© 2022 - 2024 — McMap. All rights reserved.