Skip to content

Commit

Permalink
Fixed the copy to clipboard failing test [#151224876]
Browse files Browse the repository at this point in the history
Signed-off-by: Stephane Jolicoeur <sjolicoeur@pivotal.io>
  • Loading branch information
Ming Xiao authored and sjolicoeur committed Sep 20, 2017
1 parent fb1c9fd commit 82cfc9a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ describe('CopyToClipboard', () => {
tooltip: 'Copied in'
});

$('.copy-to-clipboard').simulate('click');
$('.copy-to-clipboard .tooltip').simulate('click');

expect('.tooltip-container').toHaveClass('tooltip-container-visible');
expect('.tooltip-content').toHaveText('Copied in');
Expand Down
12 changes: 7 additions & 5 deletions src/react/copy-to-clipboard/copy-to-clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class CopyToClipboard extends React.PureComponent {
};

render() {
const {children, className, text, onClick, getWindow, tooltip = "Copied", ...others} = this.props;
const {children, text, onClick, getWindow, tooltip = "Copied", ...others} = this.props;
const obj = {props: this.props, text: null};

const anchorProps = mergeProps(others, {
Expand All @@ -37,11 +37,13 @@ export class CopyToClipboard extends React.PureComponent {
role: 'button'
});

return (<TooltipTrigger {...{className, tooltip, trigger: "click"}}>
return (
<a {...anchorProps}>
<span className="sr-only" ref={ref => obj.text = ref}>{text}</span>
{children}
<TooltipTrigger {...{tooltip, trigger: "click"}}>
<span className="sr-only" ref={ref => obj.text = ref}>{text}</span>
{children}
</TooltipTrigger>
</a>
</TooltipTrigger>);
);
}
}

0 comments on commit 82cfc9a

Please sign in to comment.