Skip to content

Commit

Permalink
Rename prop testSubject to data-test-subj.
Browse files Browse the repository at this point in the history
  • Loading branch information
cjcenizal committed Mar 28, 2017
1 parent 6d724fc commit a9a4652
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 32 deletions.
20 changes: 10 additions & 10 deletions ui_framework/components/button/__snapshots__/button.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ exports[`KuiButton Props className renders the classes 1`] = `
</button>
`;

exports[`KuiButton Props data-test-subj is rendered 1`] = `
<button
className="kuiButton"
data-test-subj="test subject string"
onClick={[Function]}
>
<span />
</button>
`;

exports[`KuiButton Props icon is rendered with children 1`] = `
<button
className="kuiButton kuiButton--iconText"
Expand Down Expand Up @@ -106,16 +116,6 @@ exports[`KuiButton Props isLoading renders a spinner 1`] = `
</button>
`;

exports[`KuiButton Props testSubject is rendered 1`] = `
<button
className="kuiButton"
data-test-subj="test subject string"
onClick={[Function]}
>
<span />
</button>
`;

exports[`KuiButton Props type basic renders the basic class 1`] = `
<button
class="kuiButton kuiButton--basic"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,16 @@ exports[`KuiLinkButton Props className renders the classes 1`] = `
</a>
`;

exports[`KuiLinkButton Props data-test-subj is rendered 1`] = `
<a
className="kuiButton"
data-test-subj="test subject string"
onClick={[Function]}
>
<span />
</a>
`;

exports[`KuiLinkButton Props href is rendered 1`] = `
<a
className="kuiButton"
Expand Down Expand Up @@ -126,16 +136,6 @@ exports[`KuiLinkButton Props target is rendered 1`] = `
</a>
`;

exports[`KuiLinkButton Props testSubject is rendered 1`] = `
<a
className="kuiButton"
data-test-subj="test subject string"
onClick={[Function]}
>
<span />
</a>
`;

exports[`KuiLinkButton Props type basic renders the basic class 1`] = `
<a
class="kuiButton kuiButton--basic"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@ exports[`KuiSubmitButton Props className renders the classes 1`] = `
/>
`;

exports[`KuiSubmitButton Props isDisabled sets the disabled attribute 1`] = `
exports[`KuiSubmitButton Props data-test-subj is rendered 1`] = `
<input
className="kuiButton"
disabled={true}
data-test-subj="test subject string"
onClick={[Function]}
type="submit"
/>
`;

exports[`KuiSubmitButton Props testSubject is rendered 1`] = `
exports[`KuiSubmitButton Props isDisabled sets the disabled attribute 1`] = `
<input
className="kuiButton"
data-test-subj="test subject string"
disabled={true}
onClick={[Function]}
type="submit"
/>
Expand Down
4 changes: 2 additions & 2 deletions ui_framework/components/button/button.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const BUTTON_TYPES = [

const commonPropTypes = {
type: PropTypes.oneOf(BUTTON_TYPES),
testSubject: PropTypes.string,
'data-test-subj': PropTypes.string,
isDisabled: PropTypes.bool,
onClick: PropTypes.func,
data: PropTypes.any,
Expand Down Expand Up @@ -92,7 +92,7 @@ const getOnClick = props => (
);

const getCommonProps = (props, icon) => ({
'data-test-subj': props.testSubject,
'data-test-subj': props['data-test-subj'],
className: getClassName(props, icon),
onClick: getOnClick(props),
disabled: props.isDisabled,
Expand Down
4 changes: 2 additions & 2 deletions ui_framework/components/button/button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ describe('KuiButton', () => {
});
});

describe('testSubject', () => {
describe('data-test-subj', () => {
test('is rendered', () => {
const $button = shallow(
<KuiButton testSubject="test subject string" />
<KuiButton data-test-subj="test subject string" />
);

expect($button)
Expand Down
4 changes: 2 additions & 2 deletions ui_framework/components/button/link_button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ describe('KuiLinkButton', () => {
});
});

describe('testSubject', () => {
describe('data-test-subj', () => {
test('is rendered', () => {
const $button = shallow(
<KuiLinkButton testSubject="test subject string" />
<KuiLinkButton data-test-subj="test subject string" />
);

expect($button)
Expand Down
4 changes: 2 additions & 2 deletions ui_framework/components/button/submit_button.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ describe('KuiSubmitButton', () => {
});
});

describe('testSubject', () => {
describe('data-test-subj', () => {
test('is rendered', () => {
const $button = shallow(
<KuiSubmitButton testSubject="test subject string" />
<KuiSubmitButton data-test-subj="test subject string" />
);

expect($button)
Expand Down

0 comments on commit a9a4652

Please sign in to comment.