mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 08:18:42 +00:00
* feat: set up dashboard filters from a table and create the widgets they filter * feat: refine dashboard filter setup and widget association Support multi-table filters, guided widget configuration, same-table condition copying in display order, and automatic linking defaults. Preserve independent target settings and undo/redo behavior. * fix: show copied filter conditions after widget association * test: cover guided dashboard widget creation from a filter * test: cover dashboard filter copying across tables * refactor: simplify dashboard filter configuration * fix: restore dashboard filter links exactly on undo and redo * feat: set up a new widget and how a filter narrows it down in one modal * feat: fold the add-widget modal into collapsible sections that fit chart settings * fix: cancel queued updates when destroying dashboard charts * fix: reference dashboard option context by table * refactor: rename dashboard table context provider * fix: label dashboard table context as field options * fix: shorten dashboard table options label --------- Co-authored-by: Jeremie Pardou <571533+jrmi@users.noreply.github.com>
53 lines
1.4 KiB
JavaScript
53 lines
1.4 KiB
JavaScript
import { mount } from '@vue/test-utils'
|
|
|
|
import CreateWidgetCard from '@baserow/modules/dashboard/components/CreateWidgetCard'
|
|
|
|
const tooltip = { mounted: vi.fn() }
|
|
|
|
const widgetType = {
|
|
isAvailable: () => true,
|
|
getDeactivatedModal: () => null,
|
|
}
|
|
|
|
function mountCreateWidgetCard(disabled) {
|
|
return mount(CreateWidgetCard, {
|
|
global: { directives: { tooltip } },
|
|
props: {
|
|
dashboard: { workspace: { id: 1 } },
|
|
widgetType,
|
|
variation: {
|
|
name: 'Summary',
|
|
description: 'A single number',
|
|
createWidgetImage: '',
|
|
},
|
|
disabled,
|
|
},
|
|
})
|
|
}
|
|
|
|
describe('CreateWidgetCard', () => {
|
|
test('does not select a widget while creation is pending', async () => {
|
|
const wrapper = mountCreateWidgetCard(true)
|
|
|
|
await wrapper.trigger('click')
|
|
|
|
expect(wrapper.emitted('widget-variation-selected')).toBeUndefined()
|
|
expect(wrapper.attributes('aria-disabled')).toBe('true')
|
|
})
|
|
|
|
test('selects an available widget when creation is not pending', async () => {
|
|
const wrapper = mountCreateWidgetCard(false)
|
|
|
|
await wrapper.trigger('click')
|
|
|
|
expect(wrapper.emitted('widget-variation-selected')).toEqual([
|
|
[wrapper.props('variation')],
|
|
])
|
|
})
|
|
|
|
test('shows its description when hovered', () => {
|
|
mountCreateWidgetCard(false)
|
|
expect(tooltip.mounted.mock.calls.at(-1)[1].value).toBe('A single number')
|
|
})
|
|
})
|