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.
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.
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.
ScrollTo
Scroll to SEL.
AddClass
Add class C to SEL.
RemoveClass
Remove class C from SEL.
SelectText
Select the text in SEL.
CopyToClipboard
Copy TEXT to the clipboard.
Download
Download BYTES as "name.ext".
Navigate to URL.
ReplaceUrl
Replace the URL with URL. — history replace, no new entry.
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.
GoBack
SetTitle
Set the title to TEXT.
Save
Save VALUE as "key".
Load
Load "key" into FIELD.
Forget
Forget "key".
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].
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.
Toggle
Toggle FIELD. — a Bool state field.
CallStore
Call <Store>'s <action> [with a and b].
StopTimer
Stop the timer NAME.
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.
Click
Click SEL. — fire a click on the element the selector names.
Submit
Submit SEL. — submit a form, as a user pressing the button would.
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.
Press
Press KEY [in SEL]. — a key press, on an element or on the page.
TypeInto
Type TEXT into SEL. — type into a bound input, as a user would.
Mount
Mount <Component> [at "#sel"]. — create the component’s root instance and render it.
(The legacy indentation dialect keeps its own synthesized-render lowering.)
Implementations§
Trait Implementations§
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> 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.