frontend-testing
Skill2 starsChanged 9 months agoMITView on GitHub
Lustre frontend testing — model, update, and behavior. No styling tests unless explicitly requested.
8 other projects use a version of this.
Adopted by
Most recently taken up by
- langgenius/difytheir own version, first seen Nov 24, 2026
- theexperiencecompany/gaiatheir own version, first seen Sep 17, 2026
- factor241/ketos-bottheir own version, first seen Sep 3, 2026
- peakdong68/my-skillstheir own version, first seen Aug 29, 2026
- bestdeejay-design/agent-skillstheir own version, first seen Aug 9, 2026
- lobomfz/skillstheir own version, first seen Apr 28, 2026
Other versions8 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 8
- langgenius/dify★ 162ksame name
- theexperiencecompany/gaia★ 306same name
- nilecui/SkillsBase★ 27same name
- bestdeejay-design/agent-skills★ 5same name
- lobomfz/skills★ 2same name
- factor241/ketos-bot★ 1same name
- LiuRoi/skills★ 1same name
- peakdong68/my-skills★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository7 other files it gives its agents.
- skills/pg-gleam/CLAUDE.mdCLAUDE.md
- api-gleamSkill
- gleam-backendSkill
- gleamSkill
- lustreSkill
- pg-gleamSkill
- tddSkill
The file
We split this skill into the rules it gives an agent
1 rule. 0 are common, 0 are distinctive, and 1 is very specific to this project.
0
Common
Most of the 8 edited versions we read keep these.
0
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 43
Level 2b — Attribute assertions: Use simulate.view() + query.has()/query.find() to verify DOM attributes (ARIA, data-state, disabled) …
“Common” is measured: kept by at least 6 in 10 of the 8 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Frontend Testing
Lustre frontend testing — model, update, and behavior. No styling tests unless explicitly requested.
Iron Law
Frontend tests verify model, update, and behavior — never CSS classes, Tailwind utilities, or visual styling. Styling tests are only written when the user explicitly requests them.
What to test (always)
- Model state — initial state, state after messages, derived state
- Update logic — message → model transformation, effect triggers
- User interactions — clicks, keyboard events, form input produce correct messages
- Conditional rendering — elements appear/disappear based on model state
- ARIA and data attributes — accessibility semantics (
aria-checked,data-state) - Text content — labels, error messages, computed display values
What to never test (unless explicitly asked)
- CSS class names (
query.class("flex"),query.class("bg-brand-100")) - Tailwind utilities or design tokens in class lists
- Layout structure (grid columns, flex direction)
- Color values, spacing, typography classes
- Component wrapper styling (card backgrounds, border radius)
Why: CSS is a moving target. Tailwind classes change during design iterations. Tests coupled to class names break on every visual refresh without catching real bugs. Behavioral tests survive redesigns intact.
Simulate limitations (know before you test)
- Effects are discarded —
simulateruns no effects. FFI calls, HTTP requests, and timers never fire. Feed effect results back manually withsimulate.message(). simulate.click()bypasses browser disabled semantics — a click on adisabledelement still dispatches in simulate. Test disabled state by asserting the attribute is present, not by testing click behavior.- CustomEvents from FFI don't fire — if a component uses FFI to dispatch a CustomEvent (e.g.,
radish-value-change), simulate won't see it. Dispatch it manually withsimulate.event().
Test structure (Radish pattern)
- Level 1 — Unit: Pure functions, no simulate. State constructors, helpers, formatters, pure view helpers.
- Level 2 — Simulate: Wire up a minimal Lustre app, dispatch events, assert on model via
simulate.model(). - Level 2b — Attribute assertions: Use
simulate.view()+query.has()/query.find()to verify DOM attributes (ARIA, data-state, disabled) without a browser.
Level 1 — Unit test examples
// State construction
pub fn initial_order_form_has_empty_lines_test() {
let model = order_form.init()
model.lines |> should.equal([])
model.save |> should.equal(submit.SubmitIdle)
}
// Update logic
pub fn add_line_appends_to_model_test() {
let model = order_form.init()
let #(updated, _effect) = order_form.update(model, order_form.AddLine)
updated.lines |> list.length() |> should.equal(1)
}
// Formatters and derived state
pub fn total_sums_line_quantities_test() {
let model = Model(lines: [Line(qty: 3), Line(qty: 7)])
order_form.total(model) |> should.equal(10)
}
// Pure view helper — extract as pub fn, test without full Model
pub fn draft_order_shows_10_percent_progress_test() {
let view = orders.order_progress(order.OrderDraft, language.Portuguese)
query.find(in: view, matching: query.element(query.text("10%")))
|> should.be_ok
}Level 2 — Simulate test examples
// Click produces correct state change
pub fn click_submit_sets_submitting_test() {
let model =
test_app()
|> simulate.click(on: query.element(query.id("submit-btn")))
|> simulate.model()
model.save |> should.equal(submit.SubmitSaving)
}
// Keyboard navigation
pub fn escape_closes_dropdown_test() {
let model =
open_app()
|> simulate.event(
on: query.element(query.id("dropdown")),
name: "keydown",
data: [#("key", json.string("Escape"))],
)
|> simulate.model()
model.is_open |> should.equal(False)
}
// Conditional rendering via text/attribute, NOT class
pub fn error_message_shows_on_invalid_test() {
let view =
test_app()
|> simulate.click(on: query.element(query.id("submit-btn")))
|> simulate.view()
query.has(in: view, matching: query.text("Email is required"))
|> should.equal(True)
}
// ARIA semantics
pub fn disabled_button_has_aria_disabled_test() {
let view =
test_app()
|> simulate.view()
query.has(
in: view,
matching: query.id("submit-btn")
|> query.and(query.aria("disabled", "true")),
)
|> should.equal(True)
}
// Disabled state — assert attribute, NOT click behavior
// (simulate.click bypasses browser disabled semantics)
pub fn disabled_checkbox_has_disabled_attribute_test() {
let view =
app_with_state(State(..defaults, disabled: True))
|> simulate.view()
query.has(
in: view,
matching: query.id("cb")
|> query.and(query.attribute("disabled", "")),
)
|> should.equal(True)
}Anti-patterns (explicit violations)
// BAD — testing CSS class
pub fn header_has_flex_layout_test() {
let view = test_app() |> simulate.view()
query.has(in: view, matching: query.class("flex")) // VIOLATION
}
// BAD — testing Tailwind token
pub fn badge_has_brand_color_test() {
let view = test_app() |> simulate.view()
query.has(in: view, matching: query.class("bg-brand-100")) // VIOLATION
}Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

