#49 fix: marcador de producto sin imagen visible en el mapa de provenance
This commit is contained in:
@@ -30,10 +30,14 @@ const provenance = [
|
||||
function mountSection (props = {}) {
|
||||
return mount(ProvenanceSection, {
|
||||
props: { provenance, ...props },
|
||||
global: { plugins: [vuetify] },
|
||||
global: { plugins: [vuetify], stubs: { ProvenanceMap: true } },
|
||||
})
|
||||
}
|
||||
|
||||
function mapWrapper (wrapper) {
|
||||
return wrapper.findComponent({ name: 'ProvenanceMap' })
|
||||
}
|
||||
|
||||
describe('ProvenanceSection', () => {
|
||||
it('no renderiza nada cuando no hay provenance', () => {
|
||||
const wrapper = mountSection({ provenance: null })
|
||||
@@ -84,4 +88,40 @@ describe('ProvenanceSection', () => {
|
||||
|
||||
expect(wrapper.findComponent(ProvenanceGraph).props('provenance')).toStrictEqual(provenance)
|
||||
})
|
||||
|
||||
it('oculta el mapa por defecto', () => {
|
||||
const wrapper = mountSection()
|
||||
|
||||
expect(mapWrapper(wrapper).exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('muestra el mapa al hacer clic en su título y lo oculta al volver a hacer clic', async () => {
|
||||
const wrapper = mountSection()
|
||||
|
||||
await wrapper.find('[data-test="map-toggle"]').trigger('click')
|
||||
expect(mapWrapper(wrapper).exists()).toBe(true)
|
||||
|
||||
await wrapper.find('[data-test="map-toggle"]').trigger('click')
|
||||
expect(mapWrapper(wrapper).exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('también despliega y repliega el mapa con el botón de chevron', async () => {
|
||||
const wrapper = mountSection()
|
||||
|
||||
const button = wrapper.find('[data-test="map-toggle-button"]')
|
||||
expect(button.exists()).toBe(true)
|
||||
await button.trigger('click')
|
||||
expect(mapWrapper(wrapper).exists()).toBe(true)
|
||||
|
||||
await button.trigger('click')
|
||||
expect(mapWrapper(wrapper).exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('pasa el provenance al mapa al desplegarlo', async () => {
|
||||
const wrapper = mountSection()
|
||||
|
||||
await wrapper.find('[data-test="map-toggle"]').trigger('click')
|
||||
|
||||
expect(mapWrapper(wrapper).props('provenance')).toStrictEqual(provenance)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user