Skip to content
Open
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
16 changes: 15 additions & 1 deletion components/pages/posts/post/PostComponent.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import { ChevronDownIcon } from '@heroicons/vue/24/outline'
import { ArrowTopRightOnSquareIcon, ChevronDownIcon } from '@heroicons/vue/24/outline'
import type { IPost } from '~/assets/js/post.dto'
import Tag from '~/assets/js/tag.dto'
import { project } from '@/config/project'
Expand Down Expand Up @@ -137,6 +137,20 @@
:mediaUrl="post.high_res_file.url ?? post.low_res_file.url ?? (mediaFile.file as string)"
/>

<NuxtLink
v-if="mediaFile.file"
:href="mediaFile.file"
aria-label="Open media in new tab"
class="hover:hover-bg-util focus-visible:focus-outline-util group rounded-md px-1.5 py-1"
rel="noopener noreferrer"
target="_blank"
>
<ArrowTopRightOnSquareIcon
aria-hidden="true"
class="group-hover:hover-text-util text-base-content h-5 w-5"
/>
</NuxtLink>

<PostSource
:post-file-url="post.media_type === 'video' ? mediaFile.posterFile : mediaFile.file"
:post-sources="post.sources"
Expand Down
4 changes: 4 additions & 0 deletions test/pages/posts.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,14 @@ describe('/', async () => {
// Post
const firstPost = postsInList.first()

const openMediaLink = firstPost.getByRole('link', { name: /open media in new tab/i })

// Image
const firstPostImage = firstPost.locator('img')

expect(await firstPostImage.getAttribute('src')).toBe(mockPostsPage0.data[0].low_res_file.url)
expect(await openMediaLink.getAttribute('href')).toBe(mockPostsPage0.data[0].low_res_file.url)
expect(await openMediaLink.getAttribute('target')).toBe('_blank')

await firstPost.getByRole('button', { name: /tags/i }).click()

Expand Down