Skip to content

Commit 14cc236

Browse files
committed
💚 Fix failed tests for autocomplete and carousel
1 parent a174cd2 commit 14cc236

File tree

6 files changed

+16
-11
lines changed

6 files changed

+16
-11
lines changed

lib/autocomplete/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ class AutoComplete extends Component {
270270
ref={(ref) => {
271271
this.listRef = ref;
272272
}}
273-
className={cx(theme['autocomplete-list'], showSuggestions ? theme.enabled : '')}
273+
className={cx(theme['autocomplete-list'], showSuggestions ? `${theme.enabled} enabled` : '')}
274274
onMouseEnter={() => this.blockOnBlur(true)}
275275
onMouseLeave={() => this.blockOnBlur(false)}
276276
>

lib/autocomplete/tests/render.test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,21 +66,21 @@ describe('AutoComplete Render tests', () => {
6666

6767
it('Successfully removes dropdown on remove focus', () => {
6868
// Expected value on focus / before blur event on input component.
69-
const expectedValueBeforeBlur = 'enabled';
69+
const expectedValueBeforeBlur = true;
7070
// Expected value after blur event on input component.
71-
const expectedValueAfterBlur = '';
71+
const expectedValueAfterBlur = false;
7272
// Length of the component before / after blur.
7373
const simulatedValue =
7474
() => wrappedComponent.find(AUTOCOMPLETE_LIST_SELECTOR).props().className;
7575

7676
// Simulate focus on input element.
7777
focusOnInput();
7878
// Check if component is rendered.
79-
expect(simulatedValue()).equal(expectedValueBeforeBlur);
79+
expect(simulatedValue().includes('enabled')).equal(expectedValueBeforeBlur);
8080
// Simulate blur event on input component.
8181
wrappedComponent.find('input').simulate('blur');
8282
// Check if component is removed from view.
83-
expect(simulatedValue()).equal(expectedValueAfterBlur);
83+
expect(simulatedValue().includes('enabled')).equal(expectedValueAfterBlur);
8484
});
8585

8686
it('Successfully filters dropdown items according to input', () => {

lib/button/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Button extends Component {
3030
theme[!iconButton && size], // size will not take effect on ICON ONLY BUTTON type
3131
theme[`icon-${iconAlignment}`],
3232
className,
33-
(flat || bordered || borderless) && theme.flat,
33+
(flat || bordered || borderless) && `${theme.flat} flat`,
3434
{
3535
[theme[`${type}Bordered`]]: bordered,
3636
[theme[`${type}Borderless`]]: borderless,

lib/card/index.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,12 @@ class Card extends React.Component {
129129
{ this.renderHeader() }
130130
{ this.renderContent() }
131131
{ this.renderFooter() }
132-
<div className={classnames(theme.expandedContent, theme[`${expanded ? 'expanded' : 'collapsed'}`])}>
132+
<div
133+
className={classnames(
134+
theme.expandedContent, 'expandedContent',
135+
expanded ? `${theme.expanded} expanded` : `${theme.collapsed} collapsed`,
136+
)}
137+
>
133138
{(expandedContent !== null) && <HiddenContent />}
134139
</div>
135140
</div>

lib/carousel/carouselItem.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
44
import cx from 'classnames';
55

66
const CarouselItem = ({ theme, active, imageUrl }) => (
7-
<div className={cx(theme['carousel-item'], theme.active, { [theme.current]: active })}>
7+
<div className={cx(theme['carousel-item'], theme.active, 'active', (active ? `${theme.current} current` : ''))}>
88
{imageUrl ? <img src={imageUrl} alt="carousel-item" /> : this.props.children}
99
</div>
1010
);

lib/carousel/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class Carousel extends React.Component {
4343
{/* eslint-disable jsx-a11y/no-static-element-interactions */}
4444
{
4545
controls &&
46-
<FaAngleLeft className={cx(theme['left-control'], theme['carousel-left-icon'])} onClick={() => this.setActiveItem(active - 1)} />
46+
<FaAngleLeft className={cx(theme['left-control'], 'carousel-left-icon')} onClick={() => this.setActiveItem(active - 1)} />
4747
}
4848
{data.map((item, index) => (
4949
<CarouselItem
@@ -60,13 +60,13 @@ class Carousel extends React.Component {
6060
<span
6161
key={`carousel-indicator-${index + 1}`}
6262
onClick={() => this.setActiveItem(index)}
63-
className={cx({ [theme.active]: active === index })}
63+
className={cx((active === index) ? `${theme.active} active` : '')}
6464
/>
6565
))}
6666
</div>
6767
{
6868
controls &&
69-
<FaAngleRight className={cx(theme['right-control'], theme['carousel-right-icon'])} onClick={() => this.setActiveItem(active + 1)} />
69+
<FaAngleRight className={cx(theme['right-control'], 'carousel-right-icon')} onClick={() => this.setActiveItem(active + 1)} />
7070
}
7171
</div>
7272
);

0 commit comments

Comments
 (0)