Skip to content

Commit

Permalink
fix: issue with tab-item for stencil
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerget committed Nov 22, 2024
1 parent c51e0ef commit 0bbc625
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
13 changes: 11 additions & 2 deletions packages/components/src/components/tab-item/tab-item.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
useTarget
} from '@builder.io/mitosis';
import type { DBTabItemProps, DBTabItemState } from './model';
import { cls } from '../../utils';
import { cls, getBooleanAsString } from '../../utils';
import { ChangeEvent } from '../../shared/model';
import { handleFrameworkEvent } from '../../utils/form-components';

Expand All @@ -30,7 +30,16 @@ export default function DBTabItem(props: DBTabItemProps) {
}

// We have different ts types in different frameworks, so we need to use any here
state._selected = (event.target as any)?.['checked'];

useTarget({
stencil: () => {
const selected = (event.target as any)?.['checked'];
state._selected = getBooleanAsString(selected);
},
default: () => {
state._selected = (event.target as any)?.['checked'];
}
});

useTarget({
angular: () => handleFrameworkEvent(this, event, 'checked'),
Expand Down
2 changes: 2 additions & 0 deletions showcases/e2e/default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ export const runAriaSnapshotTest = ({
await preScreenShot(page);
}

await page.waitForTimeout(1000); // We wait a little bit until everything loaded

const snapshot = await page.locator('main').ariaSnapshot();
expect(snapshot).toMatchSnapshot(`${title}.yaml`);

Check failure on line 229 in showcases/e2e/default.ts

View workflow job for this annotation

GitHub Actions / test-showcase-vue / 🧪🎭 - vue-showcase:4/6

[webkit] › default.ts:219:2 › DBTabs › should have same aria-snapshot

2) [webkit] › default.ts:219:2 › DBTabs › should have same aria-snapshot ───────────────────────── Error: expect(string).toMatchSnapshot(expected) - main: - heading "DBTabs" [level=1] - link "Density arrow_up_right\" / \"" - text: "Functional:" - tablist: - tab "Test 1" [selected]: on - text: Test 1 - tab "Test 2": on - text: Test 2 - tab "Test 3": on - text: Test 3 - tabpanel "Test 1": Tab Panel 1 - text: "(Default) Regular:" - tablist: - tab "Test 1" [selected]: on - text: Test 1 - tab "Test 2": on - text: Test 2 - tab "Test 3": on - text: Test 3 - tabpanel "Test 1": Tab Panel 1 - text: "Expressive:" - tablist: - tab "Test 1" [selected]: on - text: Test 1 - tab "Test 2": on - text: Test 2 - tab "Test 3": on - text: Test 3 - tabpanel "Test 1": Tab Panel 1 - link "Orientation arrow_up_right\" / \"" - text: "horizontal:" - tablist: - tab "Test 1" [selected]: on - text: Test 1 - tab "Test 2": on - text: Test 2 - tab "Test 3": on - text: Test 3 - tabpanel "Test 1": Tab Panel 1 - text: "vertical:" - tablist: - tab "Test 1" [selected]: on - text: Test 1 - tab "Test 2": on - text: Test 2 - tab "Test 3": on - text: Test 3 - tabpanel "Test 1": Tab Panel 1 - link "Width arrow_up_right\" / \"" - text: "auto:" - tablist: - tab "Test 1" [selected]: on - text: Test 1 - tab "Test 2": on - text: Test 2 - tab "Test 3": on - text: Test 3 - tabpanel "Test 1": Tab Panel 1 - text: "full - alignment: start:" - tablist: - tab "Test 1" [selected]: on - text: Test 1 - tab "Test 2": on - text: Test 2 - tab "Test 3": on - text: Test 3 - tabpanel "Test 1": Tab Panel 1 - text: "full - alignment: center:" - tablist: - tab "Test 1" [selected]: on - text: Test 1 - tab "Test 2": on - text: Test 2 - tab "Test 3": on - text: Test 3 - tabpanel "Test 1": Tab Panel 1 - link "Overflow arrow_up_right\" / \"" - text: "no overflow:" - tablist: - tab "Test 1" [selected]: on - text: Test 1 - tab "Test 2": on - text: Test 2 - tab "Test 3": on - text: Test 3 - tabpanel "Test 1": Tab Panel 1 - text: "with overflow - behaviour: arrows:" - button "chevron_right\" / \" Scroll right" - tablist: - tab "Test 1" [selected]: on - text: Test 1 - tab "Test 2": on - text: Test 2 - tab "Test 3": on - text: Test 3 - tab "Test 4": on - text: Test 4 - tab "Test 5": on - text: Test 5 - tabpanel "Test 1": Tab Panel 1 - text: "with overflow - behaviour: scrollbar:" - tablist: - tab "Test 1" [selected]: on - text: Test 1 - tab "Test 2": on - text: Test 2 - tab "Test 3": on - text: Test 3 - tab "Test 4": on - text: Test 4 - tab "Test 5": on - text: Test 5 - tabpanel "Test 1": Tab Panel 1 - link "Examples arrow_up_right\" / \"" - text: "2 tab selected:" - tablist: - tab "Test 1": on - text: Test 1 - tab "Test 2" [selected]: on - text: Test 2 - tab "Test 3": on - text: Test 3 - tabpanel "Test 2": Tab Panel 2 - text: "nothing selected:" - tablist: - tab "Test 1": on - text: Test 1 - tab "Test 2": on
});
Expand Down

0 comments on commit 0bbc625

Please sign in to comment.