-
Notifications
You must be signed in to change notification settings - Fork 189
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
Conversation
28bb680
to
4a50ad1
Compare
expect(val).to.eq(true); | ||
done(); | ||
}); | ||
res.catch(e => fail(e)); |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// 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' |
There was a problem hiding this comment.
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) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) => { |
There was a problem hiding this comment.
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
?
extensions/ql-vscode/src/helpers.ts
Outdated
if (chosenItem === urlItem) { | ||
await env.openExternal(Uri.parse(url, true)); | ||
} | ||
} while (chosenItem === urlItem); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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".
There was a problem hiding this 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.
extensions/ql-vscode/src/helpers.ts
Outdated
if (chosenItem === urlItem) { | ||
await env.openExternal(Uri.parse(url, true)); | ||
} | ||
} while (chosenItem === urlItem); |
There was a problem hiding this comment.
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".
4a50ad1
to
50b107b
Compare
50b107b
to
05d98d7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lovely.
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
@github/docs-content-dsp
has been cc'd in all issues for UI or other user-facing changes made by this pull request.