-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4060 from Codeinwp/feat/site-title-font-size
Site title font size
- Loading branch information
Showing
5 changed files
with
175 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 0 additions & 59 deletions
59
e2e-tests/specs/customizer/hfg/hfg-alignment-control.spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
import { test, expect, APIRequestContext, Page } from '@playwright/test'; | ||
import { setCustomizeSettings, testForViewport } from '../../../utils'; | ||
import data from '../../../fixtures/customizer/hfg/hfg-logo-component.json'; | ||
|
||
interface TestOptions { | ||
page: Page; | ||
request: APIRequestContext; | ||
baseURL?: string; | ||
} | ||
|
||
interface LogoComponentData { | ||
center: { | ||
// Define the shape of 'center' data | ||
}; | ||
right: { | ||
// Define the shape of 'right' data | ||
}; | ||
left: { | ||
// Define the shape of 'left' data | ||
}; | ||
style: { | ||
// Define the shape of 'style' data | ||
}; | ||
// Add more properties as needed | ||
} | ||
|
||
test.describe('Header Builder - Logo Component', function () { | ||
test('Checks alignment for the Logo', async ({ | ||
page, | ||
request, | ||
baseURL, | ||
}) => { | ||
await testAlignment('Center', data, { page, request, baseURL }); | ||
await testAlignment('Right', data, { page, request, baseURL }); | ||
await testAlignment('Left', data, { page, request, baseURL }); | ||
}); | ||
|
||
test('Checks the style of the Logo', async ({ page, request, baseURL }) => { | ||
await setCustomizeSettings('logoStyle', data.style, { | ||
request, | ||
baseURL, | ||
}); | ||
|
||
await page.goto('/?test_name=logoStyle'); | ||
|
||
await testForViewport( | ||
page, | ||
'.site-title', | ||
{ width: 1536, height: 960 }, | ||
{ | ||
cssProperties: [ | ||
{ property: 'font-size', value: '56px' }, | ||
{ property: 'color', value: 'rgb(255, 0, 0)' }, | ||
], | ||
} | ||
); | ||
|
||
await testForViewport( | ||
page, | ||
'.site-title', | ||
{ width: 768, height: 1024 }, | ||
{ | ||
cssProperties: [{ property: 'font-size', value: '65.6px' }], | ||
} | ||
); | ||
|
||
await testForViewport( | ||
page, | ||
'.site-title', | ||
{ width: 375, height: 812 }, | ||
{ | ||
cssProperties: [{ property: 'font-size', value: '65px' }], | ||
} | ||
); | ||
}); | ||
}); | ||
|
||
async function testAlignment( | ||
alignment: 'Center' | 'Right' | 'Left', | ||
testData: LogoComponentData, | ||
{ page, request, baseURL }: TestOptions | ||
) { | ||
await setCustomizeSettings( | ||
`hfgLogo${alignment}`, | ||
testData[alignment.toLowerCase() as keyof LogoComponentData], | ||
{ | ||
request, | ||
baseURL, | ||
} | ||
); | ||
|
||
await page.goto(`/?test_name=hfgLogo${alignment}`); | ||
const siteLogo = await page.locator('.nv-navbar.hide-on-mobile .site-logo'); | ||
await expect(siteLogo).toBeVisible(); | ||
await expect(siteLogo).toHaveCSS('text-align', alignment.toLowerCase()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters