Skip to content

Commit

Permalink
added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tishoyanchev committed Sep 6, 2023
1 parent ad2466e commit 8bcd9a5
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 3 deletions.
68 changes: 68 additions & 0 deletions packages/components/src/components/breadcrumb/breadcrumb.e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
import { newE2EPage } from '@stencil/core/testing';

describe('ifx-breadcrumb', () => {
it('should render', async () => {
const page = await newE2EPage();
await page.setContent('<ifx-breadcrumb></ifx-breadcrumb>');

const element = await page.find('ifx-breadcrumb');
expect(element).toHaveClass('hydrated');
});

it('should display breadcrumb items', async () => {
const page = await newE2EPage();
await page.setContent(`
<ifx-breadcrumb>
<ifx-breadcrumb-item>
<ifx-breadcrumb-item-label icon="home" url="/">Home</ifx-breadcrumb-item-label>
</ifx-breadcrumb-item>
<ifx-breadcrumb-item>
<ifx-breadcrumb-item-label icon="chevron-right" url="/about">About</ifx-breadcrumb-item-label>
</ifx-breadcrumb-item>
</ifx-breadcrumb>
`);

const breadcrumb = await page.find('ifx-breadcrumb');
const breadcrumbItems = await breadcrumb.findAll('ifx-breadcrumb-item');

expect(breadcrumbItems.length).toBe(2);
});

it('should handle last item correctly', async () => {
const page = await newE2EPage();
await page.setContent(`
<ifx-breadcrumb>
<ifx-breadcrumb-item>
<ifx-breadcrumb-item-label icon="home" url="/">Home</ifx-breadcrumb-item-label>
</ifx-breadcrumb-item>
<ifx-breadcrumb-item>
<ifx-breadcrumb-item-label icon="chevron-right" url="/about">About</ifx-breadcrumb-item-label>
</ifx-breadcrumb-item>
</ifx-breadcrumb>
`);

const breadcrumbItems = await page.findAll('ifx-breadcrumb-item');

expect(breadcrumbItems[0]).not.toHaveAttribute('aria-current');

});

it('should toggle dropdown menu', async () => {
const page = await newE2EPage();
await page.setContent(`
<ifx-breadcrumb>
<ifx-breadcrumb-item>
<ifx-breadcrumb-item-label icon="home" url="/">Home</ifx-breadcrumb-item-label>
</ifx-breadcrumb-item>
<ifx-breadcrumb-item>
<ifx-breadcrumb-item-label icon="chevron-right" url="/about">About</ifx-breadcrumb-item-label>
</ifx-breadcrumb-item>
</ifx-breadcrumb>
`);

await page.waitForChanges();

});

// Add more test cases as needed
});
4 changes: 1 addition & 3 deletions packages/components/src/components/modal/modal.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ describe('ifx-modal', () => {

// Close the modal
await modal.callMethod('close');
let modalContainerClosed = await page.find('ifx-modal >>> .modal-container');
expect(modalContainerClosed).not.toHaveClass('open');


});

it('emits events on open, close, OK button click, and Cancel button click', async () => {
Expand Down

0 comments on commit 8bcd9a5

Please sign in to comment.