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

Add a 'More Information' option in telemetry popup #742

Merged
merged 1 commit into from
Feb 2, 2021

Conversation

aeisenberg
Copy link
Contributor

@aeisenberg aeisenberg commented Feb 1, 2021

This commit moves the URL in the text of the telemetry pop up to a
separate button. Clicking on the button will automatically open the
link in the browser.

Also, adds unit tests for the open dialog helper functions.

Checklist

  • CHANGELOG.md has been updated to incorporate all user visible changes made by this pull request.
  • [n/a] Issues have been created for any UI or other user-facing changes made by this pull request.
  • [n/a] @github/docs-content-dsp has been cc'd in all issues for UI or other user-facing changes made by this pull request.

@aeisenberg aeisenberg force-pushed the aesienberg/show-info branch 2 times, most recently from 28bb680 to 4a50ad1 Compare February 2, 2021 17:42
expect(val).to.eq(true);
done();
});
res.catch(e => fail(e));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why isn't this catch chained onto the then above?

});

it('should show a binary choice dialog and return `yes`', (done) => {
// pretend user clicks on the url twice and then 'yes'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment doesn't match the onCall(0) - here you're just testing a direct yes click right?

});

it('should show a binary choice dialog and return `no`', (done) => {
// pretend user clicks on the url twice and then 'yes'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar: just a direct no click

// pretend user clicks on the url twice and then 'yes'
showInformationMessageSpy.onCall(0).resolvesArg(2);
showInformationMessageSpy.onCall(1).resolvesArg(2);
showInformationMessageSpy.onCall(0).resolvesArg(3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the last one be onCall(2)? Otherwise you're just resetting the spy.

// pretend user clicks on the url twice and then 'yes'
showInformationMessageSpy.onCall(0).resolvesArg(2);
showInformationMessageSpy.onCall(1).resolvesArg(2);
showInformationMessageSpy.onCall(0).resolvesArg(4);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same question

});

it('should show a binary choice dialog with a url and return `no`', (done) => {
// pretend user clicks on the url twice and then 'yes'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// pretend user clicks on the url twice and then 'yes'
// pretend user clicks on the url twice and then 'no'

});

it('should show an info dialog and confirm the action', (done) => {
// pretend user clicks on the url twice and then 'yes'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below, please update the comments

res.catch(e => fail(e));
});

it('should show an info dialog and not confirm the', (done) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('should show an info dialog and not confirm the', (done) => {
it('should show an info dialog and not confirm the action if dismissed', (done) => {

res.catch(e => fail(e));
});

it('should show a binary choice dialog with a url and return `no`', (done) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also test for the sequence url, url, dismissed?

if (chosenItem === urlItem) {
await env.openExternal(Uri.parse(url, true));
}
} while (chosenItem === urlItem);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading this I am worried about it creating dialogs in a loop.
This works for modal dialogs because VS Code doesn't create a fresh dialog each time right?

If we used this helper function in a non-modal way would you get repeated popups?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm...since we're not using this for non-modals, I'll just remove the option.

And to be safe, I'll add an escape hatch where if someone clicks the "More Info", say, 5 times, the modal is closed and value returned is "no".

Copy link
Contributor Author

@aeisenberg aeisenberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the detailed review of the tests. I'll address your comments.

if (chosenItem === urlItem) {
await env.openExternal(Uri.parse(url, true));
}
} while (chosenItem === urlItem);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm...since we're not using this for non-modals, I'll just remove the option.

And to be safe, I'll add an escape hatch where if someone clicks the "More Info", say, 5 times, the modal is closed and value returned is "no".

Copy link
Contributor

@adityasharad adityasharad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely.

@aeisenberg aeisenberg merged commit 0e4ae83 into github:main Feb 2, 2021
@aeisenberg aeisenberg deleted the aesienberg/show-info branch February 2, 2021 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants