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
17 changes: 7 additions & 10 deletions src/partials/WidgetSponsorPartial.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<template>
<div
class="rounded-lg border border-slate-200 dark:border-slate-800 dark:bg-linear-to-t dark:from-slate-800 dark:to-slate-800/30 p-5"
@click="sendEmail"
>
<div class="rounded-lg border border-slate-200 dark:border-slate-800 dark:bg-linear-to-t dark:from-slate-800 dark:to-slate-800/30 p-5" @click="sendEmail">
<div class="flex items-center space-x-3 mb-2">
<svg xmlns="http://www.w3.org/2000/svg" width="28" height="20" class="fill-current blog-side-nav-router-link-a-active">
<path
Expand All @@ -29,13 +26,13 @@ const sponsor: Sponsor = {
};

const sendEmail = () => {
const recipient = 'otnacog@gmail.com';
const subject = `Inquiry about: ${sponsor.title}`;
const body = `Hello,\n\nI'm interested in learning more about your services.\n\n"${sponsor.description}"\n\nThanks,`;
const recipient = 'otnacog@gmail.com';
const subject = `Inquiry about: ${sponsor.title}`;
const body = `Hello,\n\nI'm interested in learning more about your services.\n\n"${sponsor.description}"\n\nThanks,`;

const encodedSubject = encodeURIComponent(subject);
const encodedBody = encodeURIComponent(body);
const encodedSubject = encodeURIComponent(subject);
const encodedBody = encodeURIComponent(body);

window.location.href = `mailto:${recipient}?subject=${encodedSubject}&body=${encodedBody}`;
window.location.href = `mailto:${recipient}?subject=${encodedSubject}&body=${encodedBody}`;
};
</script>
13 changes: 12 additions & 1 deletion tests/pages/PostPage.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,20 @@ vi.mock('@api/store.ts', () => ({ useApiStore: () => ({ getPost }) }));
vi.mock('vue-router', () => ({ useRoute: () => ({ params: { slug: post.slug } }) }));
vi.mock('marked', () => ({ marked: { use: vi.fn(), parse: vi.fn(() => '<p></p>') } }));
vi.mock('dompurify', () => ({ default: { sanitize: vi.fn((html: string) => html) } }));
vi.mock('highlight.js', () => ({ default: { highlightElement: vi.fn() } }));
vi.mock('highlight.js/lib/core', () => ({
default: {
highlightElement: vi.fn(),
registerLanguage: vi.fn(),
registerAliases: vi.fn(),
},
}));
vi.mock('@/dark-mode.ts', () => ({ useDarkMode: () => ({ isDark: ref(false) }) }));
vi.mock('@api/http-error.ts', () => ({ debugError: vi.fn() }));
vi.mock('@/public.ts', () => ({
initializeHighlighter: vi.fn(),
date: () => ({ format: () => '' }),
getReadingTime: () => '',
}));

describe('PostPage', () => {
it('fetches post on mount', async () => {
Expand Down
5 changes: 4 additions & 1 deletion tests/partials/ArticleItemPartial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ describe('ArticleItemPartial', () => {
};

it('renders item information', () => {
const wrapper = mount(ArticleItemPartial, { props: { item } });
const wrapper = mount(ArticleItemPartial, {
props: { item },
global: { stubs: { RouterLink: { template: '<a><slot /></a>' } } },
});
expect(wrapper.text()).toContain('formatted');
expect(wrapper.text()).toContain(item.title);
expect(wrapper.find('img').attributes('src')).toBe(item.cover_image_url);
Expand Down
4 changes: 3 additions & 1 deletion tests/partials/ArticlesListPartial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ vi.mock('@api/store.ts', () => ({

describe('ArticlesListPartial', () => {
it('loads posts on mount', async () => {
const wrapper = mount(ArticlesListPartial);
const wrapper = mount(ArticlesListPartial, {
global: { stubs: { RouterLink: { template: '<a><slot /></a>' } } },
});
await flushPromises();
expect(getCategories).toHaveBeenCalled();
expect(getPosts).toHaveBeenCalled();
Expand Down
2 changes: 1 addition & 1 deletion tests/partials/AvatarPartial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import AvatarPartial from '@partials/AvatarPartial.vue';

describe('AvatarPartial', () => {
it('applies default size classes', () => {
const wrapper = mount(AvatarPartial);
const wrapper = mount(AvatarPartial, { props: { width: 'w-20', height: 'h-20' } });
const img = wrapper.find('img');
expect(img.classes()).toContain('w-20');
expect(img.classes()).toContain('h-20');
Expand Down
7 changes: 5 additions & 2 deletions tests/partials/SideNavPartial.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import SideNavPartial from '@partials/SideNavPartial.vue';
const router = createRouter({
history: createMemoryHistory(),
routes: [
{ path: '/', name: 'home' },
{ path: '/about', name: 'about' },
{ path: '/', name: 'home', component: { template: '<div />' } },
{ path: '/about', name: 'about', component: { template: '<div />' } },
{ path: '/subscribe', name: 'subscribe', component: { template: '<div />' } },
{ path: '/projects', name: 'projects', component: { template: '<div />' } },
{ path: '/resume', name: 'resume', component: { template: '<div />' } },
],
});

Expand Down