Programming Phoenix Liveview Part 4

Now onto chapter 4.

This is where the book is using leex templates where as the latest generator is creating heex templates.

There are now a number of elixir template formats:

eex – this was the basic template version

leex – this was the first liveview template version

heex – this is adds support for syntax aware html

It appears that the modal dialog components of liveview have been significantly rewritten so that the chapter is a bit out of date.

We now have a `

heex – this is adds support for syntax aware html

It appears that the modal dialog components of liveview have been significantly rewritten so that the chapter is a bit out of date.

We now have a `

heex – this is adds support for syntax aware html

It appears that the modal dialog components of liveview have been significantly rewritten so that the chapter is a bit out of date.

It appears that live_modal has been replaced by live_component and live_modal/3 by modal/1

live_modal/3 means a function called live_modal with three parameters.

The 3 is called the arity of the function

Note to readers

`The heex templates are slightly different to the supplied leex template, but the basic logic remains.

phx-<SOMETHING> is mapped to a handle_event(“<SOMETHING>”, params, socket) function.

I have tried seeing if an updated version of the book is out (I am currently reading version B3).

Just found that B8 is the latest version so may need to go back and redo the start of the book again (or at least reread).

`

Property Testing in Elixir

There are a number of property testing frameworks available for the Elixir ecosystem.

PropEr is the obvious one from the book.

StreamData is the custom build Elixir version that was almost added to ex_unit.

Of late I have found StreamData to be very useful. Add some property tests and your bugs become very easy to find.

I have even started to experiment with minimal property tests.
Call the function with all possible inputs and assert that the output is valid.
This is what Typecheck is trying to do, but that requires you to add annotations to all of your types, which does not yet work well with some other libraries.