Angular2 test - not detecting changes

By : Cuel

I'm trying to check a dropdown is shown when a boolean is switched. The boolean is an input on the component

    selector: 'dropdown',
    directives: [NgClass],
    template: `
        <div [ngClass]="{open: open}">

export class DropdownComponent {
    @Input('open') open: boolean = false;

And the test

it('should open', injectAsync([TestComponentBuilder], (tcb: TestComponentBuilder) => {
    return tcb.createAsync(DropdownComponent)
    .then(fixture => {
        let el = fixture.nativeElement;
        let comp: DropdownComponent = fixture.componentInstance;

        expect(el.className).toEqual(''); = true;

I am guessing something different has to be done when the boolean is an @Input?

By : Cuel

This video can help you solving your question :)
By: admin