angular2-testing Questions

3

Solved

I am new to Protractor. I have developed few tests cases to accomplish the end to end testing. These test cases works fine in all 3 different environments that we have : dev, testing and production...
Summersummerhouse asked 1/9, 2017 at 10:11

3

I have following function to unit test. I have taken element which is text box with view child in component and in testing I need to test whether my text box got focused or not after setTimeout() w...
Weighin asked 22/6, 2017 at 9:53

2

Solved

I have a components that gets a value from the params property of a ActivatedRoute. The components looks like: ...... constructor(public userRegistration: UserRegistrationService, public userLog...
Misalliance asked 14/6, 2018 at 4:10

2

I am using angular-cli testing framework. inside my component , I have used 'ng2-slim-loading-bar' node module. submit(){ this._slimLoadingBarService.start(() => { }); //method operations }...
Overspill asked 18/10, 2016 at 11:18

2

Solved

Say that I want to simply unit test a component that takes parameters taken from a part of the route. For instance, my component's ngOnInit looks like this: ngOnInit() { this.route.parent.params...
Monomorphic asked 5/2, 2017 at 12:46

2

Solved

I am learning Angular 2 testing and I am getting an error that currently doesn't make sense to me. 'expect' was used when there was no current spec, Test: import {ExperimentsComponent} from "./e...
Hunfredo asked 2/1, 2017 at 17:38

2

I would like to test simple angular component with input. So an example in the bottom has little preparation for the test, and in a component should occur test function on blur, which shows log, b...
Byproduct asked 21/6, 2017 at 16:30

2

Solved

I have a component in angular 2 which responds to changes in the route parameters (the component doesn't reload from scratch because we're not moving out of the main route. Here's the component cod...

3

Solved

How do I unit test routers in Angular version 2.0.0 with karma and jasmine? Here's what my old unit test looks like in version 2.0.0-beta.14 import { it, inject, injectAsync, beforeEa...

1

Solved

I writing unit test for angular 2 by jasmine + karma. I have the component check exception and throw error. And write unit test to check this case. But I seen an error message when trigger fixture....
Whitley asked 14/12, 2017 at 3:41

2

Solved

When I run this unit test: it('can click profile link in template', () => { const landingPageLinkDe = linkDes[0]; const profileLinkDe = linkDes[1]; const aboutLinkDe = linkDes[2]; const fin...
Polarimeter asked 11/12, 2016 at 4:46

2

Solved

I need to be able to mock the activated route parameters to be able to test my component. Here's my best attempt so far, but it doesn't work. { provide: ActivatedRoute, useValue: { params: [ { 'i...
Faubert asked 7/9, 2016 at 18:26

4

Solved

This might be an Ionic 2 only question, as I don't see NavParams in the Angular 2 docs, but some concepts might translate so I tagged both. Given that I call navparams.get('somekey') in order to l...
Supra asked 2/1, 2017 at 20:36

1

I am trying to run unit tests on my component which is an output for my router. I have stubbed the router and service used by the component and I am trying to pull the element using the fixture.deb...
Polito asked 19/10, 2016 at 13:6

3

Solved

All is in the title : how can one test what is done in the component's constructor ? For your information, I am using a service that requires a setting, and I would like to see if the 2 methods th...
Aver asked 19/4, 2017 at 14:5

2

I have this simple method which needs to be tested: public onLayerContainerClick(event: Event): void { event.stopPropagation(); event.preventDefault(); if (event.srcElement.classList.contains(...
Ratiocinate asked 8/12, 2017 at 10:17

3

Solved

I'm trying to introduce testing into my existing project, but I keep running into the same error, which I think is prohibiting me from running the tests. The error I get is ERROR in .../src/app/da...
Tiptoe asked 20/3, 2017 at 9:18

0

I am trying to test the HTTP calls and referring to the following page to write unit tests: https://angular-2-training-book.rangle.io/handout/testing/services/mockbackend.html But when I looked on...

1

I have a component which employs template-driven form <form (ngSubmit)="onSearchCorpus(form)" #form="ngForm"> <combo-box [(ngModel)]="model.corpus" name="corpus" #corpus="ngModel"><...

2

Solved

I have a service function which is returning Observable and I am consuming that service inside one of my components. I have written a unit test for the component using the technique posted here. Ho...
Lueluebke asked 18/11, 2016 at 8:6

2

Solved

I want to run my old angular2 unit-test with new RC4 version, but I have a problem. What happened to MockApplicationRef ? What I should use here instead ? provide(ApplicationRef, { useClass: Moc...
Seisin asked 24/7, 2016 at 15:0

1

Below I have written down the code in which there is an asynchronous function, that uses setTimeout() internally and prints message after 3seconds. I have to write the spec using Jasmine. I have ...
Majors asked 25/7, 2017 at 18:42

3

Solved

Ive just upgraded Angular2 from RC3 to RC4 ... import { expect, it, iit, xit, describe, ddescribe, xdescribe, beforeEach, beforeEachProviders, withProviders, async, inject } from '@angular/cor...
Blakeslee asked 1/7, 2016 at 2:22

2

Solved

I am trying to write a test for a Component, but I always get the error: "Error: Error in ./ExpenseOverviewComponent class ExpenseOverviewComponent - inline template:41:8 caused by: No provider for...
Giesecke asked 19/10, 2016 at 7:45

2

Solved

I'm quite new to angular 2. I have a component which in turn has some other components in its template. How do I write unit tests to check if my parent component consists of other components. Me...
Annadiane asked 11/11, 2016 at 4:29

© 2022 - 2024 — McMap. All rights reserved.