Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,7 @@ const spaceDetailsLabel = computed(() => {
return $gettext('Show details')
})
const showDetailsForSpace = (space: SpaceResource) => {
unselectAllSpaces()
selectSpace(space)
openSideBar()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,18 @@ describe('SpacesList', () => {
await wrapper.find('.spaces-table-btn-details').trigger('click')
expect(openSideBar).toHaveBeenCalled()
})
it.each([
{ description: 'another space', selectedSpaces: [spaceMocks[1]] },
{ description: 'the same space', selectedSpaces: [spaceMocks[0]] }
])(
'selects only the clicked space on details button click if $description is selected',
async ({ selectedSpaces }) => {
const { wrapper } = getWrapper({ spaces: spaceMocks, selectedSpaces, stubActions: false })
await wrapper.find('.spaces-table-btn-details').trigger('click')
const { selectedSpaces: newSelection } = useSpaceSettingsStore()
expect(newSelection).toEqual([spaceMocks[0]])
}
)
describe('toggle selection', () => {
describe('selectSpaces method', () => {
it('selects all spaces', () => {
Expand Down Expand Up @@ -177,8 +189,14 @@ describe('SpacesList', () => {
function getWrapper({
mountType = mount,
spaces = [],
selectedSpaces = []
}: { mountType?: typeof mount; spaces?: SpaceResource[]; selectedSpaces?: SpaceResource[] } = {}) {
selectedSpaces = [],
stubActions = true
}: {
mountType?: typeof mount
spaces?: SpaceResource[]
selectedSpaces?: SpaceResource[]
stubActions?: boolean
} = {}) {
vi.mocked(queryItemAsString).mockImplementationOnce(() => '1')
vi.mocked(queryItemAsString).mockImplementationOnce(() => '100')
const mocks = defaultComponentMocks()
Expand All @@ -193,6 +211,7 @@ function getWrapper({
plugins: [
...defaultPlugins({
piniaOptions: {
stubActions,
spaceSettingsStore: { spaces, selectedSpaces }
}
})
Expand Down
Loading