Skip to content

Commit fac6edf

Browse files
authored
Add test coverage for completion in component parameters with leading @ (#12405)
2 parents e783b50 + 9885c5a commit fac6edf

File tree

1 file changed

+63
-0
lines changed

1 file changed

+63
-0
lines changed

src/Razor/test/Microsoft.VisualStudioCode.RazorExtension.Test/Endpoints/Shared/CohostDocumentCompletionEndpointTest.cs

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,69 @@ The end.
135135
""");
136136
}
137137

138+
[Fact]
139+
[WorkItem("https://github.com/dotnet/razor/issues/8442")]
140+
public async Task CSharpClassMembersInComponentParameterWithoutLeadingAt()
141+
{
142+
await VerifyCompletionListAsync(
143+
input: """
144+
This is a Razor document.
145+
146+
<EditForm Model="DateTime.$$"></EditForm>
147+
148+
The end.
149+
""",
150+
completionContext: new VSInternalCompletionContext()
151+
{
152+
InvokeKind = VSInternalCompletionInvokeKind.Typing,
153+
TriggerCharacter = ".",
154+
TriggerKind = CompletionTriggerKind.TriggerCharacter
155+
},
156+
expectedItemLabels: ["DaysInMonth", "IsLeapYear", "Now"]);
157+
}
158+
159+
[Fact]
160+
[WorkItem("https://github.com/dotnet/razor/issues/8442")]
161+
public async Task CSharpClassMembersInComponentParameterWithLeadingAt()
162+
{
163+
await VerifyCompletionListAsync(
164+
input: """
165+
This is a Razor document.
166+
167+
<EditForm Model="@DateTime.$$"></EditForm>
168+
169+
The end.
170+
""",
171+
completionContext: new VSInternalCompletionContext()
172+
{
173+
InvokeKind = VSInternalCompletionInvokeKind.Typing,
174+
TriggerCharacter = ".",
175+
TriggerKind = CompletionTriggerKind.TriggerCharacter
176+
},
177+
expectedItemLabels: ["DaysInMonth", "IsLeapYear", "Now"]);
178+
}
179+
180+
[Fact]
181+
[WorkItem("https://github.com/dotnet/razor/issues/8442")]
182+
public async Task CSharpClassMembersInComponentParameterWithLeadingAt_Incomplete()
183+
{
184+
await VerifyCompletionListAsync(
185+
input: """
186+
This is a Razor document.
187+
188+
<EditForm Model="@DateTime.$$
189+
190+
The end.
191+
""",
192+
completionContext: new VSInternalCompletionContext()
193+
{
194+
InvokeKind = VSInternalCompletionInvokeKind.Typing,
195+
TriggerCharacter = ".",
196+
TriggerKind = CompletionTriggerKind.TriggerCharacter
197+
},
198+
expectedItemLabels: ["DaysInMonth", "IsLeapYear", "Now"]);
199+
}
200+
138201
[Fact]
139202
public async Task CSharpClassesInCodeBlock()
140203
{

0 commit comments

Comments
 (0)