cleanup path examples
This commit is contained in:
@@ -516,7 +516,7 @@ function ServiceForm({ form, onChange, onConfirm, onCancel, confirmLabel, autoFo
|
|||||||
<option value="udp">udp</option>
|
<option value="udp">udp</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<Input value={form.path} onChange={(e) => onChange({ ...form, path: e.target.value })} placeholder="Path (/dashboard)" className="bg-[#21262d] border-[#30363d] font-mono text-xs h-7" onKeyDown={(e) => e.key === 'Enter' && onConfirm()} />
|
<Input value={form.path} onChange={(e) => onChange({ ...form, path: e.target.value })} placeholder="Path (/admin)" className="bg-[#21262d] border-[#30363d] font-mono text-xs h-7" onKeyDown={(e) => e.key === 'Enter' && onConfirm()} />
|
||||||
<div className="flex gap-1.5">
|
<div className="flex gap-1.5">
|
||||||
<Button size="sm" className="flex-1 h-6 text-[10px] bg-[#00d4ff] text-[#0d1117] hover:bg-[#00d4ff]/90" onClick={onConfirm}>{confirmLabel}</Button>
|
<Button size="sm" className="flex-1 h-6 text-[10px] bg-[#00d4ff] text-[#0d1117] hover:bg-[#00d4ff]/90" onClick={onConfirm}>{confirmLabel}</Button>
|
||||||
<Button size="sm" variant="ghost" className="h-6 text-[10px]" onClick={onCancel}>Cancel</Button>
|
<Button size="sm" variant="ghost" className="h-6 text-[10px]" onClick={onCancel}>Cancel</Button>
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ describe('DetailPanel', () => {
|
|||||||
const addHeaders = screen.getAllByText('Add')
|
const addHeaders = screen.getAllByText('Add')
|
||||||
fireEvent.click(addHeaders[addHeaders.length - 1])
|
fireEvent.click(addHeaders[addHeaders.length - 1])
|
||||||
fireEvent.change(screen.getByPlaceholderText('Service name'), { target: { value: 'health' } })
|
fireEvent.change(screen.getByPlaceholderText('Service name'), { target: { value: 'health' } })
|
||||||
fireEvent.change(screen.getByPlaceholderText('Path (/dashboard)'), { target: { value: 'healthz' } })
|
fireEvent.change(screen.getByPlaceholderText('Path (/admin)'), { target: { value: 'healthz' } })
|
||||||
fireEvent.click(screen.getAllByRole('button', { name: 'Add' }).at(-1) as HTMLButtonElement)
|
fireEvent.click(screen.getAllByRole('button', { name: 'Add' }).at(-1) as HTMLButtonElement)
|
||||||
|
|
||||||
expect(updateNode).toHaveBeenCalledOnce()
|
expect(updateNode).toHaveBeenCalledOnce()
|
||||||
@@ -365,9 +365,9 @@ describe('DetailPanel', () => {
|
|||||||
fireEvent.click(editBtn)
|
fireEvent.click(editBtn)
|
||||||
const nameInput = screen.getByPlaceholderText('Service name') as HTMLInputElement
|
const nameInput = screen.getByPlaceholderText('Service name') as HTMLInputElement
|
||||||
expect(nameInput.value).toBe('nginx')
|
expect(nameInput.value).toBe('nginx')
|
||||||
const portInput = screen.getByPlaceholderText('Port (/dashboard)') as HTMLInputElement
|
const portInput = screen.getByPlaceholderText('Port (/admin)') as HTMLInputElement
|
||||||
expect(portInput.value).toBe('80')
|
expect(portInput.value).toBe('80')
|
||||||
const pathInput = screen.getByPlaceholderText('Path (/dashboard)') as HTMLInputElement
|
const pathInput = screen.getByPlaceholderText('Path (/admin)') as HTMLInputElement
|
||||||
expect(pathInput.value).toBe('/admin')
|
expect(pathInput.value).toBe('/admin')
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -387,13 +387,13 @@ describe('DetailPanel', () => {
|
|||||||
|
|
||||||
const nameInput = screen.getByPlaceholderText('Service name')
|
const nameInput = screen.getByPlaceholderText('Service name')
|
||||||
fireEvent.change(nameInput, { target: { value: 'apache' } })
|
fireEvent.change(nameInput, { target: { value: 'apache' } })
|
||||||
fireEvent.change(screen.getByPlaceholderText('Path (/dashboard)'), { target: { value: '/ui' } })
|
fireEvent.change(screen.getByPlaceholderText('Path (/admin)'), { target: { value: '/admin' } })
|
||||||
fireEvent.click(screen.getByRole('button', { name: 'Save' }))
|
fireEvent.click(screen.getByRole('button', { name: 'Save' }))
|
||||||
|
|
||||||
expect(updateNode).toHaveBeenCalledOnce()
|
expect(updateNode).toHaveBeenCalledOnce()
|
||||||
expect(updateNode.mock.calls[0][1].services[0].service_name).toBe('apache')
|
expect(updateNode.mock.calls[0][1].services[0].service_name).toBe('apache')
|
||||||
expect(updateNode.mock.calls[0][1].services[0].port).toBe(80)
|
expect(updateNode.mock.calls[0][1].services[0].port).toBe(80)
|
||||||
expect(updateNode.mock.calls[0][1].services[0].path).toBe('/ui')
|
expect(updateNode.mock.calls[0][1].services[0].path).toBe('admin')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('cancels edit without updating', () => {
|
it('cancels edit without updating', () => {
|
||||||
|
|||||||
Reference in New Issue
Block a user