Skip to content

Commit

Permalink
Rewrite MismatchesTable with Vue3 syntax (#828)
Browse files Browse the repository at this point in the history
* Rewrite MismatchesTable with Vue3 syntax

Bug: T354375
  • Loading branch information
guergana committed Jan 9, 2024
1 parent f7cfcc0 commit 2be5ad5
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 24 deletions.
23 changes: 7 additions & 16 deletions resources/js/Components/MismatchesTable.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,27 +22,18 @@
</wikit-table>
</template>

<script lang="ts">
import type { PropType } from 'vue';
import { defineComponent } from 'vue';
<script setup lang="ts">
import { Table as WikitTable } from '@wmde/wikit-vue-components';
import MismatchRow from './MismatchRow.vue';
import { LabelledMismatch } from '../types/Mismatch';
import type { LabelledMismatch } from '../types/Mismatch';
export default defineComponent({
components: {
MismatchRow,
WikitTable,
},
props: {
mismatches: Array as PropType<LabelledMismatch[]>,
disabled: {
type: Boolean,
default: false
}
}
withDefaults(defineProps<{
mismatches: LabelledMismatch[],
disabled: boolean
}>(), {
disabled: false
});
</script>

Expand Down
17 changes: 9 additions & 8 deletions tests/Vue/Components/MismatchesTable.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { mount } from '@vue/test-utils';
import MismatchesTable from '@/Components/MismatchesTable.vue';
import MismatchRow from '@/Components/MismatchRow.vue';
import { createI18n } from 'vue-banana-i18n';

const i18n = createI18n({
messages: {},
locale: 'en',
wikilinks: true
});

describe('MismatchesTable.vue', () => {
it('accepts a mismatches property', () => {
Expand All @@ -22,10 +29,7 @@ describe('MismatchesTable.vue', () => {
const wrapper = mount(MismatchesTable, {
props: { mismatches },
global: {
mocks: {
// Mock the banana-i18n plugin dependency
$i18n: key => key
}
plugins: [i18n]
}
});

Expand Down Expand Up @@ -59,10 +63,7 @@ describe('MismatchesTable.vue', () => {
const wrapper = mount(MismatchesTable, {
props: { disabled, mismatches },
global: {
mocks: {
// Mock the banana-i18n plugin dependency
$i18n: key => key
}
plugins: [i18n]
}
});

Expand Down

0 comments on commit 2be5ad5

Please sign in to comment.