Skip to main content

WasmDriver

Struct WasmDriver 

Source
pub struct WasmDriver { /* private fields */ }
Expand description

WASM Driver wrapping calculator and mock DOM

Implementations§

Source§

impl WasmDriver

Source

pub fn new() -> Self

Creates a new WASM driver

Source

pub fn with_validator(validator: AnomalyValidator) -> Self

Creates a WASM driver with custom Anomaly validator

Source

pub fn with_calculator_and_dom(calculator: WasmCalculator, dom: MockDom) -> Self

Creates a WASM driver with existing calculator and DOM

Source

pub fn calculator(&self) -> &WasmCalculator

Returns a reference to the calculator

Source

pub fn calculator_mut(&mut self) -> &mut WasmCalculator

Returns a mutable reference to the calculator

Source

pub fn dom(&self) -> &MockDom

Returns a reference to the DOM

Source

pub fn dom_mut(&mut self) -> &mut MockDom

Returns a mutable reference to the DOM

Source

pub fn type_input(&mut self, text: &str)

Simulates typing into the input field

Source

pub fn click_equals(&mut self)

Simulates clicking the equals button

Source

pub fn click_clear(&mut self)

Simulates clicking the clear button

Source

pub fn press_enter(&mut self)

Simulates pressing Enter key

Source

pub fn press_escape(&mut self)

Simulates pressing Escape key

Source

pub fn press_backspace(&mut self)

Simulates pressing Backspace key

Source

pub fn result_element_text(&self) -> Option<&str>

Gets the result element’s text

Source

pub fn input_element_text(&self) -> Option<&str>

Gets the input element’s text

Source

pub fn status_element_text(&self) -> Option<&str>

Gets the status element’s text

Source

pub fn history_list_items(&self) -> Vec<String>

Gets history list items

Trait Implementations§

Source§

impl CalculatorDriver for WasmDriver

Source§

fn enter_expression(&mut self, expr: &str) -> CalcResult<()>

Enters an expression into the calculator
Source§

fn get_result(&self) -> String

Gets the current result display
Source§

fn get_input(&self) -> String

Gets the current input expression
Source§

fn clear(&mut self)

Clears the calculator state
Source§

fn get_history(&self) -> Vec<HistoryItem>

Gets history entries (newest first)
Source§

fn get_jidoka_status(&self) -> Vec<String>

Gets Anomaly status messages
Source§

impl Debug for WasmDriver

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for WasmDriver

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.