fix(web): crop ad banners from the right (ECO-467)

This commit is contained in:
CodingOnStar 2026-08-27 16:02:15 +08:00
parent 259fe7116e
commit 74bfab20a6
2 changed files with 18 additions and 0 deletions

View File

@ -61,6 +61,23 @@ describe('Marketplace home trending layout', () => {
expect(adSlide.getBoundingClientRect().height).toBe(blogSlide.getBoundingClientRect().height)
})
it('keeps the ad artwork left-aligned so responsive cropping stays on the right', async () => {
await page.viewport(600, 900)
const screen = await render(
<div data-marketplace-standalone className="w-[560px]">
<HomeBannerSlide banner={adBanner} isMarketplacePlatform page="plugins" />
</div>,
)
const artwork = screen
.getByRole('link', { name: 'Partner campaign' })
.element()
.querySelector('img')
expect(artwork).not.toBeNull()
expect(getComputedStyle(artwork!).objectPosition).toBe('0% 50%')
})
it('keeps the blog artwork left corners rounded when its image is cropped', async () => {
const screen = await render(
<div className="w-[600px]">

View File

@ -453,6 +453,7 @@ function ImageBannerSlide({
alt=""
aria-hidden
className="size-full object-cover"
style={{ objectPosition: banner.style_type === 'ad' ? 'left center' : undefined }}
/>
</picture>
</Link>