diff --git a/npm/ng-packs/packages/theme-shared/src/lib/tests/card-body.component.spec.ts b/npm/ng-packs/packages/theme-shared/src/lib/tests/card-body.component.spec.ts new file mode 100644 index 0000000000..83cc302625 --- /dev/null +++ b/npm/ng-packs/packages/theme-shared/src/lib/tests/card-body.component.spec.ts @@ -0,0 +1,46 @@ +import { createHostFactory, SpectatorHost } from '@ngneat/spectator'; +import { CardBodyComponent } from '../components'; + +describe('AbpCardBodyComponent', () => { + let spectator: SpectatorHost; + + const createHost = createHostFactory(CardBodyComponent); + + beforeEach( + () => + (spectator = createHost( + ` +

Body

+
`, + { + hostProps: { attributes: { autofocus: '', name: 'abp-card-body' } }, + }, + )), + ); + + it('should create an instance', () => { + expect(spectator).toBeTruthy(); + }); + + it('should have class card-body', () => { + expect(spectator.element.classList).toContain('card-body'); + }); + + it('should have div', () => { + expect(spectator.query('div')).toBeTruthy(); + }); + + it('should have background-color red', () => { + expect((spectator.query('div') as HTMLElement).style.backgroundColor).toEqual('red'); + }); + + it('should have p tag', () => { + expect(spectator.query('p')).toBeTruthy(); + }); + + it('should have p tag with Body text', () => { + expect(spectator.query('p').textContent).toContain('Body'); + }); +});