Host binding does not update after detectChanges

Viewed 902

I have the following test

it('test', function(){
  @Component({
     host: {
        '[style.display]': 'service.obj.value ? "inline-block" : "none"'
     }
  })
  class Component{
     ...
  }

  TestBed.configureTestingModule({
    declarations: [
      Component
    ],
    providers: [
      {
        provide: InjectedService,
        useValue: {
          obj: this.obj
        }
      }
    ]
  });

  this.fixture.detectChanges();
  expect(this.de.styles.display).toBe('none');

  this.obj.value = 'value';
  this.fixture.detectChanges();
  expect(this.de.styles.display).toBe('inline-block');
})

Second expectation failed, because style does not rerender.

Why? Initial value rendered correct for both cases

0 Answers
Related