|
1 | 1 | import {
|
2 |
| - async, |
3 |
| - addProviders, |
4 |
| - inject |
| 2 | + ComponentFixture, TestBed |
5 | 3 | } from '@angular/core/testing';
|
6 |
| -import { ComponentFixture, TestComponentBuilder } from '@angular/compiler/testing'; |
7 |
| -import { provide, Component } from '@angular/core'; |
| 4 | +import { Component, DebugElement } from '@angular/core'; |
8 | 5 | import { ImgFallbackDirective } from './ngx-img-fallback.directive';
|
| 6 | +import { By } from '@angular/platform-browser'; |
9 | 7 |
|
10 | 8 | @Component({
|
11 | 9 | selector: 'test-component',
|
12 |
| - template: `<div src-fallback></div>` |
| 10 | + template: `<img src-fallback>` |
13 | 11 | })
|
| 12 | + |
14 | 13 | class TestComponent {}
|
15 | 14 |
|
16 | 15 | describe('Ng2ImgFallback Directive', () => {
|
17 |
| - beforeEach(() => addProviders([])); |
| 16 | + let component: TestComponent; |
| 17 | + let fixture: ComponentFixture<TestComponent>; |
| 18 | + let imgElement: DebugElement; |
| 19 | + |
| 20 | + TestBed.configureTestingModule({ |
| 21 | + declarations: [ |
| 22 | + TestComponent, |
| 23 | + ImgFallbackDirective |
| 24 | + ] |
| 25 | + }); |
| 26 | + |
| 27 | + fixture = TestBed.createComponent(TestComponent); |
| 28 | + component = fixture.componentInstance; |
| 29 | + imgElement = fixture.debugElement.query(By.css('img')); |
18 | 30 |
|
19 |
| - it('should ...', async(inject([TestComponentBuilder], (tcb:TestComponentBuilder) => { |
20 |
| - return tcb.createAsync(TestComponent).then((fixture: ComponentFixture<any>) => { |
21 |
| - fixture.detectChanges(); |
22 |
| - }); |
23 |
| - }))); |
| 31 | + it('should set placeholder', () => { |
| 32 | + // imgElement. |
| 33 | + expect(true).toBeTruthy(); |
| 34 | + }); |
24 | 35 | });
|
0 commit comments