Skip to content

Commit 3f67675

Browse files
committed
Test documentation formatting and typing
Pin the Razor output for indentation, tabs, inline XML and malformed input in both file kinds. These tests exercise Razor's formatting and typing pipeline without separately testing Roslyn.
1 parent 7d68cea commit 3f67675

3 files changed

Lines changed: 1812 additions & 0 deletions

File tree

‎src/Razor/src/Razor/test/Microsoft.CodeAnalysis.Razor.CohostingShared.UnitTests/Endpoints/CohostOnAutoInsertEndpointTest.cs‎

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,57 @@ void TestMethod() {}
505505
triggerCharacter: "\n");
506506
}
507507

508+
[Theory, CombinatorialData]
509+
[WorkItem("https://github.com/dotnet/roslyn/issues/85414")]
510+
public async Task DocumentationDirective_OnEnterAfterOpenBrace(bool isComponent)
511+
{
512+
await VerifyOnAutoInsertAsync(
513+
input: """
514+
@documentation {
515+
$$
516+
}
517+
""",
518+
output: null,
519+
triggerCharacter: "\n",
520+
fileKind: isComponent ? RazorFileKind.Component : RazorFileKind.Legacy);
521+
}
522+
523+
[Theory, CombinatorialData]
524+
[WorkItem("https://github.com/dotnet/roslyn/issues/85414")]
525+
public async Task DocumentationDirective_OnEnterInBody(
526+
bool isComponent,
527+
[CombinatorialValues("This is some text", "* A bullet point", "/// Literal slashes")] string text)
528+
{
529+
await VerifyOnAutoInsertAsync(
530+
input: $$"""
531+
@documentation {
532+
<summary>
533+
{{text}}
534+
$$
535+
</summary>
536+
}
537+
""",
538+
output: null,
539+
triggerCharacter: "\n",
540+
fileKind: isComponent ? RazorFileKind.Component : RazorFileKind.Legacy);
541+
}
542+
543+
[Theory, CombinatorialData]
544+
[WorkItem("https://github.com/dotnet/roslyn/issues/85414")]
545+
public async Task DocumentationDirective_OnEnterAfterXmlElement(bool isComponent)
546+
{
547+
await VerifyOnAutoInsertAsync(
548+
input: """
549+
@documentation {
550+
<summary>Some documentation</summary>
551+
$$
552+
}
553+
""",
554+
output: null,
555+
triggerCharacter: "\n",
556+
fileKind: isComponent ? RazorFileKind.Component : RazorFileKind.Legacy);
557+
}
558+
508559
[Fact]
509560
public async Task DoNotAutoInsertCSharp_OnForwardSlashWithFormatOnTypeDisabled()
510561
{

0 commit comments

Comments
 (0)