ui-jar icon indicating copy to clipboard operation
ui-jar copied to clipboard

Host component does not work

Open Ledzz opened this issue 7 years ago • 2 comments

Hello! I'm trying to make simple test with custom host component. I've made a few tries, but it doesn't work: No component factory found for undefined. Did you add it to @NgModule.entryComponents?

icon.component.spec.ts:

import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { Component } from '@angular/core';
import { IconComponent } from '@components/icon/icon.component';

@Component({
	selector: 'vs-icon-test-color-host',
	template: `<vs-icon icon='clock'></vs-icon>`,
	styles: [`
		:host {
			color: #00ffff;
		}
	`]
})
export class IconTestColorHostComponent {
}

describe('IconComponent', () => {
	let component: IconTestColorHostComponent;
	let fixture: ComponentFixture<IconTestColorHostComponent>;

	beforeEach(async(() => {
		/**
		 * @uijar IconComponent
		 * @hostcomponent IconTestColorHostComponent
		 */
		TestBed.configureTestingModule({
				declarations: [IconComponent, IconTestColorHostComponent]
			})
			.compileComponents()
			.then(() => {
				fixture = TestBed.createComponent(IconTestColorHostComponent);
				component = fixture.componentInstance;
				fixture.detectChanges();
			});
	}));

	/**
	 * @uijarexample Icon changes color
	 */
	it('should change icon color ', () => {
		expect(component).toBeTruthy();
	});
});

icon.component.ts:

import { Component, Input } from '@angular/core';

/**
 * @group UI
 * @component Icon
 */
@Component({
	selector: 'vs-icon',
	templateUrl: './icon.component.html',
	styleUrls: ['./icon.component.styl'],
	host: {
		'[class.vs-icon]': 'true'
	}
})
export class IconComponent {
	@Input() icon: string;
	@Input() size: string | number;
}

UI-jar version 1.1.8 Angular v. 7.0.0

Ledzz avatar Dec 05 '18 13:12 Ledzz

It's only in watch mode.

Ledzz avatar Dec 05 '18 14:12 Ledzz

Could you provide full repo?

nording avatar Dec 05 '18 16:12 nording