Skip to content

Commit 0422a8e

Browse files
Copilotdavidwengier
andcommitted
Add tests for completion in component parameters with leading @
Co-authored-by: davidwengier <[email protected]>
1 parent 6e54ed5 commit 0422a8e

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
@@ -126,6 +126,69 @@ The end.
126126
expectedItemLabels: ["DaysInMonth", "IsLeapYear", "Now"]);
127127
}
128128

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

0 commit comments

Comments
 (0)