-
Notifications
You must be signed in to change notification settings - Fork 91
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(theming): add :focus-visible scoping <div> knock-out option to T…
…hemeProvider (#897)
- Loading branch information
Showing
4 changed files
with
60 additions
and
12 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Copyright Zendesk, Inc. | ||
* | ||
* Use of this source code is governed under the Apache License, Version 2.0 | ||
* found at http://www.apache.org/licenses/LICENSE-2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from 'garden-test-utils'; | ||
import ThemeProvider from './ThemeProvider'; | ||
|
||
describe('ThemeProvider', () => { | ||
it('renders a :focus-visible scoping <div> by default', () => { | ||
const { container } = render(<ThemeProvider />); | ||
|
||
expect(container.firstChild!.nodeName).toBe('DIV'); | ||
}); | ||
|
||
it('only renders children when focusVisibleRef is null', () => { | ||
const { container } = render( | ||
<ThemeProvider focusVisibleRef={null}> | ||
<button /> | ||
</ThemeProvider> | ||
); | ||
|
||
expect(container.firstChild!.nodeName).toBe('BUTTON'); | ||
}); | ||
}); |
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