Skip to main content

UiStmt

Enum UiStmt 

Source
pub enum UiStmt<'a> {
Show 30 variants Focus { selector: &'a Expr<'a>, }, Blur { selector: &'a Expr<'a>, }, Hover { selector: &'a Expr<'a>, }, ScrollTo { selector: &'a Expr<'a>, }, AddClass { class: &'a Expr<'a>, selector: &'a Expr<'a>, }, RemoveClass { class: &'a Expr<'a>, selector: &'a Expr<'a>, }, SelectText { selector: &'a Expr<'a>, }, CopyToClipboard { text: &'a Expr<'a>, }, Download { bytes: &'a Expr<'a>, name: &'a Expr<'a>, }, Navigate { url: &'a Expr<'a>, }, ReplaceUrl { url: &'a Expr<'a>, }, RaiseWindowEvent { event: &'a Expr<'a>, target: &'a Expr<'a>, value: &'a Expr<'a>, }, GoBack, SetTitle { title: &'a Expr<'a>, }, Save { value: &'a Expr<'a>, key: &'a Expr<'a>, }, Load { key: &'a Expr<'a>, var: Symbol, }, Forget { key: &'a Expr<'a>, }, Reload, Notify { message: &'a Expr<'a>, tone: Option<Symbol>, }, Publish { message: &'a Expr<'a>, topic: &'a Expr<'a>, }, Toggle { field: Symbol, }, CallStore { store: Symbol, action: Symbol, args: Vec<&'a Expr<'a>>, }, StopTimer { name: Symbol, }, StartTimer { name: Symbol, }, Click { selector: &'a Expr<'a>, }, Submit { selector: &'a Expr<'a>, }, Choose { value: &'a Expr<'a>, selector: &'a Expr<'a>, }, Press { key: &'a Expr<'a>, selector: Option<&'a Expr<'a>>, }, TypeInto { text: &'a Expr<'a>, selector: &'a Expr<'a>, }, Mount { component: Symbol, selector: Option<&'a Expr<'a>>, },
}
Expand description

What a component action can do to the page, the browser, storage or a store. Each is a sentence in the Actions: vocabulary; the selector forms take a selector TEXT or an Element.

Variants§

§

Focus

Focus SEL. — put focus on the element AND raise the focus event, so a When "#x" is focused: handler runs. Setting focus without raising it left that handler unreachable from any test.

Fields

§selector: &'a Expr<'a>
§

Blur

Blur SEL. — take focus off the element and raise blur.

★ ITS EVENT COULD BE WAITED FOR AND NOT CAUSED. blurred is one of the six predicates a handler may name, and nothing in the language could make one happen — so a page’s leave-the-field path (validate on blur, save a draft, close a menu) was unreachable from every test in the suite.

Fields

§selector: &'a Expr<'a>
§

Hover

Hover SEL. — raise mouseover.

★ IT WAS ALLOWLISTED WITH NOTHING BEHIND IT: Hover appeared in the gate that decides whether a sentence may open a UI statement, and parse_ui_statement had no branch for it, so the word was accepted into the gate and then fell out the bottom as “I expected a statement here”. Two hand-maintained halves of one table, each complete on its own.

Fields

§selector: &'a Expr<'a>
§

ScrollTo

Scroll to SEL.

Fields

§selector: &'a Expr<'a>
§

AddClass

Add class C to SEL.

Fields

§class: &'a Expr<'a>
§selector: &'a Expr<'a>
§

RemoveClass

Remove class C from SEL.

Fields

§class: &'a Expr<'a>
§selector: &'a Expr<'a>
§

SelectText

Select the text in SEL.

Fields

§selector: &'a Expr<'a>
§

CopyToClipboard

Copy TEXT to the clipboard.

Fields

§text: &'a Expr<'a>
§

Download

Download BYTES as "name.ext".

Fields

§bytes: &'a Expr<'a>
§name: &'a Expr<'a>
§

Navigate

Navigate to URL.

Fields

§url: &'a Expr<'a>
§

ReplaceUrl

Replace the URL with URL. — history replace, no new entry.

Fields

§url: &'a Expr<'a>
§

RaiseWindowEvent

Go back. Raise "offline". — cause a WINDOW event in a test.

