novdom_testing/component_should
A module for testing novdom components.
Use it in combination with novdom_testing/testing
to test initilize tests and render components.
Functions
pub fn attribute(component: Component, name: String) -> String
Returns the value of an attribute
pub fn be_hidden(component: Component) -> Component
Check if a component is hidden from the user. This is the opposite of be_visible
pub fn be_visible(component: Component) -> Component
Check if a component is visible to the user.
pub fn exclusively_show_text(
component: Component,
text: String,
) -> Component
Check if a component exclusively shows a specific text.
pub fn have_attribute(
component: Component,
attribute: Parameter,
) -> Component
Check if a component has a specific attribute.
pub fn have_child(
parent: Component,
child: Component,
) -> Component
Check if a component has a specific child.
pub fn have_listener(
component: Component,
listener_fn: fn(fn(Event) -> Nil) -> Parameter,
) -> Component
Check if a component has a specific listener (callback is not checked).
If a specific callback needs to be checked, use have_listener_callback
.
pub fn have_listener_callback(
component: Component,
listener: Parameter,
) -> Component
Check if a component has a specific listener with a specific callback.
If only the listener needs to be checked, use have_listener
.
pub fn have_tag(component: Component, tag: String) -> Component
Check if a component has a specific HTML tag.
pub fn not_have_attribute(
component: Component,
attribute: Parameter,
) -> Component
Check if a component does not have a specific attribute. This is the opposite of have_attribute
pub fn not_have_child(
parent: Component,
child: Component,
) -> Component
Check if a component does not have a specific child. This is the opposite of have_child
pub fn not_have_listener(
component: Component,
listener_fn: fn(fn(Event) -> Nil) -> Parameter,
) -> Component
Check if a component does not have a specific listener. This is the opposite of have_listener
pub fn not_have_listener_callback(
component: Component,
listener: Parameter,
) -> Component
Check if a component does not have a specific listener with a specific callback. This is the opposite of have_listener_callback
pub fn not_have_tag(
component: Component,
tag: String,
) -> Component
Check if a component does not have a specific HTML tag. This is the opposite of have_tag
pub fn not_show_text(
component: Component,
text: String,
) -> Component
Check if a component does not show a specific text. This is the opposite of show_text