-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Dabiel González Ramos <[email protected]>
- Loading branch information
1 parent
597ebed
commit 7c9ac7b
Showing
20 changed files
with
882 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
85 changes: 85 additions & 0 deletions
85
packages/beeq/src/components/step-item/__tests__/bq-step-item.e2e.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
import { newE2EPage } from '@stencil/core/testing'; | ||
|
||
describe('bq-step-item', () => { | ||
it('should render', async () => { | ||
const page = await newE2EPage({ | ||
html: `<bq-step-item></bq-step-item>`, | ||
}); | ||
|
||
const element = await page.find('bq-step-item'); | ||
expect(element).toHaveClass('hydrated'); | ||
}); | ||
|
||
it('should have shadow root', async () => { | ||
const page = await newE2EPage({ | ||
html: `<bq-step-item></bq-step-item>`, | ||
}); | ||
|
||
const element = await page.find('bq-step-item'); | ||
expect(element.shadowRoot).not.toBeNull(); | ||
}); | ||
|
||
it('should display text title', async () => { | ||
const title = 'Title'; | ||
const description = 'Description for step item'; | ||
|
||
const page = await newE2EPage({ | ||
html: ` | ||
<bq-step-item type="numeric" status="default"> | ||
<span>${title}</span> | ||
<span slot="description">${description}</span> | ||
</bq-step-item> | ||
`, | ||
}); | ||
|
||
const text = await page.$eval('bq-step-item', (element) => { | ||
const slotElement = element.shadowRoot.querySelector('.bq-step-item__content--title').querySelector('slot'); | ||
const assignedElements = (slotElement as HTMLSlotElement).assignedElements({ flatten: true })[0]; | ||
|
||
return assignedElements.textContent; | ||
}); | ||
expect(text).toEqualText(title); | ||
}); | ||
|
||
it('should display description', async () => { | ||
const title = 'Title'; | ||
const description = 'Description for step item'; | ||
|
||
const page = await newE2EPage({ | ||
html: ` | ||
<bq-step-item type="numeric" status="default"> | ||
<span>${title}</span> | ||
<span slot="description">${description}</span> | ||
</bq-step-item> | ||
`, | ||
}); | ||
|
||
const text = await page.$eval('bq-step-item', (element) => { | ||
const slotElement = element.shadowRoot.querySelector('slot[name="description"]'); | ||
const assignedElements = (slotElement as HTMLSlotElement).assignedElements({ flatten: true })[0]; | ||
|
||
return assignedElements.textContent; | ||
}); | ||
expect(text).toEqualText(description); | ||
}); | ||
|
||
it('should display icon prefix', async () => { | ||
const page = await newE2EPage({ | ||
html: ` | ||
<bq-step-item status="default"> | ||
<bq-icon slot="prefix" name="circle"></bq-icon> | ||
<span>Title</span> | ||
<span slot="description">Description</span> | ||
</bq-step-item> | ||
`, | ||
}); | ||
|
||
const prefix = await page.$eval('bq-step-item', (element) => { | ||
const slotElement = element.shadowRoot.querySelector('slot[name="prefix"]'); | ||
const assignedElements = (slotElement as HTMLSlotElement).assignedElements({ flatten: true })[0]; | ||
|
||
return assignedElements.tagName; | ||
}); | ||
expect(prefix).toMatch(/bq-icon/i); | ||
}); | ||
}); |
Oops, something went wrong.