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
5 changes: 4 additions & 1 deletion clients/dashboard/app/components/ProductEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ async function save() {
</FieldLabel>
<Select v-model="categoryId">
<SelectTrigger id="product-category" class="w-full">
<SelectValue />
<!-- Drawn from the value: a category's name is content, read again in the new language. -->
<SelectValue>
<span dir="auto">{{ categories.find(category => category.id === categoryId)?.name }}</span>
</SelectValue>
</SelectTrigger>
<SelectContent>
<SelectItem v-for="category in categories" :key="category.id" :value="category.id">
Expand Down
3 changes: 2 additions & 1 deletion clients/dashboard/app/components/audit/Filters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ watch(() => props.query.entityId, (value) => {
:aria-label="$t('audit.filters.entity')"
>
<Box class="text-muted-foreground" />
<SelectValue />
<!-- Drawn from the value, not copied from the option: the copy keeps the language it was made in. -->
<SelectValue>{{ entityItems.find(item => item.value === entity)?.label }}</SelectValue>
</SelectTrigger>
<SelectContent>
<SelectItem
Expand Down
3 changes: 2 additions & 1 deletion clients/dashboard/app/components/languages/FormModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ async function submit() {
</FieldLabel>
<Select v-model="state.direction">
<SelectTrigger id="language-direction" class="w-full">
<SelectValue />
<!-- Drawn from the value, not copied from the option: the copy keeps the language it was made in. -->
<SelectValue>{{ directions.find(item => item.value === state.direction)?.label }}</SelectValue>
</SelectTrigger>
<SelectContent>
<SelectItem v-for="item in directions" :key="item.value" :value="item.value">
Expand Down
5 changes: 3 additions & 2 deletions clients/dashboard/app/components/media/Filters.vue
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ function onSort(value: SortValue) {
<Select v-if="!compact" :model-value="kind" @update:model-value="onKind(String($event))">
<SelectTrigger class="w-full *:data-[slot=select-value]:flex-1 md:min-w-0 md:flex-1">
<Filter class="text-muted-foreground" />
<SelectValue />
<!-- Drawn from the value, not copied from the option: the copy keeps the language it was made in. -->
<SelectValue>{{ kinds.find(item => item.value === kind)?.label }}</SelectValue>
</SelectTrigger>
<SelectContent>
<SelectItem v-for="item in kinds" :key="item.value" :value="item.value">
Expand All @@ -147,7 +148,7 @@ function onSort(value: SortValue) {
<Select :model-value="sort" @update:model-value="onSort($event as SortValue)">
<SelectTrigger class="w-full *:data-[slot=select-value]:flex-1 md:min-w-0 md:flex-1">
<ArrowUpDown class="text-muted-foreground" />
<SelectValue />
<SelectValue>{{ sorts.find(item => item.value === sort)?.label }}</SelectValue>
</SelectTrigger>
<SelectContent>
<SelectItem v-for="item in sorts" :key="item.value" :value="item.value">
Expand Down
12 changes: 12 additions & 0 deletions clients/dashboard/test/e2e/smoke.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,18 @@ test('Arabic turns the page right-to-left', async ({ page, goto }) => {
await expect(heading(page)).toHaveText('نظرة عامة')
})

test('a filter on screen follows the language, rather than keeping the words it was drawn in', async ({ page, goto }) => {
await goto('/audit')

await expect(page.getByRole('combobox', { name: 'Entity' })).toHaveText('Any entity')

await page.getByRole('combobox', { name: 'Reading language' }).click()
await page.getByRole('option', { name: /العربية/ }).click()

// A select copies its chosen option's text when it is drawn; this one is drawn from its value.
await expect(page.getByRole('combobox', { name: 'الكيان' })).toHaveText('أي كيان')
})

test('a media entry shows its operation beside the action', async ({ page, goto }) => {
await goto('/audit')

Expand Down
Loading