Skip to content

Commit c46a2cc

Browse files
authored
Merge pull request #1359 from liveview-native/bc-event-parser-update
Failing test for parser update
2 parents df6b03a + 4dba465 commit c46a2cc

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

lib/live_view_native/swiftui/rules_parser/post_processors.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ defmodule LiveViewNative.SwiftUI.RulesParser.PostProcessors do
151151
def event_to_ast(rest, [name], context, {line, _}, _byte_offset) do
152152
annotations = context_to_annotation(context.context, line)
153153

154-
{rest, [{:__event__, annotations, [name, []]}], context}
154+
{rest, [{:__event__, annotations, [name]}], context}
155155
end
156156

157157
def event_to_ast(rest, [opts, name], context, {line, _}, _byte_offset) do

test/live_view_native/swiftui/rules_parser_test.exs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,13 @@ defmodule LiveViewNative.SwiftUI.RulesParserTest do
366366

367367
assert parse(input) == output
368368
end
369+
370+
test "event with no arguments" do
371+
input = ~s{searchable(change: event("search-event"))}
372+
output = {:searchable, [], [[change: {:__event__, [], ["search-event"]}]]}
373+
374+
assert parse(input) == output
375+
end
369376
end
370377

371378
describe "Sheet test" do

0 commit comments

Comments
 (0)