Questions tagged [angular2-testing]
289 questions
1
vote
1 answer
Angular 2: template not updating in test
I am just trying to make this work.
it('should have expected
text', async(() => { let fixture = TestBed.createComponent(AppComponent); fixture.detectChanges(); const sectionEl = fixture.debugElement.query(By.css("section")); …

coder
- 353
- 5
- 18
1
vote
1 answer
Karma cannot load Angular 2 Component
My Karma cannont load angular 2 component. Drop this error:
[web-server] :404 : /base/src/client/app/container/container.component
i do everything with angular 2 testing tutorial (i only modified path in karma) So problem must be in path. but i…

user2510058
- 518
- 1
- 5
- 13
1
vote
1 answer
Protractor get iconbutton element

anasz3z3
- 13
- 1
- 6
1
vote
1 answer
testing component when a service injected angular2.0
I am using angular2.0 for my application
I am trying to write test cases for a component where a service is injected
//component.ts
import { Component, OnInit } from '@angular/core';
import { FPService } from…

mounika20
- 213
- 2
- 9
1
vote
1 answer
How to test Angular2 pipe in nodejs with mocha without karma
I'd like to be able to test an Angular2 pipe purely in nodejs environment without including karma etc.
It is possible to use typescript files as test suites for…

kamilkp
- 9,690
- 6
- 37
- 56
1
vote
1 answer
Why does Angular2 TestBed's compileComponents can't find my templates?
I have a component, let's call it MyComponent. It's using my.component.html as the templateUrl.
@Component({
selector: "my-component",
templateUrl: "./my.component.html",
styleUrls: ["./my.component.css"]
})
I am writing a test (spec) for…

user1532043
- 859
- 2
- 15
- 26
1
vote
1 answer
Test an async PipeTransform
Context
I have a basic PipeTransform, expect the fact that it is async. Why? because I have my own i18n service (because of parsing, pluralization and other constraints, I did my own) and it returns a Promise:
@Pipe({
name: "i18n",
…

Supamiu
- 8,501
- 7
- 42
- 76
1
vote
1 answer
Angular 2 RC5 Testing detectChanges not working
I'm building a loginform component with the following interface:
And that's the testing code:
it("Should send credentials out of the component", async(() => {
TestBed.compileComponents().then(() =>…

Serginho
- 7,291
- 2
- 27
- 52
1
vote
4 answers
Cannot add @angular/testing npm package to Angular2 project
I am trying to setup the Angular2 project with unit tests.
I am using this manual: http://twofuckingdevelopers.com/2016/01/testing-angular-2-with-karma-and-jasmine/
It is obviously outdated, because now default Angular2 npm package is @angular/*
The…

Maris
- 664
- 1
- 5
- 15
1
vote
1 answer
Angular 2 RC-5 Async testing is not working
That's the code:
import {
async,
inject,
TestBed
} from '@angular/core/testing';
import {
Http,
Response,
ResponseOptions,
RequestOptions,
BaseRequestOptions,
ConnectionBackend
} from "@angular/http";
import {MockBackend,…

Serginho
- 7,291
- 2
- 27
- 52
1
vote
1 answer
Error: Token must be defined! when testing with Angular 2 RC5
Back in June 2016, I wrote an article on how to test Angular 2 applications. I used angular2-seed as a starting point.
https://raibledesigns.com/rd/entry/testing_angular_2_0_rc1
I decided to rewrite this tutorial using Angular CLI (from its master…

Matt Raible
- 8,187
- 9
- 61
- 120
1
vote
1 answer
Angular 2 unit test parsing error using webpack
I'm getting the follow error when I run Angular 2 unit test using webpack:
FAILED TESTS:
Other Trims Tested
✖ should display other trims articles
PhantomJS 2.1.1 (Linux 0.0.0)
Error: Template parse errors:
Unexpected closing tag…

Josh V
- 123
- 2
- 10
1
vote
2 answers
Angular2 RC4: overrideDirective
I just updated RC3 to RC4 and now i get this error in my tests:
Error: overrideDirective is not supported in this implementation of TestComponentBuilder
In TestComponentBuilder inside @angular/core@2.0.0-rc.4/testing/test_component_builder.js i can…

Bolza
- 1,904
- 2
- 17
- 42
1
vote
1 answer
Karma setup for Angular 2.
I am trying to setup Karma with Jasmine for testing my Angular2 app. Karma fails to append extensions for imports in spec files. For example my spec file has import {TileComponent} from './tiles.component';
When I run Karma I get the following…

Yhlas
- 411
- 3
- 5
- 17
1
vote
2 answers
Unable to `subscribe` to `Observable` for http-get request in spec file
I want to test following service which return an observable :
public getData(str:string) {
// return an observable
return this.http.get(‘calltoserviceapi’+str)
.map( (responseData) => {
return responseData.json().Abc;
…

candidJ
- 4,289
- 1
- 22
- 32