This commit is contained in:
Denis Bykhov 2022-04-12 01:17:03 +06:00 committed by GitHub
parent 5002645365
commit a7a049c78f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 8 deletions

View File

@ -47,8 +47,7 @@
showPopup(createItemDialog as AnyComponent, { space: spaceId }, ev.target as HTMLElement)
}
let selectedViewlet = 0
$: viewlet = viewlets[selectedViewlet]
$: updateViewlets(viewlets)
$: if (prevSpaceId !== spaceId) {
search = ''
@ -67,6 +66,12 @@
const editor = await getEditor(space._class)
showPanel(editor ?? plugin.component.SpacePanel, space._id, space._class, 'right')
}
function updateViewlets (viewlets: WithLookup<Viewlet>[]) {
const index = viewlets.findIndex((p) => p.descriptor === viewlet?.descriptor)
viewlet = index === -1 ? viewlets[0] : viewlets[index]
}
</script>
<div class="ac-header divide full">
@ -74,11 +79,11 @@
<Header icon={classIcon(client, space._class)} label={space.name} description={space.description} on:click={onSpaceEdit} />
{#if viewlets.length > 1}
<div class="flex">
{#each viewlets as viewlet, i}
<Tooltip label={viewlet.$lookup?.descriptor?.label} direction={'top'}>
<button class="ac-header__icon-button" class:selected={selectedViewlet === i} on:click={() => { selectedViewlet = i }}>
{#if viewlet.$lookup?.descriptor?.icon}
<Icon icon={viewlet.$lookup?.descriptor?.icon} size={'small'} />
{#each viewlets as v, i}
<Tooltip label={v.$lookup?.descriptor?.label} direction={'top'}>
<button class="ac-header__icon-button" class:selected={viewlet?._id === v._id} on:click={() => { viewlet = v }}>
{#if v.$lookup?.descriptor?.icon}
<Icon icon={v.$lookup?.descriptor?.icon} size={'small'} />
{/if}
</button>
</Tooltip>

View File

@ -47,7 +47,6 @@
})
_class = attachTo
}
viewlet = viewlets[0]
space = currentSpace
}

View File

@ -0,0 +1,50 @@
import { expect, test } from '@playwright/test'
import { openWorkbench } from './utils'
test.describe('workbench tests', () => {
test.beforeEach(async ({ page }) => {
// Create user and workspace
await openWorkbench(page)
})
test('navigator', async ({ page }) => {
// Click [id="app-recruit\:string\:RecruitApplication"]
await page.click('[id="app-recruit\\:string\\:RecruitApplication"]')
await expect(page).toHaveURL('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit')
// Click text=Applications
await page.click('text=Applications')
await expect(page).toHaveURL('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/applicants')
// Click text=Applications Application >> span
await expect(page.locator('text=Applications Application >> span')).toBeVisible()
await expect(page.locator('text=APP-1')).toBeVisible()
// Click text=Candidates
await page.click('text=Candidates')
await expect(page).toHaveURL('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/candidates')
await expect(page.locator('text=Candidates Candidate >> span')).toBeVisible()
await expect(page.locator('text=Andrey P.')).toBeVisible()
// Click text=Vacancies
await page.click('text=Vacancies')
await expect(page).toHaveURL('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/recruit%3Aapp%3ARecruit/vacancies')
// Click text=Software Engineer
await page.click('text=Software Engineer')
await expect(page.locator('text=Software Engineer')).toBeVisible()
await expect(page.locator('text=APP-1')).toBeVisible()
await page.click('[name="tooltip-task:string:Kanban"]')
// Click [id="app-chunter\:string\:ApplicationLabelChunter"]
await page.click('[id="app-chunter\\:string\\:ApplicationLabelChunter"]')
await expect(page).toHaveURL('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/chunter%3Aapp%3AChunter')
await page.click('text=general')
// Click .textInput
await expect(page.locator('.textInput')).toBeVisible()
await page.click('[id="app-contact\\:string\\:Contacts"]')
await expect(page).toHaveURL('http://localhost:8083/workbench%3Acomponent%3AWorkbenchApp/contact%3Aapp%3AContacts')
// Click text=John Appleseed
await expect(page.locator('text=John Appleseed')).toBeVisible()
})
})