pub struct DomElement {
pub id: String,
pub tag: String,
pub text_content: String,
pub attributes: HashMap<String, String>,
pub classes: Vec<String>,
pub visible: bool,
pub children: Vec<DomElement>,
}Expand description
Represents a DOM element for testing
Fields§
§id: StringElement ID
tag: StringElement tag name
text_content: StringText content
attributes: HashMap<String, String>Element attributes
classes: Vec<String>CSS classes
visible: boolWhether element is visible
children: Vec<DomElement>Child elements
Implementations§
Source§impl DomElement
impl DomElement
Sourcepub fn with_class(self, class: &str) -> Self
pub fn with_class(self, class: &str) -> Self
Adds a class
Sourcepub fn with_child(self, child: DomElement) -> Self
pub fn with_child(self, child: DomElement) -> Self
Adds a child element
Sourcepub fn set_visible(&mut self, visible: bool)
pub fn set_visible(&mut self, visible: bool)
Sets visibility
Sourcepub fn remove_class(&mut self, class: &str)
pub fn remove_class(&mut self, class: &str)
Removes a class
Trait Implementations§
Source§impl Clone for DomElement
impl Clone for DomElement
Source§fn clone(&self) -> DomElement
fn clone(&self) -> DomElement
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for DomElement
impl Debug for DomElement
Source§impl Default for DomElement
impl Default for DomElement
Source§impl PartialEq for DomElement
impl PartialEq for DomElement
Source§fn eq(&self, other: &DomElement) -> bool
fn eq(&self, other: &DomElement) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for DomElement
Auto Trait Implementations§
impl Freeze for DomElement
impl RefUnwindSafe for DomElement
impl Send for DomElement
impl Sync for DomElement
impl Unpin for DomElement
impl UnsafeUnpin for DomElement
impl UnwindSafe for DomElement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more