-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
795033b
commit b4c74d2
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
mod alt_text; | ||
mod display_value; | ||
mod placeholder_text; | ||
|
||
pub use alt_text::*; | ||
pub use display_value::*; | ||
pub use placeholder_text::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
use web_sys::HtmlElement; | ||
|
||
use crate::{ | ||
build_queries, | ||
error::QueryError, | ||
query_all_by_attribute, | ||
types::{Matcher, MatcherOptions}, | ||
}; | ||
|
||
pub fn _query_all_by_placeholder_text<M: Into<Matcher>>( | ||
container: &HtmlElement, | ||
text: M, | ||
options: MatcherOptions, | ||
) -> Result<Vec<HtmlElement>, QueryError> { | ||
query_all_by_attribute("placeholder".to_string(), container, text, options) | ||
} | ||
|
||
fn get_multiple_error(_container: &HtmlElement, text: Matcher) -> String { | ||
format!("Found multiple elements with the placeholder text: {text}") | ||
} | ||
|
||
fn get_missing_error(_container: &HtmlElement, text: Matcher) -> String { | ||
format!("Unable to find an element with the placeholder text: {text}") | ||
} | ||
|
||
build_queries!( | ||
_query_all_by_placeholder_text, | ||
get_multiple_error, | ||
get_missing_error, | ||
placeholder_text | ||
); | ||
|
||
pub use internal::{ | ||
find_all_by_placeholder_text, find_by_placeholder_text, get_all_by_placeholder_text, | ||
get_by_placeholder_text, query_all_by_placeholder_text, query_by_placeholder_text, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters