Skip to content

Commit

Permalink
test: add tests badge component
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielduete committed Aug 16, 2023
1 parent 1f70bfc commit c3c8856
Showing 1 changed file with 37 additions and 2 deletions.
39 changes: 37 additions & 2 deletions packages/core/src/components/badge/badge.spec.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
describe('AtomBadge', () => {
it('should render an ion-badge element', async () => {})
import { newSpecPage } from '@stencil/core/testing'

import { AtomBadge } from './badge'

describe('atom-badge', () => {
it('should render an ion-badge element correctly', async () => {
const page = await newSpecPage({
components: [AtomBadge],
html: `<atom-badge type='primary'>Badge</atom-badge>`,
})

await page.waitForChanges()

const badgeEl = page.root?.shadowRoot?.querySelector('ion-badge')

expect(badgeEl).toBeTruthy()
})

it('should render badge element correctly', async () => {
const page = await newSpecPage({
components: [AtomBadge],
html: `<atom-badge type='primary'>Badge</atom-badge>`,
})

await page.waitForChanges()

expect(page.root).toEqualHtml(`
<atom-badge type='primary'>
<mock:shadow-root>
<ion-badge color='primary' class="atom-badge">
<slot></slot>
</ion-badge>
</mock:shadow-root>
Badge
</atom-badge>
`)
})
})

0 comments on commit c3c8856

Please sign in to comment.