Skip to content

Commit

Permalink
Maintenance: Desktop view - Fix not working link in simple ticket table.
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikklein committed Nov 5, 2024
1 parent 68ae605 commit 25ca3a2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<!-- Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/ -->

<script setup lang="ts">
import { storeToRefs } from 'pinia'
import { computed, useTemplateRef } from 'vue'

import type { TicketById } from '#shared/entities/ticket/types.ts'
import { useApplicationStore } from '#shared/stores/application.ts'

import CommonSimpleTable from '#desktop/components/CommonSimpleTable/CommonSimpleTable.vue'
import type {
Expand All @@ -25,12 +27,13 @@ const emit = defineEmits<{

const simpleTableInstance = useTemplateRef('simple-table')

const { config } = storeToRefs(useApplicationStore())

const headers: TableHeader[] = [
{ key: 'state', label: '', truncate: true },
{
key: 'number',
label: __('Number'),
labelClass: 'font-normal text-gray-100 dark:text-neutral-400',
label: config.value.ticket_hook,
truncate: true,
},
{ key: 'title', label: __('Title'), truncate: true },
Expand All @@ -47,6 +50,7 @@ const items = computed<Array<TableItem>>(() =>
customer: ticket.organization?.name || ticket.customer?.fullname,
group: ticket.group?.name,
id: ticket.id,
internalId: ticket.internalId,
key: ticket.id,
number: ticket.number,
organization: ticket.organization,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
// Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/

import renderComponent from '#tests/support/components/renderComponent.ts'
import { mockApplicationConfig } from '#tests/support/mock-applicationConfig.ts'

import { createDummyTicket } from '#shared/entities/ticket-article/__tests__/mocks/ticket.ts'

import TicketSimpleTable from '#desktop/pages/ticket/components/TicketDetailView/TicketSimpleTable/TicketSimpleTable.vue'

describe('TicketSimpleData', () => {
beforeEach(() => {
vi.useFakeTimers()
})

it('displays a table with ticket data', () => {
beforeEach(() => {
vi.useFakeTimers()
})
mockApplicationConfig({ ticket_hook: 'Ticket#' })

const wrapper = renderComponent(TicketSimpleTable, {
props: {
Expand All @@ -28,7 +31,7 @@ describe('TicketSimpleData', () => {
})

// Labels
expect(wrapper.getByText('Number')).toBeInTheDocument()
expect(wrapper.getByText('Ticket#')).toBeInTheDocument()
expect(wrapper.getByText('Title')).toBeInTheDocument()
expect(wrapper.getByText('Customer')).toBeInTheDocument()
expect(wrapper.getByText('Group')).toBeInTheDocument()
Expand All @@ -38,6 +41,10 @@ describe('TicketSimpleData', () => {
expect(wrapper.getByText('ROCK YOUR TICKET TABLE')).toBeInTheDocument()
expect(wrapper.getByText('89002')).toBeInTheDocument()
expect(wrapper.getByText('1111')).toBeInTheDocument()
expect(wrapper.getByText('1111')).toHaveAttribute(
'href',
'/desktop/tickets/2',
)
expect(wrapper.getByText('Dummy')).toBeInTheDocument()
expect(
wrapper.getAllByRole('status', { name: 'check-circle-no' }),
Expand Down

0 comments on commit 25ca3a2

Please sign in to comment.