我一直在尝试运行单元测试来检查我的Angular 4应用程序中的一些CSS属性,但它们的值始终为空 . 这是我的测试:

it('should have a background a color', () => {
  const toolbar = debug.query(By.css('.toolbar'));
  const toolbarEl = toolbar.nativeElement;
  expect(toolbarEl.style.background).toBeTruthy();
});

Failure: Expected '' to be truthy.

console.log: 空字符串 .

在我的组件的CSS(toolbar.component.scss)中,我有以下类:

.toolbar {
  width: 100%;
  background: blue;
}

我在这里做错了什么想法?