|
1 | 1 | import { $, component$, useSignal, useStore } from '@builder.io/qwik';
|
2 |
| -import { Tab } from './tab'; |
3 |
| -import { TabPanel } from './tab-panel'; |
4 | 2 | import { Tabs } from './tabs';
|
5 | 3 | import { TabList } from './tabs-list';
|
| 4 | +import { Tab } from './tab'; |
| 5 | +import { TabPanel } from './tab-panel'; |
6 | 6 |
|
7 | 7 | describe('Tabs', () => {
|
8 | 8 | it('INIT', () => {
|
@@ -768,4 +768,75 @@ describe('Tabs', () => {
|
768 | 768 | cy.findByRole('tablist').should('exist');
|
769 | 769 | });
|
770 | 770 | });
|
| 771 | + |
| 772 | + // TODO: add test for Custom tabs |
| 773 | + |
| 774 | + // Couldn't write the test because of the following error: |
| 775 | + /** |
| 776 | + * The following error originated from your test code, not from Cypress. |
| 777 | + > Captured variable in the closure can not be serialized because it's a function named "CustomTabs". You might need to convert it to a QRL using $(fn): |
| 778 | + */ |
| 779 | + |
| 780 | + // const CustomTabs = (props: TabsProps) => ( |
| 781 | + // <Tabs {...props} TabList={CustomTabList} Tab={CustomTab} TabPanel={CustomTabPanel} /> |
| 782 | + // ); |
| 783 | + |
| 784 | + // const CustomTabList = component$<TabListProps>(() => { |
| 785 | + // return ( |
| 786 | + // <TabList> |
| 787 | + // <Slot /> |
| 788 | + // </TabList> |
| 789 | + // ); |
| 790 | + // }); |
| 791 | + |
| 792 | + // const CustomTab = component$<TabProps>(({ ...props }) => { |
| 793 | + // return ( |
| 794 | + // <Tab {...props}> |
| 795 | + // <Slot /> |
| 796 | + // </Tab> |
| 797 | + // ); |
| 798 | + // }); |
| 799 | + |
| 800 | + // const CustomTabPanel = component$<TabPanelProps>(({ ...props }) => { |
| 801 | + // return ( |
| 802 | + // <TabPanel {...props}> |
| 803 | + // <Slot /> |
| 804 | + // </TabPanel> |
| 805 | + // ); |
| 806 | + // }); |
| 807 | + |
| 808 | + // const CustomThreeTabsComponent = component$(() => { |
| 809 | + // return ( |
| 810 | + // <> |
| 811 | + // <CustomTabs> |
| 812 | + // <CustomTabList> |
| 813 | + // <CustomTab>Tab 1</CustomTab> |
| 814 | + // <CustomTab>Tab 2</CustomTab> |
| 815 | + // <CustomTab>Tab 3</CustomTab> |
| 816 | + // </CustomTabList> |
| 817 | + // <CustomTabPanel>Panel 1</CustomTabPanel> |
| 818 | + // <CustomTabPanel>Panel 2</CustomTabPanel> |
| 819 | + // <CustomTabPanel>Panel 3</CustomTabPanel> |
| 820 | + // </CustomTabs> |
| 821 | + // </> |
| 822 | + // ); |
| 823 | + // }); |
| 824 | + |
| 825 | + // describe('User-defined TabList', () => { |
| 826 | + // it(`GIVEN a user-defined TabList to Tabs |
| 827 | + // WHEN clicking the middle Tab |
| 828 | + // THEN render the middle panel`, () => { |
| 829 | + // cy.mount(<CustomThreeTabsComponent />); |
| 830 | + |
| 831 | + // cy.get('[role="tab"]').should('have.length', 3); |
| 832 | + |
| 833 | + // cy.findByRole('tabpanel').should('contain', 'Panel 3'); |
| 834 | + |
| 835 | + // cy.findByRole('tab', { name: /Tab 2/i }).click(); |
| 836 | + |
| 837 | + // cy.findByRole('tabpanel').should('contain', 'Panel 2'); |
| 838 | + |
| 839 | + // cy.findByRole('tablist').should('exist'); |
| 840 | + // }); |
| 841 | + // }); |
771 | 842 | });
|
0 commit comments