Skip to content

Commit dbbf2dc

Browse files
committed
fix ts issues
1 parent 4a6df46 commit dbbf2dc

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

code/renderers/vue3/src/__tests__/Button.vue

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
<template>
2-
<button type="button" :class="classes" @click="onClick" :style="style">{{ label }}</button>
2+
<button
3+
type="button"
4+
:class="classes"
5+
:style="style"
6+
@change="emit('myChangeEvent', 0)"
7+
@click="emit('myClickEvent', 0)"
8+
>
9+
{{ label }}
10+
</button>
311
</template>
412

513
<script lang="ts" setup>
@@ -12,6 +20,10 @@ const props = withDefaults(
1220
* The label of the button
1321
*/
1422
label: string;
23+
/**
24+
* Whether the button is disabled
25+
*/
26+
disabled: boolean;
1527
/**
1628
* primary or secondary button
1729
*/
@@ -29,7 +41,8 @@ const props = withDefaults(
2941
);
3042
3143
const emit = defineEmits<{
32-
(e: 'click', id: number): void;
44+
(e: 'myChangeEvent', id: number): void;
45+
(e: 'myClickEvent', id: number): void;
3346
}>();
3447
3548
const classes = computed(() => ({
@@ -42,8 +55,4 @@ const classes = computed(() => ({
4255
const style = computed(() => ({
4356
backgroundColor: props.backgroundColor,
4457
}));
45-
46-
const onClick = () => {
47-
emit('click', 1);
48-
};
4958
</script>

code/renderers/vue3/src/__tests__/composeStories.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/// <reference types="@testing-library/jest-dom" />;
12
import { it, expect, vi, describe } from 'vitest';
23
import { render, screen } from '@testing-library/vue';
34
import { expectTypeOf } from 'expect-type';

code/vitest-setup.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import '@testing-library/jest-dom/vitest';
2-
import { vi } from 'vitest';
2+
import { vi, expect } from 'vitest';
33

44
import { dedent } from 'ts-dedent';
55

0 commit comments

Comments
 (0)