correct and complete unit tests in Front-End

This commit is contained in:
Laurent GAY
2025-06-11 18:49:45 +02:00
parent 2fa54e8282
commit 533ecbdbba
67 changed files with 1900 additions and 203 deletions

View File

@@ -96,7 +96,8 @@ describe("ReportModal", () => {
);
const switchButton = wrapper.find('input[type="checkbox"]');
switchButton.setValue(true);
switchButton.setValue();
await wrapper.vm.$nextTick();
const submit = wrapper.find("footer button.o-btn--primary");
submit.trigger("click");

View File

@@ -1,29 +1,33 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`ReportModal > renders report modal with basic informations and submits it 1`] = `
"<div data-v-e0cceef3=\\"\\" class=\\"p-2\\">
"<div data-v-e0cceef3="" class="p-2">
<!--v-if-->
<section data-v-e0cceef3=\\"\\">
<div data-v-e0cceef3=\\"\\" class=\\"flex gap-1 flex-row mb-3 bg-mbz-yellow p-3 rounded items-center\\"><span data-v-e0cceef3=\\"\\" class=\\"o-icon o-icon--warning hidden md:block flex-1\\"><i class=\\"mdi mdi-alert 48\\"></i></span>
<p data-v-e0cceef3=\\"\\">The report will be sent to the moderators of your instance. You can explain why you report this content below.</p>
<section data-v-e0cceef3="">
<div data-v-e0cceef3="" class="flex gap-1 flex-row mb-3 bg-mbz-yellow dark:text-black p-3 rounded items-center"><span data-v-e0cceef3="" class="o-icon o-icon--warning hidden md:block flex-1" data-oruga="icon"><i class="mdi mdi-alert 48"></i></span>
<p data-v-e0cceef3="">The report will be sent to the moderators of your instance. You can explain why you report this content below.</p>
</div>
<div data-v-e0cceef3=\\"\\">
<div data-v-e0cceef3="">
<!--v-if-->
<div data-v-e0cceef3=\\"\\" class=\\"o-field o-field--filled\\"><label for=\\"additional-comments\\" class=\\"o-field__label\\">Additional comments</label>
<div data-v-e0cceef3=\\"\\" class=\\"o-ctrl-input\\"><textarea id=\\"additional-comments\\" autofocus=\\"\\" class=\\"o-input o-input__textarea\\"></textarea>
<!--v-if-->
<!--v-if-->
<!--v-if-->
<div data-v-e0cceef3="" data-oruga="field" class="o-field o-field--filled"><label for="additional-comments" class="o-field__label">Additional comments</label>
<div class="o-field__body">
<div class="o-field o-field--addons">
<div data-v-e0cceef3="" data-oruga="input" class="o-input__wrapper o-input__wrapper--expanded"><textarea autofocus="" id="additional-comments" data-oruga-input="textarea" class="o-input o-input__textarea"></textarea>
<!---->
<!---->
<!---->
</div>
</div>
</div>
<!--v-if-->
<!---->
</div>
<!--v-if-->
</div>
</section>
<footer data-v-e0cceef3=\\"\\" class=\\"flex gap-2 py-3\\"><button data-v-e0cceef3=\\"\\" type=\\"button\\" class=\\"o-btn o-btn--outlined\\"><span class=\\"o-btn__wrapper\\"><!--v-if--><span class=\\"o-btn__label\\">Cancel</span>
<!--v-if--></span>
</button><button data-v-e0cceef3=\\"\\" type=\\"button\\" class=\\"o-btn o-btn--primary\\"><span class=\\"o-btn__wrapper\\"><!--v-if--><span class=\\"o-btn__label\\">Send the report</span>
<!--v-if--></span>
<footer data-v-e0cceef3="" class="flex gap-2 py-3"><button data-v-e0cceef3="" type="button" class="o-btn o-btn--outlined" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Cancel</span>
<!----></span>
</button><button data-v-e0cceef3="" type="button" class="o-btn o-btn--primary" role="button" data-oruga="button"><span class="o-btn__wrapper"><!----><span class="o-btn__label">Send the report</span>
<!----></span>
</button></footer>
</div>"
`;