diff --git a/web/app/components/plugins/marketplace/home/__tests__/home-trending-layout.browser.spec.tsx b/web/app/components/plugins/marketplace/home/__tests__/home-trending-layout.browser.spec.tsx index 824240fe62c..8ba957229e6 100644 --- a/web/app/components/plugins/marketplace/home/__tests__/home-trending-layout.browser.spec.tsx +++ b/web/app/components/plugins/marketplace/home/__tests__/home-trending-layout.browser.spec.tsx @@ -55,49 +55,55 @@ const carouselBanners = [ ] describe('Marketplace home trending layout', () => { - it('keeps standalone mobile ad and blog banners at the same fixed height', async () => { + it('keeps standalone mobile blog banners at the stacked 357px height', async () => { await page.viewport(600, 900) await render(
-
- -
, ) const blogSlide = document.querySelector('[data-testid="blog-banner"] > a')! - const adSlide = document.querySelector('[data-testid="ad-banner"] > a')! expect(blogSlide.getBoundingClientRect().height).toBe(357) - expect(adSlide.getBoundingClientRect().height).toBe(blogSlide.getBoundingClientRect().height) }) - it('keeps event and ad artwork left-aligned so responsive cropping stays on the right', async () => { + it('shows the standalone mobile event poster at the 800:721 delivery ratio', async () => { await page.viewport(600, 900) const screen = await render( -
+
+ +
, + ) + + const slide = screen.getByRole('link', { name: 'Launch event' }).element() + const box = slide.getBoundingClientRect() + const artwork = slide.querySelector('img') + + expect(box.height).toBeCloseTo((box.width * 721) / 800, 1) + expect(artwork).not.toBeNull() + expect(getComputedStyle(artwork!).objectFit).toBe('contain') + expect(getComputedStyle(artwork!).objectPosition).toBe('0% 50%') + }) + + it('keeps event and ad artwork left-aligned so desktop cropping stays on the right', async () => { + await page.viewport(1000, 900) + const screen = await render( +
, ) - const assertLeftCoverCrop = () => { - for (const name of ['Partner campaign', 'Launch event']) { - const artwork = screen.getByRole('link', { name }).element().querySelector('img') + for (const name of ['Partner campaign', 'Launch event']) { + const artwork = screen.getByRole('link', { name }).element().querySelector('img') - expect(artwork).not.toBeNull() - expect(getComputedStyle(artwork!).objectFit).toBe('cover') - expect(getComputedStyle(artwork!).objectPosition).toBe('0% 50%') - } + expect(artwork).not.toBeNull() + expect(getComputedStyle(artwork!).objectFit).toBe('cover') + expect(getComputedStyle(artwork!).objectPosition).toBe('0% 50%') } - - assertLeftCoverCrop() - - await page.viewport(1000, 900) - assertLeftCoverCrop() }) it('keeps the blog artwork left corners rounded when its image is cropped', async () => { diff --git a/web/app/components/plugins/marketplace/home/home-trending.module.css b/web/app/components/plugins/marketplace/home/home-trending.module.css index dca60ffac5f..b961f04ced9 100644 --- a/web/app/components/plugins/marketplace/home/home-trending.module.css +++ b/web/app/components/plugins/marketplace/home/home-trending.module.css @@ -77,8 +77,8 @@ max-width: 400px; } -/* Crop from the right so left-side artwork stays visible when the frame - is narrower than the image (PC resize and mobile cover). */ +/* Desktop: crop from the right so left-side artwork stays visible when the + 6:1 frame is narrower than the image. */ .imageSlide :is(picture, img) { object-position: left; } @@ -247,16 +247,17 @@ gap: 4px; } - /* Event/ad mobile: match the fixed 197px artwork + 160px copy height. - Cover + left so shrinking the frame crops the right, not the copy. */ + /* Event/ad mobile: show the 800×721 poster whole (ops banner-meta), not + cover-cropped into the stacked 357px blog/recommend frame. */ :global([data-marketplace-standalone]) .imageSlide { - height: 357px; + height: auto; + aspect-ratio: 800 / 721; } :global([data-marketplace-standalone]) .imageSlide :is(picture, img) { width: 100%; height: 100%; - object-fit: cover; + object-fit: contain; object-position: left; }