Skip to content

Commit

Permalink
fix(TabPane): use Fade for default transition (#6235)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletsang committed Feb 7, 2022
1 parent e7e3207 commit 3e0b4d3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/TabPane.tsx
@@ -1,12 +1,12 @@
import classNames from 'classnames';
import * as React from 'react';
import PropTypes from 'prop-types';
import NoopTransition from '@restart/ui/NoopTransition';
import SelectableContext from '@restart/ui/SelectableContext';
import TabContext from '@restart/ui/TabContext';
import { useTabPanel } from '@restart/ui/TabPanel';
import { EventKey, TransitionCallbacks } from '@restart/ui/types';
import { useBootstrapPrefix } from './ThemeProvider';
import Fade from './Fade';
import getTabTransitionComponent from './getTabTransitionComponent';
import {
BsPrefixProps,
Expand Down Expand Up @@ -118,7 +118,7 @@ const TabPane: BsPrefixRefForwardingComponent<'div', TabPaneProps> =
onExited,
mountOnEnter,
unmountOnExit,
transition: Transition = NoopTransition,
transition: Transition = Fade,
},
] = useTabPanel({
...props,
Expand Down
12 changes: 11 additions & 1 deletion test/TabsSpec.tsx
@@ -1,6 +1,5 @@
import { fireEvent, render } from '@testing-library/react';
import sinon from 'sinon';
import React from 'react';

import Tab from '../src/Tab';
import Tabs from '../src/Tabs';
Expand Down Expand Up @@ -189,6 +188,17 @@ describe('<Tabs>', () => {

getAllByRole('tabpanel').should.have.length(1);
});

it('should have fade animation by default', () => {
const { getByRole } = render(
<Tabs id="test" defaultActiveKey={1}>
<Tab title="Tab 1" eventKey={1}>
Tab 1 content
</Tab>
</Tabs>,
);
getByRole('tabpanel').classList.contains('fade').should.be.true;
});
});

// describe('<Tab>', () => {
Expand Down

0 comments on commit 3e0b4d3

Please sign in to comment.