嗨,我有以下代码,我需要使用按钮和链接来更改窗口位置。
export default class CampaignAdSection extends Component {
constructor(props) {
super(props)
this.customiseClickable = this.customiseClickable.bind(this);
}
customiseClickable(e) {
this.props.history.push(`/customize/aus`);
}
render() {
let { packages, history, campaignDetails } = this.props;
return (
<div className="xs-text-center">
<button
type="button"
className="btn btn-primary pkg-adbtn"
onClick={e => this.customiseClickable(e)}
>
Trip
</button>{' '}
<b className="color-grey-secondary">
{' '}
or,{' '}
<Link
to={
`${
history.location.pathname.indexOf('request-callback') > 0
? history.location.pathname.split('request-callback')[0]
: history.location.pathname + '/'
}request-callback` +
`${history.location.search ? history.location.search : ''}`
}
className="tracker-talkbtn"
>
Expert
</Link>
</b>
</div>
);
}
}
根据我的代码,它一直在工作。但是我如何为此添加规格?我是反应测试的初学者。您能对此提供一些想法吗?
我要单击该按钮并检查位置是否已更改?