mirror of
https://github.com/baserow/baserow.git
synced 2026-12-04 16:28:31 +00:00
* feat(jobs): Opt-in lock so a job type can refuse a cancel after its commit * feat(create-user-template): Create a user template and list it in "Your templates" * fix(create-user-template): Address review feedback - Only the owner can open a user template; the slug endpoint returns 404 otherwise and includes `type`. - List templates through `/api/templates/?view=flat` instead of `/own/`. - Rename the job's copy to `template_workspace`, renumber the migration to 0132 after develop's core migrations, guard it like 0128, and move revision fields and metadata to the update PR. - Clear references outside the selection instead of failing the import, lock the owner row against a concurrent delete, and keep leftovers tracked until they're deleted. - Load workspace permissions only for the wizard, handle instances without categories, restore a running job before a failed one, and open the default template again in the template modal. - Reuse existing export, cancel and serializer code, keep one icon list, remove overlapping tests, and give template fixtures a unique slug.
59 lines
1.6 KiB
JavaScript
59 lines
1.6 KiB
JavaScript
import { TestApp } from '@baserow/test/helpers/testApp'
|
|
import SegmentControl from '@baserow/modules/core/components/SegmentControl.vue'
|
|
|
|
describe('SegmentControl.vue', () => {
|
|
let testApp = null
|
|
|
|
beforeEach(() => {
|
|
testApp = new TestApp()
|
|
})
|
|
|
|
afterEach(() => {
|
|
testApp.afterEach()
|
|
})
|
|
|
|
const mountComponent = ({
|
|
props = { totalPages: 5, page: 1 },
|
|
listeners = {},
|
|
slots = {},
|
|
} = {}) => {
|
|
return testApp.mount(SegmentControl, {
|
|
propsData: {
|
|
segments: [{ label: 'One' }, { label: 'Two' }, { label: 'Three' }],
|
|
initialActiveIndex: 1,
|
|
},
|
|
listeners,
|
|
slots,
|
|
})
|
|
}
|
|
it('renders the correct number of segments', async () => {
|
|
const wrapper = await mountComponent()
|
|
|
|
expect(wrapper.findAll('.segment-control__button').length).toBe(3)
|
|
})
|
|
|
|
it('renders the pills type', async () => {
|
|
const wrapper = await testApp.mount(SegmentControl, {
|
|
propsData: { segments: [{ label: 'One' }], type: 'pills' },
|
|
})
|
|
|
|
expect(wrapper.classes()).toContain('segment-control--pills')
|
|
expect(wrapper.classes()).not.toContain('segment-control--rounded')
|
|
})
|
|
|
|
it('sets the active segment correctly', async () => {
|
|
const wrapper = await mountComponent()
|
|
|
|
expect(
|
|
wrapper.findAll('.segment-control__button--active').at(0).text()
|
|
).toBe('Two')
|
|
})
|
|
|
|
it('emits update:activeIndex event with the correct index when a segment is clicked', async () => {
|
|
const wrapper = await mountComponent()
|
|
await wrapper.findAll('.segment-control__button').at(2).trigger('click')
|
|
|
|
expect(wrapper.emitted('update:activeIndex')[0]).toEqual([2])
|
|
})
|
|
})
|