-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
somewhat convenient that they're now different elements
"ban": [true, ["Object", "assign", "use TS2.1 object spread { ...a, ...b }"]], | ||
"ban": [true, | ||
["Object", "assign", "use TS2.1 object spread { ...a, ...b }"], | ||
["describe", "only"], |
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.
nice 👍
function wrap(toast: JSX.Element) { | ||
const root = shallow(toast); | ||
return { | ||
action: root.find(AnchorButton), |
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.
I feel like we should be querying for components by class rather than tagname, hm?
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.
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. 😢
@@ -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", |
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.
Is this optional or will it always open in a new tab? Prefer to give users the option but not be opinionated
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.
optional. this is just an example usage.
Changes proposed in this pull request:
action
acceptsILinkProps
(href and target), usesAnchorButton
describe.only
andit.only
in TSLint for the same reason as console.log: useful in local development but problematic in real environments.