Skip to content

Commit a7a4439

Browse files
committed
Fix legacy test, add a better one, and make the C# test make a bit more sense
1 parent 4a2243b commit a7a4439

File tree

1 file changed

+34
-4
lines changed

1 file changed

+34
-4
lines changed

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

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,37 @@ await VerifyCodeActionAsync(
318318
<div></div>
319319
""",
320320
expected: null,
321+
codeActionName: LanguageServerConstants.CodeActions.SimplifyFullyQualifiedComponent,
322+
fileKind: RazorFileKind.Legacy);
323+
}
324+
325+
[Fact]
326+
public async Task DoNotOfferOnLegacyRazorFile2()
327+
{
328+
await VerifyCodeActionAsync(
329+
input: """
330+
@addTagHelper *, SomeProject
331+
332+
<lab[||]}el foo="Dave" />
333+
""",
334+
additionalFiles:
335+
[(FilePath("FooTagHelper.cs"),
336+
"""
337+
using Microsoft.AspNetCore.Razor.TagHelpers;
338+
339+
[HtmlTargetElement("*", Attributes = FooAttributeName)]
340+
public class FooTaghelper : TagHelper
341+
{
342+
private const string FooAttributeName = "foo";
343+
344+
public override void Process(TagHelperContext context, TagHelperOutput output)
345+
{
346+
output.Attributes.Add("foo", "bar");
347+
}
348+
}
349+
""")],
350+
expected: null,
351+
codeActionName: LanguageServerConstants.CodeActions.SimplifyFullyQualifiedComponent,
321352
fileKind: RazorFileKind.Legacy);
322353
}
323354

@@ -326,10 +357,9 @@ public async Task DoNotOfferInCSharpCode()
326357
{
327358
await VerifyCodeActionAsync(
328359
input: """
329-
@{
330-
var x = "Microsoft.AspNetCore.Components.Forms.Input[||]Text";
331-
}
360+
<Microsoft.AspNetCore.Components.Forms.InputText Value="@va[||]lue"></Microsoft.AspNetCore.Components.Forms.InputText>
332361
""",
333-
expected: null);
362+
expected: null,
363+
codeActionName: LanguageServerConstants.CodeActions.SimplifyFullyQualifiedComponent);
334364
}
335365
}

0 commit comments

Comments
 (0)