#49 feat: desplegable en seccion de provenance con leyenda de colores y titulo sin historia
This commit is contained in:
@@ -8,7 +8,7 @@ vi.mock('@/components/graph/VisChart.vue', () => ({
|
||||
default: {
|
||||
name: 'VisChart',
|
||||
template: '<div class="vis-chart-stub" />',
|
||||
props: ['nodes', 'edges', 'height', 'options'],
|
||||
props: ['nodes', 'edges', 'height', 'options', 'minVerticalSpacing'],
|
||||
},
|
||||
}))
|
||||
|
||||
@@ -47,16 +47,41 @@ describe('ProvenanceSection', () => {
|
||||
expect(wrapper.findComponent(ProvenanceGraph).exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('muestra el gráfico unificado con su título cuando hay provenance', () => {
|
||||
it('muestra el título y oculta el gráfico por defecto', () => {
|
||||
const wrapper = mountSection()
|
||||
|
||||
expect(wrapper.findComponent(ProvenanceGraph).exists()).toBe(true)
|
||||
expect(wrapper.text()).toContain('Origen e historia de los productos')
|
||||
expect(wrapper.text()).toContain('Origen de los productos')
|
||||
expect(wrapper.text()).not.toContain('historia')
|
||||
expect(wrapper.findComponent(ProvenanceGraph).exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('pasa el provenance al gráfico', () => {
|
||||
it('muestra el gráfico al hacer clic en el título y lo oculta al volver a hacer clic', async () => {
|
||||
const wrapper = mountSection()
|
||||
|
||||
await wrapper.find('[data-test="provenance-toggle"]').trigger('click')
|
||||
expect(wrapper.findComponent(ProvenanceGraph).exists()).toBe(true)
|
||||
|
||||
await wrapper.find('[data-test="provenance-toggle"]').trigger('click')
|
||||
expect(wrapper.findComponent(ProvenanceGraph).exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('también despliega y repliega con el botón de chevron', async () => {
|
||||
const wrapper = mountSection()
|
||||
|
||||
const button = wrapper.find('[data-test="provenance-toggle-button"]')
|
||||
expect(button.exists()).toBe(true)
|
||||
await button.trigger('click')
|
||||
expect(wrapper.findComponent(ProvenanceGraph).exists()).toBe(true)
|
||||
|
||||
await button.trigger('click')
|
||||
expect(wrapper.findComponent(ProvenanceGraph).exists()).toBe(false)
|
||||
})
|
||||
|
||||
it('pasa el provenance al gráfico al desplegarlo', async () => {
|
||||
const wrapper = mountSection()
|
||||
|
||||
await wrapper.find('[data-test="provenance-toggle"]').trigger('click')
|
||||
|
||||
expect(wrapper.findComponent(ProvenanceGraph).props('provenance')).toStrictEqual(provenance)
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user