@@ -4,6 +4,7 @@ use crate::{
44 error:: QueryError ,
55 queries:: * ,
66 types:: { Matcher , MatcherOptions , SelectorMatcherOptions , WaitForOptions } ,
7+ ByRoleMatcher , ByRoleOptions ,
78} ;
89
910pub fn get_queries_for_element ( element : HtmlElement ) -> BoundFunctions {
@@ -15,10 +16,10 @@ pub struct BoundFunctions {
1516}
1617
1718macro_rules! queries_for_element {
18- ( $( ( $name: ident, $options_type: ty) ) ,* , ) => {
19+ ( $( ( $name: ident, $matcher_type : ty , $ options_type: ty) ) ,* , ) => {
1920 paste:: paste! {
2021 impl BoundFunctions {
21- $( pub fn [ < find_by_ $name >] <M : Into <Matcher >>(
22+ $( pub fn [ < find_by_ $name >] <M : Into <$matcher_type >>(
2223 & self ,
2324 matcher: M ,
2425 options: $options_type,
@@ -27,7 +28,7 @@ macro_rules! queries_for_element {
2728 [ < find_by_ $name >] ( & self . element, matcher, options, wait_for_options)
2829 } ) *
2930
30- $( pub fn [ < find_all_by_ $name >] <M : Into <Matcher >>(
31+ $( pub fn [ < find_all_by_ $name >] <M : Into <$matcher_type >>(
3132 & self ,
3233 matcher: M ,
3334 options: $options_type,
@@ -36,31 +37,31 @@ macro_rules! queries_for_element {
3637 [ < find_all_by_ $name >] ( & self . element, matcher, options, wait_for_options)
3738 } ) *
3839
39- $( pub fn [ < get_by_ $name >] <M : Into <Matcher >>(
40+ $( pub fn [ < get_by_ $name >] <M : Into <$matcher_type >>(
4041 & self ,
4142 matcher: M ,
4243 options: $options_type,
4344 ) -> Result <Option <HtmlElement >, QueryError > {
4445 [ < get_by_ $name >] ( & self . element, matcher, options)
4546 } ) *
4647
47- $( pub fn [ < get_all_by_ $name >] <M : Into <Matcher >>(
48+ $( pub fn [ < get_all_by_ $name >] <M : Into <$matcher_type >>(
4849 & self ,
4950 matcher: M ,
5051 options: $options_type,
5152 ) -> Result <Vec <HtmlElement >, QueryError > {
5253 [ < get_all_by_ $name >] ( & self . element, matcher, options)
5354 } ) *
5455
55- $( pub fn [ < query_by_ $name >] <M : Into <Matcher >>(
56+ $( pub fn [ < query_by_ $name >] <M : Into <$matcher_type >>(
5657 & self ,
5758 matcher: M ,
5859 options: $options_type,
5960 ) -> Result <Option <HtmlElement >, QueryError > {
6061 [ < query_by_ $name >] ( & self . element, matcher, options)
6162 } ) *
6263
63- $( pub fn [ < query_all_by_ $name >] <M : Into <Matcher >>(
64+ $( pub fn [ < query_all_by_ $name >] <M : Into <$matcher_type >>(
6465 & self ,
6566 matcher: M ,
6667 options: $options_type,
@@ -73,11 +74,12 @@ macro_rules! queries_for_element {
7374}
7475
7576queries_for_element ! (
76- ( alt_text, MatcherOptions ) ,
77- ( display_value, MatcherOptions ) ,
78- ( label_text, SelectorMatcherOptions ) ,
79- ( placeholder_text, MatcherOptions ) ,
80- ( test_id, MatcherOptions ) ,
81- ( text, SelectorMatcherOptions ) ,
82- ( title, MatcherOptions ) ,
77+ ( alt_text, Matcher , MatcherOptions ) ,
78+ ( display_value, Matcher , MatcherOptions ) ,
79+ ( label_text, Matcher , SelectorMatcherOptions ) ,
80+ ( placeholder_text, Matcher , MatcherOptions ) ,
81+ ( role, ByRoleMatcher , ByRoleOptions ) ,
82+ ( test_id, Matcher , MatcherOptions ) ,
83+ ( text, Matcher , SelectorMatcherOptions ) ,
84+ ( title, Matcher , MatcherOptions ) ,
8385) ;
0 commit comments