@@ -102,8 +102,9 @@ defmodule ElixirConsoleWeb.ConsoleLiveTest do
102102 test "show suggestions if more than one" , % { conn: conn } do
103103 { :ok , view , _html } = live ( conn , "/" )
104104
105- input = element ( view , "#command_input input" )
106- render_hook ( input , :suggest , % { "value" => "Enum.co" , "caret_position" => 7 } )
105+ view
106+ |> with_target ( "#command_input" )
107+ |> render_hook ( :suggest , % { "value" => "Enum.co" , "caret_position" => 7 } )
107108
108109 html = render ( view )
109110
@@ -113,8 +114,9 @@ defmodule ElixirConsoleWeb.ConsoleLiveTest do
113114 test "autocomplete and do not show suggestions if only one" , % { conn: conn } do
114115 { :ok , view , _html } = live ( conn , "/" )
115116
116- input = element ( view , "#command_input input" )
117- render_hook ( input , :suggest , % { "value" => "Enum.conc" , "caret_position" => 9 } )
117+ view
118+ |> with_target ( "#command_input" )
119+ |> render_hook ( :suggest , % { "value" => "Enum.conc" , "caret_position" => 9 } )
118120
119121 html = render ( view )
120122
@@ -127,8 +129,9 @@ defmodule ElixirConsoleWeb.ConsoleLiveTest do
127129 test "show suggestions considering caret position in the command input" , % { conn: conn } do
128130 { :ok , view , _html } = live ( conn , "/" )
129131
130- input = element ( view , "#command_input input" )
131- render_hook ( input , :suggest , % { "value" => "Enum.co([1,2]) - 2" , "caret_position" => 7 } )
132+ view
133+ |> with_target ( "#command_input" )
134+ |> render_hook ( :suggest , % { "value" => "Enum.co([1,2]) - 2" , "caret_position" => 7 } )
132135
133136 html = render ( view )
134137
@@ -138,10 +141,10 @@ defmodule ElixirConsoleWeb.ConsoleLiveTest do
138141 test "autocomplete considering caret position in the command input" , % { conn: conn } do
139142 { :ok , view , _html } = live ( conn , "/" )
140143
141- input = element ( view , "#command_input input" )
142-
143144 html =
144- render_hook ( input , :suggest , % { "value" => "Enum.conc([1,2], [3])" , "caret_position" => 9 } )
145+ view
146+ |> with_target ( "#command_input" )
147+ |> render_hook ( :suggest , % { "value" => "Enum.conc([1,2], [3])" , "caret_position" => 9 } )
145148
146149 assert html =~ ~r/ \< input .* data-input_value\= "Enum.concat\( \[ 1,2\] , \[ 3\] \) "/
147150 assert html =~ ~r/ \< input .* data-caret_position\= "11"/
0 commit comments