Skip to content

Commit 2552278

Browse files
azizkprincemaple
authored andcommitted
Tests: changed LiveView tests to HEEx
Added embedded comment tests for HEEx and Surface.
1 parent 0df58d6 commit 2552278

File tree

3 files changed

+34
-10
lines changed

3 files changed

+34
-10
lines changed

tests/syntax_test_strings.ex

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -153,19 +153,27 @@ heredoc text
153153
~s"\""m ~s'\''m ~s/\//m ~s|\||m ~s<<\>>m ~s{{\}}m ~s[[\]]m ~s((\))m
154154

155155

156-
## LiveView
156+
## HEEx
157157

158-
~L""''a
158+
~H""''a
159159
# ^ -string.quoted.modifiers
160-
~L"""
160+
~H"""
161161
^^^^^ meta.string.elixir text.html.eex text.html.basic
162162
\"""<sd>
163163
#^^ constant.character.escape.char.elixir
164164
"""''a
165165
# ^ -string.quoted.modifiers
166166
167-
~L"""
168-
<div class="">
167+
~H"""
168+
<%!-- Comment --%>
169+
# ^^ punctuation.section.embedded.end
170+
# ^^ punctuation.definition.comment.end
171+
# ^^^ punctuation.definition.comment.begin
172+
# ^^ punctuation.section.embedded.begin
173+
# ^^^^^^^^^^^^^^^^^^ meta.embedded comment.block
174+
<div class={@classes}>
175+
# ^^^^^^^^ source.elixir.embedded.html
176+
# ^^^^^^^^^^ meta.attribute-with-value.class.html meta.embedded
169177
<div>
170178
<%= @deploy_step %>
171179
# ^^^^^^^^^^^ variable.other.constant
@@ -175,7 +183,7 @@ heredoc text
175183
^^text.html.basic
176184
"""
177185
178-
~L"""
186+
~H"""
179187
<div><%= @var %></div>
180188
# ^^^ variable.other.constant.elixir
181189
# ^ -string
@@ -191,24 +199,24 @@ heredoc text
191199
# ^ storage.type.string
192200
#^^^ punctuation.definition.string.end
193201
#^^^^ meta.string.elixir
194-
~L"<div>\"</div>"m
202+
~H"<div>\"</div>"m
195203
# ^ punctuation.definition.string.end
196204
# ^^ constant.character.escape.char.elixir
197205
# ^^^ entity.name.tag.block.any.html
198-
~L'<div>\'</div>'m
206+
~H'<div>\'</div>'m
199207
# ^ punctuation.definition.string.end
200208
# ^^ constant.character.escape.char.elixir
201209
# ^^^ entity.name.tag.block.any.html
202210

203-
~L/\//m ~L|\||m ~L{\}}m ~L[\]]m ~L<\>>m ~L(\))m
211+
~H/\//m ~H|\||m ~H{\}}m ~H[\]]m ~H<\>>m ~H(\))m
204212
# ^ string.quoted.modifiers
205213
# ^ string.quoted.modifiers
206214
# ^ string.quoted.modifiers
207215
# ^ string.quoted.modifiers
208216
# ^ string.quoted.modifiers
209217
# ^ string.quoted.modifiers
210218

211-
~L'''
219+
~H'''
212220
\
213221
^^ text.html.basic -punctuation.separator.continuation
214222
'''m

tests/syntax_test_surface.ex

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@
66
#^^ meta.string.elixir storage.type.string.elixir
77
# ^^^ meta.string.elixir punctuation.definition.string.begin.elixir
88
9+
{!-- Comment --}
10+
# ^^^ punctuation.definition.comment.end.surface
11+
# ^^^^ punctuation.definition.comment.begin.surface
12+
# ^^^^^^^^^^^^^^^^ meta.embedded.surface comment.block.surface
13+
914
<Some.App.Component x={y}>
1015
# ^ punctuation.section.embedded.end.elixir - source.elixir.embedded
1116
# ^ source.elixir.embedded.html

tests/syntax_test_template.html.heex

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,17 @@
1818
<!-- ^ - punctuation.section.embedded.begin.elixir - source -->
1919
<!-- ^^^^^^^^^^^^^^^^^ - comment.block.html meta.embedded -->
2020

21+
<%!-- Multi-line
22+
<!-- ^^^ punctuation.definition.comment.begin.eex -->
23+
<!-- ^^ punctuation.section.embedded.begin.eex -->
24+
<!-- ^^^^^^^^^^^^^^^^^ meta.embedded.eex -->
25+
<!-- ^^^^^^^^^^^^ comment.block.eex -->
26+
comment --%>
27+
<!-- ^^ punctuation.section.embedded.end.eex -->
28+
<!-- ^^ punctuation.definition.comment.end.eex -->
29+
<!--^^^^^^^^^^^^^^^ comment.block.eex -->
30+
<!--^^^^^^^^^^^^^^^^^^^ meta.embedded.eex -->
31+
2132
<% # Comment %>
2233
<!-- ^^ punctuation.section.embedded.end.eex -->
2334
<!-- ^ punctuation.definition.comment.elixir -->

0 commit comments

Comments
 (0)