-
Notifications
You must be signed in to change notification settings - Fork 6.8k
feat(material-experimental): add test harness for button #16556
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
Conversation
<button id="fab" type="button" mat-fab>Fab button</button> | ||
<button id="mini-fab" type="button" mat-mini-fab>Mini Fab button</button> | ||
|
||
<a id="anchor-basic" type="button" mat-button>Basic anchor</a> |
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.
Links don't have a type
attribute.
* @dynamic | ||
*/ | ||
export class MatButtonHarness extends ComponentHarness { | ||
static hostSelector = [ |
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.
There's an array of these defined as BUTTON_HOST_ATTRIBUTES
. Could we export and re-use it here? Otherwise we'll have to remember to update this array if we add more button types.
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 really just want to change this to use e.g. .mat-button-base
, which was in another PR when I wrote this. Added a TODO
for now
} | ||
|
||
/** Gets a promise for the button's name. */ | ||
async getName(): Promise<string | null> { |
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 getting the name of a button common enough for it to have it's own method? We could expose a getAttribute
instead which would cover more cases.
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.
Removed. I was on the fence myself, having just left it in there from checkbox
* @dynamic | ||
*/ | ||
export class MatButtonHarness extends ComponentHarness { | ||
static hostSelector = [ |
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 as the comment above importing these
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.
Added a TODO
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.
LGTM aside from @crisbeto's comments. One question though: why do we put in the standard button harness into the mdc-button
entry-point?
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.
Comments addressed, added code to skip the disabled
click test for Edge
* @dynamic | ||
*/ | ||
export class MatButtonHarness extends ComponentHarness { | ||
static hostSelector = [ |
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 really just want to change this to use e.g. .mat-button-base
, which was in another PR when I wrote this. Added a TODO
for now
} | ||
|
||
/** Gets a promise for the button's name. */ | ||
async getName(): Promise<string | null> { |
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.
Removed. I was on the fence myself, having just left it in there from checkbox
* @dynamic | ||
*/ | ||
export class MatButtonHarness extends ComponentHarness { | ||
static hostSelector = [ |
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.
Added a TODO
33f61b0
to
c8414a7
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.
LGTM asside from comment nits
/** | ||
* Gets a `HarnessPredicate` that can be used to search for a button with specific attributes. | ||
* @param options Options for narrowing the search: | ||
* - `label` finds a button with specific label text. |
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.
update comment
/** | ||
* Gets a `HarnessPredicate` that can be used to search for a button with specific attributes. | ||
* @param options Options for narrowing the search: | ||
* - `label` finds a button with specific label text. |
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.
update comment
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.