Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/footer.ml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ let to_element footer =
"cellpadding", "0";
"cellspacing", "0";
"role", "presentation";
"width", "100%";
]
~children:[Element.Private.make @@ Element.Private.builder
~tag:"tr"
Expand Down
4 changes: 2 additions & 2 deletions test/golden/footer.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<!-- Footer Component Golden Tests -->

<!-- Basic footer without background -->
<table border="0" cellpadding="0" cellspacing="0" role="presentation"><tr><td>© 2024 Company Name</td></tr></table>
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%"><tr><td>© 2024 Company Name</td></tr></table>

<!-- Footer with background color -->
<table border="0" cellpadding="0" cellspacing="0" role="presentation"><tr><td bgcolor="#1f2937">© 2024 Company Name. All rights reserved.</td></tr></table>
<table border="0" cellpadding="0" cellspacing="0" role="presentation" width="100%"><tr><td bgcolor="#1f2937">© 2024 Company Name. All rights reserved.</td></tr></table>

2 changes: 2 additions & 0 deletions test/structure_tests.ml
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ let test_footer_string_shortcut () =
let html = Element.to_html (Footer.to_element footer) in

assert_test "Footer (string): table wrapper present" (html_contains html "<table");
assert_test "Footer (string): width=100% on outer table" (html_contains html "width=\"100%\"");
assert_test "Footer (string): td cell present" (html_contains html "<td");
assert_test "Footer (string): text content rendered" (html_contains html "© 2024 Example")

Expand All @@ -392,6 +393,7 @@ let test_footer_of_children () =
] in
let html = Element.to_html (Footer.to_element footer) in

assert_test "Footer (children): width=100% on outer table" (html_contains html "width=\"100%\"");
assert_test "Footer (children): first paragraph rendered" (html_contains html "line 1");
assert_test "Footer (children): second paragraph rendered" (html_contains html "line 2");
assert_test "Footer (children): paragraph tags present" (html_contains html "<p")
Expand Down