Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Button): remove extra close icon in btn-close #2318

Merged
merged 1 commit into from Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 0 additions & 4 deletions src/Button.js
Expand Up @@ -59,10 +59,6 @@ class Button extends React.Component {
...attributes
} = this.props;

if (close && typeof attributes.children === 'undefined') {
attributes.children = <span aria-hidden>×</span>;
}

const btnOutlineColor = `btn${outline ? '-outline' : ''}-${color}`;

const classes = mapToCssModules(classNames(
Expand Down
14 changes: 0 additions & 14 deletions src/__tests__/Button.spec.js
Expand Up @@ -97,20 +97,6 @@ describe('Button', () => {
expect(block.hasClass('d-block w-100')).toBe(true);
});

it('should render close icon utility with default props', () => {
const times = '×'; // unicode: U+00D7 MULTIPLICATION SIGN
const expectedInnerHTML = `<span aria-hidden="true">${times}</span>`;

const wrapper = shallow(<Button close />);
const actualInnerHTML = wrapper.children().html();

expect(wrapper.find('.btn-close').length).toBe(1);
expect(wrapper.find('.btn').length).toBe(0);
expect(wrapper.find('.btn-secondary').length).toBe(0);
expect(wrapper.find('button').prop('aria-label')).toMatch(/close/i);
expect(actualInnerHTML).toBe(expectedInnerHTML);
});

it('should render close icon with custom child and props', () => {
const testChild = 'close this thing';
const wrapper = shallow(<Button close>{testChild}</Button>);
Expand Down
4 changes: 2 additions & 2 deletions stories/examples/ButtonCloseIcon.js
@@ -1,5 +1,5 @@
import React, { Component } from 'react';
import { Button, Card, CardBody, CardText, CardGroup, CardTitle } from 'reactstrap';
import React from 'react';
import { Button } from 'reactstrap';

const Example = (props) => (
<div>
Expand Down