Tests and Sandbox
This release is a hudge step towards Stable version, as it brings automated tests to Drab. Because of its nature (working both on JS and Elixir), most of them are end-to-end (integration) tests. To run it you'll need a chromedriver
.
In addition, there is a build-in Phoenix server. Now to play with Drab in IEx, you don't need to create your own Phoenix application and add drab to it, anymore. You can just clone the github repo and run the server on it:
git clone git@github.com:grych/drab.git
cd drab
mix deps.get
npm install && node_modules/brunch/bin/brunch build
iex -S mix phoenix.server
Open the browser, navigate to http://localhost:4000 and follow the instruction in IEX:
import Drab.Core; import Drab.Query; import Drab.Modal; import Drab.Waiter
socket = GenServer.call(pid("0.xxxxx.0"), :get_socket)
Now you can remote control the browser from IEx:
iex(5)> socket |> alert("Title", "WOW!")
{:ok, %{}}
iex(6)> socket |> select(:text, from: "h3")
"Drab Tests"
iex(7)> socket |> update(:text, set: "It is set from IEx, wow!", on: "h3")
%Phoenix.Socket{assigns: %{__action: :index, .........