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", () => {
|
describe("RovingTabIndex", () => {
|
||||||
it("RovingTabIndexProvider renders children as expected", () => {
|
it("RovingTabIndexProvider renders children as expected", () => {
|
||||||
const wrapper = mount(<RovingTabIndexProvider>
|
const wrapper = mount(<RovingTabIndexProvider>
|
||||||
<div><span>Test</span></div>
|
{() => <div><span>Test</span></div> }
|
||||||
</RovingTabIndexProvider>);
|
</RovingTabIndexProvider>);
|
||||||
expect(wrapper.text()).toBe("Test");
|
expect(wrapper.text()).toBe("Test");
|
||||||
expect(wrapper.html()).toBe('<div><span>Test</span></div>');
|
expect(wrapper.html()).toBe('<div><span>Test</span></div>');
|
||||||
|
@ -55,9 +55,11 @@ describe("RovingTabIndex", () => {
|
||||||
|
|
||||||
it("RovingTabIndexProvider works as expected with useRovingTabIndex", () => {
|
it("RovingTabIndexProvider works as expected with useRovingTabIndex", () => {
|
||||||
const wrapper = mount(<RovingTabIndexProvider>
|
const wrapper = mount(<RovingTabIndexProvider>
|
||||||
{ button1 }
|
{() => <React.Fragment>
|
||||||
{ button2 }
|
{ button1 }
|
||||||
{ button3 }
|
{ button2 }
|
||||||
|
{ button3 }
|
||||||
|
</React.Fragment>}
|
||||||
</RovingTabIndexProvider>);
|
</RovingTabIndexProvider>);
|
||||||
|
|
||||||
// should begin with 0th being active
|
// should begin with 0th being active
|
||||||
|
@ -95,13 +97,15 @@ describe("RovingTabIndex", () => {
|
||||||
|
|
||||||
it("RovingTabIndexProvider works as expected with RovingTabIndexWrapper", () => {
|
it("RovingTabIndexProvider works as expected with RovingTabIndexWrapper", () => {
|
||||||
const wrapper = mount(<RovingTabIndexProvider>
|
const wrapper = mount(<RovingTabIndexProvider>
|
||||||
{ button1 }
|
{() => <React.Fragment>
|
||||||
{ button2 }
|
{ button1 }
|
||||||
<RovingTabIndexWrapper>
|
{ button2 }
|
||||||
{({onFocus, isActive, ref}) =>
|
<RovingTabIndexWrapper>
|
||||||
<button onFocus={onFocus} tabIndex={isActive ? 0 : -1} ref={ref}>.</button>
|
{({onFocus, isActive, ref}) =>
|
||||||
}
|
<button onFocus={onFocus} tabIndex={isActive ? 0 : -1} ref={ref}>.</button>
|
||||||
</RovingTabIndexWrapper>
|
}
|
||||||
|
</RovingTabIndexWrapper>
|
||||||
|
</React.Fragment>}
|
||||||
</RovingTabIndexProvider>);
|
</RovingTabIndexProvider>);
|
||||||
|
|
||||||
// should begin with 0th being active
|
// should begin with 0th being active
|
||||||
|
|
Loading…
Reference in a new issue