diff --git a/frontend/application/components/BlogPage.tsx b/frontend/application/components/BlogPage.tsx index 4dc70dfe..6b2a8da7 100644 --- a/frontend/application/components/BlogPage.tsx +++ b/frontend/application/components/BlogPage.tsx @@ -435,8 +435,8 @@ export default function BlogPage({
-
نویسنده: {post.author}
-
تیم: {post.authorTeam || BLOG_TEAM_FALLBACK}
+
نویسنده: {post.author}
+
تیم: {post.authorTeam || BLOG_TEAM_FALLBACK}
مطالعه diff --git a/frontend/application/components/__tests__/BlogPage.test.tsx b/frontend/application/components/__tests__/BlogPage.test.tsx index fe19e389..31f4c5a0 100644 --- a/frontend/application/components/__tests__/BlogPage.test.tsx +++ b/frontend/application/components/__tests__/BlogPage.test.tsx @@ -22,7 +22,7 @@ beforeEach(()=>vi.clearAllMocks()); describe('BlogPage',()=>{ it('renders featured and regular posts as semantic links',()=>{render();expect(screen.getAllByRole('heading',{level:2})[0]).toHaveTextContent('Skin article');expect(screen.getByRole('link',{name:/Skin article/})).toHaveAttribute('href','/blog/skin');expect(screen.getByRole('link',{name:/Joint article/})).toHaveAttribute('href','/blog/joint');}); it('labels publication, including a same-day material update, author and stable team on featured and regular cards',()=>{const fresh=[{...blogs[0],publishedAt:'2026-01-01T08:00:00Z',contentUpdatedAt:'2026-01-02T08:00:00Z',authorTeam:'Clinical'}, {...blogs[1],publishedAt:'2026-01-02T08:00:00Z',contentUpdatedAt:'2026-01-02T12:00:00Z'}];render();expect(screen.getAllByText(/تاریخ انتشار/)).toHaveLength(2);expect(screen.getAllByText(/آخرین به‌روزرسانی/)).toHaveLength(2);expect(screen.getAllByText(/نویسنده:/)).toHaveLength(2);expect(screen.getByText(/تیم: Clinical/)).toBeInTheDocument();expect(screen.getByText(/تیم: پژوهش و محتوای علمی کنینا/)).toBeInTheDocument();expect(document.querySelectorAll('time[datetime]').length).toBeGreaterThanOrEqual(4);}); - it('stacks author and team on separate rows and keeps featured action on one line',()=>{render();const featuredMeta=screen.getByTestId('featured-attribution');expect(featuredMeta).toHaveClass('flex-col');expect(screen.getByTestId('featured-read-more')).toHaveClass('whitespace-nowrap');const regularMeta=screen.getByTestId('regular-attribution-1');expect(regularMeta).toHaveClass('flex-col');expect(regularMeta.children).toHaveLength(2);}); + it('stacks author and team on separate non-wrapping rows and keeps featured action on one line',()=>{render();const featuredMeta=screen.getByTestId('featured-attribution');expect(featuredMeta).toHaveClass('flex-col');expect(screen.getByTestId('featured-read-more')).toHaveClass('whitespace-nowrap');const regularMeta=screen.getByTestId('regular-attribution-1');expect(regularMeta).toHaveClass('flex-col');expect(regularMeta.children).toHaveLength(2);expect(regularMeta.children[0]).toHaveClass('whitespace-nowrap');expect(regularMeta.children[1]).toHaveClass('whitespace-nowrap');}); it('keeps the featured footer responsive without forcing attribution or action to wrap',()=>{render();expect(screen.getByTestId('featured-footer')).toHaveClass('flex-col','sm:flex-row');expect(screen.getByTestId('featured-author-name')).toHaveClass('whitespace-nowrap');expect(screen.getByTestId('featured-team-name')).toHaveClass('whitespace-nowrap');}); it('combines category, excerpt search and tags then resets empty intersection',()=>{render();fireEvent.click(screen.getByRole('button',{name:'Joints'}));expect(h.replace).toHaveBeenCalledWith('/blog?categoryId=joints',{scroll:false});expect(screen.queryByText('Skin article')).not.toBeInTheDocument();fireEvent.change(screen.getByPlaceholderText('جستجو در موضوعات، بیماری‌ها، ویتامین‌ها...'),{target:{value:'MOBILITY'}});expect(screen.getByText('Joint article')).toBeInTheDocument();fireEvent.click(screen.getByRole('button',{name:'#coat'}));expect(screen.getByText('هیچ مقاله‌ای با معیارهای جستجوی شما یافت نشد.')).toBeInTheDocument();fireEvent.click(screen.getByRole('button',{name:'پاکسازی همه فیلترها'}));expect(screen.getByText('Skin article')).toBeInTheDocument();expect(screen.getByText('Joint article')).toBeInTheDocument();}); it('syncs category with route props',()=>{const view=render();expect(screen.queryByText('Skin article')).not.toBeInTheDocument();view.rerender();expect(screen.queryByText('Joint article')).not.toBeInTheDocument();});