-
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.
- Loading branch information
1 parent
4232d04
commit 5fabe98
Showing
3 changed files
with
54 additions
and
10 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
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 }) => { | ||
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. | ||
}); | ||
}); |