★ ONE DRIVER FOR EVERY EVENT THAT HAPPENS TO THE PAGE RATHER THAN TO AN ELEMENT. Going offline, coming back online and the window resizing are not things a page does to itself and not things a visitor does to an element, so none of the element verbs can cause one — and a trigger no test can cause is a trigger nothing checks. Naming the event as TEXT means the next window event needs no new sentence.

Fields

§event: &'a Expr<'a>
§target: &'a Expr<'a>
§value: &'a Expr<'a>
§

GoBack

§

SetTitle

Set the title to TEXT.

Fields

§title: &'a Expr<'a>
§

Save

Save VALUE as "key".

Fields

§value: &'a Expr<'a>
§key: &'a Expr<'a>
§

Load

Load "key" into FIELD.

Fields

§key: &'a Expr<'a>
§

Forget

Forget "key".

Fields

§key: &'a Expr<'a>
§

Reload

Reload the page. — every component instance, listener and mounted root goes; browser storage stays. What a persisted store survives and a local one does not.

§

Notify

Notify MESSAGE [as success|error].

Fields

§message: &'a Expr<'a>
§

Publish

Publish MESSAGE on TOPIC. — send on a relay topic.

★ THE OUTBOUND HALF OF A CONSTRUCT THAT SHIPPED WITH ONLY ITS INBOUND HALF. When a message arrives on "t": subscribes, and nothing in the language could publish — so a page could hear a server and never answer it, and two tabs of one app could not talk. The relay had the other side complete the whole time (RelayFrame::Publish fans out to every local subscriber and gossips on to native nodes); what was missing was a sentence.

It delivers to THIS page’s own subscribers as well as sending the frame, so a publish means one thing wherever the page runs: every handler on the topic hears it exactly once. The relay excludes the originating connection, so the local delivery is not a second copy.

Fields

§message: &'a Expr<'a>
§topic: &'a Expr<'a>
§

Toggle

Toggle FIELD. — a Bool state field.

Fields

§field: Symbol
§

CallStore

Call <Store>'s <action> [with a and b].

Fields

§store: Symbol
§action: Symbol
§args: Vec<&'a Expr<'a>>
§

StopTimer

Stop the timer NAME.

Fields

§name: Symbol
§

StartTimer

Start the timer NAME. — (re)start a named timer from a whole period, its period read from its sentence now; a running timer restarts, a stopped one runs again.

Fields

§name: Symbol
§

Click

Click SEL. — fire a click on the element the selector names.

Fields

§selector: &'a Expr<'a>
§

Submit

Submit SEL. — submit a form, as a user pressing the button would.

Fields

§selector: &'a Expr<'a>
§

Choose

Choose VALUE in SEL. — pick an option in a <select>.

Its own verb because a dropdown is neither typed into nor clicked; without one a test can only reach a <select> by faking the event some other control raises.

Fields

§value: &'a Expr<'a>
§selector: &'a Expr<'a>
§

Press

Press KEY [in SEL]. — a key press, on an element or on the page.

Fields

§key: &'a Expr<'a>
§selector: Option<&'a Expr<'a>>
§

TypeInto

Type TEXT into SEL. — type into a bound input, as a user would.

Fields

§text: &'a Expr<'a>
§selector: &'a Expr<'a>
§

Mount

Mount <Component> [at "#sel"]. — create the component’s root instance and render it. (The legacy indentation dialect keeps its own synthesized-render lowering.)

Fields

§component: Symbol
§selector: Option<&'a Expr<'a>>

Implementations§

Source§

impl<'a> UiStmt<'a>

Source

pub fn exprs(&self) -> Vec<&'a Expr<'a>>

Every expression this statement evaluates — the traversal surface for the analyses.

Source

pub fn writes(&self) -> Option<Symbol>

The binding this statement WRITES, if any (Load … into x, Toggle done).

Source

pub fn role(&self) -> Role

Where this statement may be written: driving a page from a ## Main/## Test body, inside a component’s Actions:, or either.

Trait Implementations§

Source§

impl<'a> Clone for UiStmt<'a>

Source§

fn clone(&self) -> UiStmt<'a>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Debug for UiStmt<'a>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for UiStmt<'a>

§

impl<'a> RefUnwindSafe for UiStmt<'a>

§

impl<'a> Send for UiStmt<'a>

§

impl<'a> Sync for UiStmt<'a>

§

impl<'a> Unpin for UiStmt<'a>

§

impl<'a> UnsafeUnpin for UiStmt<'a>

§

impl<'a> UnwindSafe for UiStmt<'a>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,