test portrait background
This commit is contained in:
parent
6b004c144a
commit
5e2d1a362b
1 changed files with 26 additions and 0 deletions
|
|
@ -63,6 +63,32 @@ describe('homepage hero', () => {
|
|||
},
|
||||
)
|
||||
})
|
||||
|
||||
it('extends the circular background to the portrait base edges', () => {
|
||||
cy.get<HTMLImageElement>('[data-cy="hero-portrait"]').then(
|
||||
(portraitElements) => {
|
||||
const portraitImage = portraitElements[0]
|
||||
const frameElement = portraitImage.parentElement
|
||||
|
||||
if (frameElement === null) {
|
||||
throw new Error('Portrait frame is missing')
|
||||
}
|
||||
|
||||
const portraitBounds = portraitImage.getBoundingClientRect()
|
||||
const frameBounds = frameElement.getBoundingClientRect()
|
||||
const backgroundStyle = getComputedStyle(frameElement, '::before')
|
||||
const backgroundWidth = Number.parseFloat(backgroundStyle.width)
|
||||
const backgroundLeft =
|
||||
frameBounds.left + (frameBounds.width - backgroundWidth) / 2
|
||||
const backgroundRight = backgroundLeft + backgroundWidth
|
||||
|
||||
expect(backgroundStyle.content).to.not.equal('none')
|
||||
expect(backgroundWidth).to.be.closeTo(portraitBounds.width, 1)
|
||||
expect(backgroundLeft).to.be.closeTo(portraitBounds.left, 1)
|
||||
expect(backgroundRight).to.be.closeTo(portraitBounds.right, 1)
|
||||
},
|
||||
)
|
||||
})
|
||||
})
|
||||
|
||||
describe('homepage discover path section', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue