phoenix_live_view changelog


Welcome to the latest update! We've been busy squashing bugs and polishing up features to make your experience smoother and more awesome. Here's a peek at what's been cooking under the hood:

  • Improvement: Clarify Options in LiveViewTest.element 🌟
    We've added some extra sparkle to the element function by clarifying its options. With a new guard clause, is_text_filter, we now ensure that text filters are either a binary string, a Regex struct, or nil. This means the has_element? and element functions are now more explicit and robust, making your testing experience clearer and more reliable. Bye-bye, ambiguity! 👋

  • Improvement: Handle Strings with Escaped Quotes 🔍
    Ever had a string with escaped quotes that just wouldn't behave? We've got you covered! We tinkered with the render_attribute function so it no longer flattens strings with quotes or those fancy heredocs. Now, your strings will stay intact, and the attributes will render just as they should. Plus, we added a new test to make sure everything's shipshape. Cheers to more accurate string handling! 🍻

Thanks for sticking with us! Keep those feature requests and bug reports coming. We love making things better for you! 🚀

Included Commits

2024-08-15T08:32:17 See commit

The commit titled "Clarify options to LiveViewTest.element" addresses a limitation in the element function introduced in PR #3250, specifically regarding the handling of the missing text filter case. The modification introduces a guard clause, is_text_filter, that checks if the text_filter parameter is either a binary string, a Regex struct, or nil. This enhancement ensures that the has_element? and element functions are more explicit in their parameter requirements, improving code clarity and robustness.

In total, the changes include the addition of 7 lines and the deletion of 2, leading to a net change of 9 lines in the lib/phoenix_live_view/test/live_view_test.ex file. The commit ultimately closes PR #3250, solidifying the functionality and reliability of the LiveView testing framework.

Files changed

  • lib/phoenix_live_view/test/live_view_test.ex
2024-08-15T15:02:33 See commit

This commit addresses an issue with handling strings that contain escaped quotes within the Phoenix LiveView framework. Specifically, it modifies the render_attribute function in the HTMLAlgebra module to prevent flattening of strings that either contain double quotes or are defined as heredocs. The logic now checks for the presence of quotes in the string and the type of delimiter used. If quotes are detected or if the delimiter is a heredoc, the function groups the output accordingly, ensuring that the attribute is rendered correctly without altering the string's content.

Additionally, the commit includes a new test case in the HTMLFormatterTest module to verify that strings containing double quotes are not incorrectly flattened during formatting. This change is part of the effort to improve the handling of string expressions in HTML attributes, addressing issue #3336 and ensuring that the output remains consistent and accurate when dealing with complex string inputs.

Files changed

  • lib/phoenix_live_view/html_algebra.ex
  • test/phoenix_live_view/html_formatter_test.exs