I am looking for tutorials or help on how to extend the page-object gem (github.com/cheezy/page-object) to support elements like the Angular mat-chip. This element is very similar to a check box, but isn't recognized as such by page-object. The closest things Ive found are here.
https://williamjamespowell.com/2012/12/01/extending-pageobjects/
https://williamjamespowell.com/2012/12/27/gxt-pageobject-widget-example/
These examples are 8 years old and I don't know if they would still work. Unfortunately that is the extent of what Ive found on how to extend page-object functionality.
What I would like to do is create a mat-chip class and wire it up so that I could use that just like I would checkbox from page-object. I just can't quite figure out what all the pieces are that have to be wired up.
I'm not an Angular person, so I stole a clickable mat-chip example from https://stackoverflow.com/a/47962183/1200545. Depending on your implementation, you may need to tweak the code below.
First off, Page-Object has a limitation when defining widgets that use a custom tag name - ie "mat-chip". To get around this, we will define an associated method/locator in Watir:
We can then create a widget and accessors in Page-Object:
You can then use the accessor, named "mat_chip", the same was as a checkbox:
Alternatively, you can use the mat-chip directly as a nested element: