Skip to content

Commit 6a3756a

Browse files
guerganachukarave
authored andcommitted
Rewrite MismatchesTable with Vue3 syntax (#828)
* Rewrite MismatchesTable with Vue3 syntax Bug: T354375
1 parent 3e84121 commit 6a3756a

File tree

2 files changed

+16
-24
lines changed

2 files changed

+16
-24
lines changed

resources/js/Components/MismatchesTable.vue

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,18 @@
2222
</wikit-table>
2323
</template>
2424

25-
<script lang="ts">
26-
import type { PropType } from 'vue';
27-
import { defineComponent } from 'vue';
25+
<script setup lang="ts">
2826
import { Table as WikitTable } from '@wmde/wikit-vue-components';
2927
3028
import MismatchRow from './MismatchRow.vue';
3129
32-
import { LabelledMismatch } from '../types/Mismatch';
30+
import type { LabelledMismatch } from '../types/Mismatch';
3331
34-
export default defineComponent({
35-
components: {
36-
MismatchRow,
37-
WikitTable,
38-
},
39-
props: {
40-
mismatches: Array as PropType<LabelledMismatch[]>,
41-
disabled: {
42-
type: Boolean,
43-
default: false
44-
}
45-
}
32+
withDefaults(defineProps<{
33+
mismatches: LabelledMismatch[],
34+
disabled: boolean
35+
}>(), {
36+
disabled: false
4637
});
4738
</script>
4839

tests/Vue/Components/MismatchesTable.spec.js

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
import { mount } from '@vue/test-utils';
22
import MismatchesTable from '@/Components/MismatchesTable.vue';
33
import MismatchRow from '@/Components/MismatchRow.vue';
4+
import { createI18n } from 'vue-banana-i18n';
5+
6+
const i18n = createI18n({
7+
messages: {},
8+
locale: 'en',
9+
wikilinks: true
10+
});
411

512
describe('MismatchesTable.vue', () => {
613
it('accepts a mismatches property', () => {
@@ -22,10 +29,7 @@ describe('MismatchesTable.vue', () => {
2229
const wrapper = mount(MismatchesTable, {
2330
props: { mismatches },
2431
global: {
25-
mocks: {
26-
// Mock the banana-i18n plugin dependency
27-
$i18n: key => key
28-
}
32+
plugins: [i18n]
2933
}
3034
});
3135

@@ -59,10 +63,7 @@ describe('MismatchesTable.vue', () => {
5963
const wrapper = mount(MismatchesTable, {
6064
props: { disabled, mismatches },
6165
global: {
62-
mocks: {
63-
// Mock the banana-i18n plugin dependency
64-
$i18n: key => key
65-
}
66+
plugins: [i18n]
6667
}
6768
});
6869

0 commit comments

Comments
 (0)