a6b48b1dd1
Auto Tag Develop / tag (push) Successful in 11s
## ERP-196 — Refonte des blocs de formulaire Refonte visuelle des blocs répétables des formulaires (clients, fournisseurs, prestataires, transporteurs), alignée sur les blocs « ticket de pesée » : à plat (sans box-shadow), titre de bloc en noir, séparation par filet noir 1px. ### ✅ Blocs Contact - Box-shadow / fond blanc / padding latéral retirés - En-tête `flex justify-between` : titre noir (« Contact 1 »…) à gauche, poubelle `button-class="p-0"` à droite - 4 colonnes, filet `border-b border-black` entre blocs (pas sous le dernier, prop `last`) - i18n `contact.title` ajouté pour transporteurs / prestataires - 9 pages câblées (new / edit / consultation des 4 répertoires) ### ✅ Blocs Adresse - Même traitement (à plat, titre noir, filet sauf dernier) - i18n `address.title` pour transporteurs / prestataires - Transporteur : adresse unique → titre « Adresse » (sans numéro) - 12 pages câblées ### ✅ Bloc Comptabilité - Bloc **infos** : titre « Informations » + filet bas (uniquement si des RIB suivent) - Blocs **RIB** : titre « RIB 1 / RIB 2… » + poubelle `p-0`, filet sauf le dernier - i18n `accounting.infoTitle` (3 modules) + `accounting.ribTitle` (fournisseurs / prestataires) - 9 pages câblées (clients / fournisseurs / prestataires) ### Vérifications - Vitest : 44/44 (specs contact + adresse) - Eslint : clean sur l'ensemble des composants et pages modifiés ### Commits - `feat : refonte des blocs contact (ERP-196)` - `feat : refonte des blocs adresse (ERP-196)` - `feat : refonte du bloc comptabilité (ERP-196)` Reviewed-on: #145 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
57 lines
2.1 KiB
TypeScript
57 lines
2.1 KiB
TypeScript
import { describe, it, expect, vi } from 'vitest'
|
|
import { mount } from '@vue/test-utils'
|
|
import { defineComponent, h, ref, computed } from 'vue'
|
|
import { emptyProviderContact } from '~/modules/technique/types/providerForm'
|
|
import ProviderContactBlock from '../ProviderContactBlock.vue'
|
|
|
|
// Auto-imports Nuxt/Vue utilises sans import explicite par le composant.
|
|
vi.stubGlobal('useI18n', () => ({ t: (key: string) => key }))
|
|
vi.stubGlobal('ref', ref)
|
|
vi.stubGlobal('computed', computed)
|
|
|
|
/** Stub d'un champ Malio qui re-expose la prop `error` recue dans un data-* attribut. */
|
|
function errorProbe(testid: string) {
|
|
return defineComponent({
|
|
name: `Probe-${testid}`,
|
|
props: {
|
|
modelValue: { type: [String, Number, null], default: undefined },
|
|
error: { type: String, default: '' },
|
|
label: { type: String, default: '' },
|
|
readonly: { type: Boolean, default: false },
|
|
},
|
|
setup(props) {
|
|
return () => h('div', { 'data-testid': testid, 'data-error': props.error })
|
|
},
|
|
})
|
|
}
|
|
|
|
function mountBlock(errors?: Record<string, string>) {
|
|
return mount(ProviderContactBlock, {
|
|
props: {
|
|
modelValue: emptyProviderContact(),
|
|
title: 'Contact 1',
|
|
...(errors ? { errors } : {}),
|
|
},
|
|
global: {
|
|
stubs: {
|
|
MalioButtonIcon: true,
|
|
MalioInputPhone: true,
|
|
MalioInputText: errorProbe('contact-text'),
|
|
MalioInputEmail: errorProbe('contact-email'),
|
|
},
|
|
},
|
|
})
|
|
}
|
|
|
|
describe('ProviderContactBlock — mapping erreur par champ (ERP-101)', () => {
|
|
it('affiche l\'erreur serveur sur le champ email via la prop errors', () => {
|
|
const wrapper = mountBlock({ email: 'L\'adresse email n\'est pas valide.' })
|
|
expect(wrapper.find('[data-testid="contact-email"]').attributes('data-error')).toBe('L\'adresse email n\'est pas valide.')
|
|
})
|
|
|
|
it('laisse les champs sans erreur quand errors est absent', () => {
|
|
const wrapper = mountBlock()
|
|
expect(wrapper.find('[data-testid="contact-email"]').attributes('data-error')).toBe('')
|
|
})
|
|
})
|