-
Notifications
You must be signed in to change notification settings - Fork 0
Strengthen UI tests with rendered-behavior assertions and add low-signal test audit #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,7 +10,7 @@ import weft_lustre_ui/theme | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| pub fn direction_tests() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe("direction", [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe("headless direction", [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it("direction_provider applies the configured dir attribute", fn() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it("direction_provider applies rtl dir attribute", fn() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let config = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| headless_direction.direction_provider_config( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| direction: headless_direction.direction_rtl(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -25,10 +25,27 @@ pub fn direction_tests() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| string.contains(rendered, "dir=\"rtl\"") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |> expect.to_equal(expected: True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| string.contains(rendered, "dir=\"ltr\"") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |> expect.to_equal(expected: False) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it("direction_provider applies ltr dir attribute", fn() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let rendered = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| headless_direction.direction_provider( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| config: headless_direction.direction_provider_config( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| direction: headless_direction.direction_ltr(), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| children: [], | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |> weft_lustre.layout(attrs: []) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |> element.to_string | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| string.contains(rendered, "dir=\"ltr\"") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |> expect.to_equal(expected: True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+32
to
45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧹 Nitpick | 🔵 Trivial Consider adding a negative assertion for consistency. The RTL tests include negative assertions verifying Suggested addition string.contains(rendered, "dir=\"ltr\"")
|> expect.to_equal(expected: True)
+
+ string.contains(rendered, "dir=\"rtl\"")
+ |> expect.to_equal(expected: False)
}),📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| describe("styled direction", [ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it("styled helpers mirror headless direction semantics", fn() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| it("styled provider applies rtl dir and helper agrees", fn() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let t = theme.theme_default() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let config = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ui_direction.direction_provider_config( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -50,6 +67,9 @@ pub fn direction_tests() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| string.contains(rendered, "dir=\"rtl\"") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |> expect.to_equal(expected: True) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| string.contains(rendered, "dir=\"ltr\"") | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |> expect.to_equal(expected: False) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ]) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Test title overstates what is currently asserted.
"vertical orientation is reflected on root/content/item"currently validates only a singledata-orientation="vertical"token. Either assert orientation at each intended node or narrow the test name to match scope.Proposed minimal fix (rename to match current assertion scope)
🤖 Prompt for AI Agents