-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Components: Restore click-to-close behavior of Dropdown toggle (#11633)
* Testing: Correct truthy test of immediately saveable demo Previously assumed the selector would throw if not found, but in-fact returns `null`. See: https://github.com/GoogleChrome/puppeteer/blob/master/docs/api.md#pageselector * Revert "Components: Remove redundant onClickOutside handler from Dropdown (#11253)" This reverts commit 58725c4. * Testing: Verify Popover toggle behavior * Components: Document Dropdown click outside behavior * Components: Convert Dropdown container to use createRef
- Loading branch information
Showing
3 changed files
with
45 additions
and
2 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,26 @@ | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import { newPost } from '../support/utils'; | ||
|
||
describe( 'popovers', () => { | ||
beforeEach( async () => { | ||
await newPost(); | ||
} ); | ||
|
||
describe( 'dropdown', () => { | ||
it( 'toggles via click', async () => { | ||
const isMoreMenuOpen = async () => !! await page.$( '.edit-post-more-menu__content' ); | ||
|
||
expect( await isMoreMenuOpen() ).toBe( false ); | ||
|
||
// Toggle opened. | ||
await page.click( '.edit-post-more-menu > button' ); | ||
expect( await isMoreMenuOpen() ).toBe( true ); | ||
|
||
// Toggle closed. | ||
await page.click( '.edit-post-more-menu > button' ); | ||
expect( await isMoreMenuOpen() ).toBe( false ); | ||
} ); | ||
} ); | ||
} ); |