-
Notifications
You must be signed in to change notification settings - Fork 33
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 #2233 from Codeinwp/fix/button-group-font
Fix Buton Group Font settings
- Loading branch information
Showing
5 changed files
with
69 additions
and
18 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { test, expect } from '@wordpress/e2e-test-utils-playwright'; | ||
|
||
test.describe( 'Button Group', () => { | ||
test.beforeEach( async({ admin, page }) => { | ||
await admin.createNewPost(); | ||
}); | ||
|
||
test( 'check font settings', async({ editor, page }) => { | ||
const attributes = { | ||
fontSize: '28px', | ||
fontFamily: 'Abel', | ||
textTransform: 'lowercase', | ||
fontStyle: 'italic', | ||
lineHeight: '2.5' | ||
}; | ||
|
||
await editor.insertBlock({ | ||
name: 'themeisle-blocks/button-group', | ||
attributes, | ||
innerBlocks: [ | ||
{ | ||
name: 'themeisle-blocks/button', | ||
attributes: { | ||
text: 'Button 1' | ||
} | ||
} | ||
] | ||
}); | ||
|
||
const postId = await editor.publishPost(); | ||
await page.goto( `/?p=${postId}` ); | ||
|
||
// Check CSS font properties | ||
const btn = page.locator( 'a' ).filter({ hasText: 'Button 1' }); | ||
await expect( btn ).toHaveCSS( 'font-size', attributes.fontSize ); | ||
await expect( btn ).toHaveCSS( 'font-family', attributes.fontFamily ); | ||
await expect( btn ).toHaveCSS( 'text-transform', attributes.textTransform ); | ||
await expect( btn ).toHaveCSS( 'font-style', attributes.fontStyle ); | ||
await expect( btn ).toHaveCSS( 'line-height', `${parseInt( attributes.fontSize ) * parseFloat( attributes.lineHeight )}px` ); // Playwright use computed line-height based on font-size. | ||
}); | ||
}); |
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