Files
Przemyslaw Kukulski 58a9449209 feat: create a user template and list it in "Your templates" (#6421)
* 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.
2026-10-22 12:05:04 +02:00

47 lines
1.2 KiB
JavaScript

import { shallowMount } from '@vue/test-utils'
import Chips from '@baserow/modules/core/components/Chips'
describe('Chips.vue', () => {
it('renders correctly when active', () => {
const wrapper = shallowMount(Chips, {
propsData: {
active: true,
},
})
expect(wrapper.classes()).toContain('chips--active')
})
it('renders correctly when not active', () => {
const wrapper = shallowMount(Chips, {
propsData: {
active: false,
},
})
expect(wrapper.classes()).not.toContain('chips--active')
})
it('renders the small size', () => {
const wrapper = shallowMount(Chips, { propsData: { size: 'small' } })
expect(wrapper.classes()).toContain('chips--small')
expect(shallowMount(Chips).classes()).not.toContain('chips--small')
})
it('renders chips text in slot', () => {
const text = 'Click me'
const wrapper = shallowMount(Chips, {
slots: {
default: text,
},
})
expect(wrapper.find('button').text()).toMatch(text)
})
it('emits click event when clicked', () => {
const wrapper = shallowMount(Chips)
wrapper.vm.$emit('click')
expect(wrapper.emitted().click).toBeTruthy()
})
})