Fix Bug 1515026 - Send telemetry ping for dismiss events (#4634)
This commit is contained in:
Родитель
8c8697e70f
Коммит
4ec4f4bb06
|
@ -5,6 +5,7 @@ export class SnippetBase extends React.PureComponent {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.onBlockClicked = this.onBlockClicked.bind(this);
|
||||
this.onDismissClicked = this.onDismissClicked.bind(this);
|
||||
}
|
||||
|
||||
onBlockClicked() {
|
||||
|
@ -15,6 +16,14 @@ export class SnippetBase extends React.PureComponent {
|
|||
this.props.onBlock();
|
||||
}
|
||||
|
||||
onDismissClicked() {
|
||||
if (this.props.provider !== "preview") {
|
||||
this.props.sendUserActionTelemetry({event: "DISMISS", id: this.props.UISurface});
|
||||
}
|
||||
|
||||
this.props.onDismiss();
|
||||
}
|
||||
|
||||
renderDismissButton() {
|
||||
if (this.props.footerDismiss) {
|
||||
return (
|
||||
|
@ -22,7 +31,7 @@ export class SnippetBase extends React.PureComponent {
|
|||
<div className="footer-content">
|
||||
<button
|
||||
className="ASRouterButton secondary"
|
||||
onClick={this.props.onDismiss}>
|
||||
onClick={this.onDismissClicked}>
|
||||
{this.props.content.scene2_dismiss_button_text}
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
@ -121,6 +121,13 @@ describe("SubmitFormSnippet", () => {
|
|||
|
||||
assert.calledOnce(wrapper.props().onDismiss);
|
||||
});
|
||||
it("should send a DISMISS event ping", () => {
|
||||
wrapper.setState({expanded: true});
|
||||
|
||||
wrapper.find(".ASRouterButton.secondary").simulate("click");
|
||||
|
||||
assert.equal(wrapper.props().sendUserActionTelemetry.firstCall.args[0].event, "DISMISS");
|
||||
});
|
||||
it("should render hidden inputs + email input", () => {
|
||||
wrapper.setState({expanded: true});
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче