Skip to content

Commit

Permalink
fix ts issues
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Jan 22, 2024
1 parent 4a6df46 commit dbbf2dc
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
21 changes: 15 additions & 6 deletions code/renderers/vue3/src/__tests__/Button.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
<template>
<button type="button" :class="classes" @click="onClick" :style="style">{{ label }}</button>
<button
type="button"
:class="classes"
:style="style"
@change="emit('myChangeEvent', 0)"
@click="emit('myClickEvent', 0)"
>
{{ label }}
</button>
</template>

<script lang="ts" setup>
Expand All @@ -12,6 +20,10 @@ const props = withDefaults(
* The label of the button
*/
label: string;
/**
* Whether the button is disabled
*/
disabled: boolean;
/**
* primary or secondary button
*/
Expand All @@ -29,7 +41,8 @@ const props = withDefaults(
);
const emit = defineEmits<{
(e: 'click', id: number): void;
(e: 'myChangeEvent', id: number): void;
(e: 'myClickEvent', id: number): void;
}>();
const classes = computed(() => ({
Expand All @@ -42,8 +55,4 @@ const classes = computed(() => ({
const style = computed(() => ({
backgroundColor: props.backgroundColor,
}));
const onClick = () => {
emit('click', 1);
};
</script>
1 change: 1 addition & 0 deletions code/renderers/vue3/src/__tests__/composeStories.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/// <reference types="@testing-library/jest-dom" />;
import { it, expect, vi, describe } from 'vitest';
import { render, screen } from '@testing-library/vue';
import { expectTypeOf } from 'expect-type';
Expand Down
2 changes: 1 addition & 1 deletion code/vitest-setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import '@testing-library/jest-dom/vitest';
import { vi } from 'vitest';
import { vi, expect } from 'vitest';

import { dedent } from 'ts-dedent';

Expand Down

0 comments on commit dbbf2dc

Please sign in to comment.