update tests to match new rendering method
This commit is contained in:
parent
37fb500e22
commit
176605c302
1 changed files with 15 additions and 11 deletions
|
@ -47,7 +47,7 @@ const button4 = <Button key={4}>d</Button>;
|
|||
describe("RovingTabIndex", () => {
|
||||
it("RovingTabIndexProvider renders children as expected", () => {
|
||||
const wrapper = mount(<RovingTabIndexProvider>
|
||||
<div><span>Test</span></div>
|
||||
{() => <div><span>Test</span></div> }
|
||||
</RovingTabIndexProvider>);
|
||||
expect(wrapper.text()).toBe("Test");
|
||||
expect(wrapper.html()).toBe('<div><span>Test</span></div>');
|
||||
|
@ -55,9 +55,11 @@ describe("RovingTabIndex", () => {
|
|||
|
||||
it("RovingTabIndexProvider works as expected with useRovingTabIndex", () => {
|
||||
const wrapper = mount(<RovingTabIndexProvider>
|
||||
{ button1 }
|
||||
{ button2 }
|
||||
{ button3 }
|
||||
{() => <React.Fragment>
|
||||
{ button1 }
|
||||
{ button2 }
|
||||
{ button3 }
|
||||
</React.Fragment>}
|
||||
</RovingTabIndexProvider>);
|
||||
|
||||
// should begin with 0th being active
|
||||
|
@ -95,13 +97,15 @@ describe("RovingTabIndex", () => {
|
|||
|
||||
it("RovingTabIndexProvider works as expected with RovingTabIndexWrapper", () => {
|
||||
const wrapper = mount(<RovingTabIndexProvider>
|
||||
{ button1 }
|
||||
{ button2 }
|
||||
<RovingTabIndexWrapper>
|
||||
{({onFocus, isActive, ref}) =>
|
||||
<button onFocus={onFocus} tabIndex={isActive ? 0 : -1} ref={ref}>.</button>
|
||||
}
|
||||
</RovingTabIndexWrapper>
|
||||
{() => <React.Fragment>
|
||||
{ button1 }
|
||||
{ button2 }
|
||||
<RovingTabIndexWrapper>
|
||||
{({onFocus, isActive, ref}) =>
|
||||
<button onFocus={onFocus} tabIndex={isActive ? 0 : -1} ref={ref}>.</button>
|
||||
}
|
||||
</RovingTabIndexWrapper>
|
||||
</React.Fragment>}
|
||||
</RovingTabIndexProvider>);
|
||||
|
||||
// should begin with 0th being active
|
||||
|
|
Loading…
Reference in a new issue