Browse Source

test card-header component

pull/16122/head
Barış Can Yılmaz 3 years ago
parent
commit
fa184b2162
  1. 37
      npm/ng-packs/packages/theme-shared/src/lib/tests/card-header.component.spec.ts

37
npm/ng-packs/packages/theme-shared/src/lib/tests/card-header.component.spec.ts

@ -0,0 +1,37 @@
import { createHostFactory, SpectatorHost } from '@ngneat/spectator';
import { CardHeaderComponent } from '../components';
describe('AbpCardHeaderComponent', () => {
let spectator: SpectatorHost<CardHeaderComponent>;
const createHost = createHostFactory(CardHeaderComponent);
beforeEach(
() =>
(spectator = createHost(
` <abp-card-header
[cardHeaderStyle]="{'background-color':'red'}"
>
Header
</abp-card-header>`,
{
hostProps: { attributes: { autofocus: '', name: 'abp-card-header' } },
},
)),
);
it('should create an instance', () => {
expect(spectator).toBeTruthy();
});
it('should have class card-header', () => {
expect(spectator.element.classList).toContain('card-header');
});
it('should have background-color red', () => {
expect((spectator.query('div') as HTMLElement).style.backgroundColor).toEqual('red');
});
it('should have Header text', () => {
expect(spectator.element.textContent).toContain('Header');
});
});
Loading…
Cancel
Save