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

Toast action can be a link #611

Merged
merged 5 commits into from
Feb 3, 2017
Merged

Toast action can be a link #611

merged 5 commits into from
Feb 3, 2017

Conversation

giladgray
Copy link
Contributor

@giladgray giladgray commented Feb 3, 2017

Changes proposed in this pull request:

  • toast action accepts ILinkProps (href and target), uses AnchorButton
  • refactor toast tests to use a little wrapper function that find the action and dismiss buttons. this puts the queries in one place, if we need to change them in the future.
  • ban describe.only and it.only in TSLint for the same reason as console.log: useful in local development but problematic in real environments.

@blueprint-bot
Copy link

revert describe.only (and TSLint ban it)

Preview: docs
Coverage: core | datetime

"ban": [true, ["Object", "assign", "use TS2.1 object spread { ...a, ...b }"]],
"ban": [true,
["Object", "assign", "use TS2.1 object spread { ...a, ...b }"],
["describe", "only"],
Copy link
Contributor

Choose a reason for hiding this comment

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

nice 👍

function wrap(toast: JSX.Element) {
const root = shallow(toast);
return {
action: root.find(AnchorButton),
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like we should be querying for components by class rather than tagname, hm?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

class isn't as easy as you'd hope. with shallow mounting you need the exact string, or a custom predicate. with full mounting, querying for ".pt-button" gives you the HTML element, not the React component, so you can't do React-y things to it. 😢

@giladgray giladgray merged commit 8668625 into master Feb 3, 2017
@giladgray giladgray deleted the gg/toast-links branch February 3, 2017 07:05
@@ -32,11 +32,13 @@ export class ToastExample extends BaseExample<IToasterProps> {

private TOAST_BUILDERS: IToastDemo[] = [{
action: {
href: "https://www.google.com/search?q=toast&source=lnms&tbm=isch",
target: "_blank",
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this optional or will it always open in a new tab? Prefer to give users the option but not be opinionated

Copy link
Contributor Author

Choose a reason for hiding this comment

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

optional. this is just an example usage.

@giladgray giladgray mentioned this pull request Feb 3, 2017
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.

None yet

4 participants