@@ -18,7 +18,7 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost;
18
18
public class CohostWrapWithTagEndpointTest ( ITestOutputHelper testOutputHelper ) : CohostEndpointTestBase ( testOutputHelper )
19
19
{
20
20
[ Fact ]
21
- public async Task ValidHtmlLocation_ReturnsResult ( )
21
+ public async Task InsideHtml ( )
22
22
{
23
23
await VerifyWrapWithTagAsync (
24
24
input : """
@@ -38,7 +38,98 @@ await VerifyWrapWithTagAsync(
38
38
}
39
39
40
40
[ Fact ]
41
- public async Task CSharpLocation_ReturnsNull ( )
41
+ public async Task HtmlInCSharp ( )
42
+ {
43
+ await VerifyWrapWithTagAsync (
44
+ input : """
45
+ @if (true)
46
+ {
47
+ [|<p></p>|]
48
+ }
49
+ """ ,
50
+ expected : """
51
+ @if (true)
52
+ {
53
+ <div><p></p></div>
54
+ }
55
+ """ ,
56
+ htmlResponse : new VSInternalWrapWithTagResponse (
57
+ LspFactory . CreateSingleLineRange ( start : ( 1 , 4 ) , length : 0 ) ,
58
+ [
59
+ LspFactory . CreateTextEdit ( position : ( 2 , 4 ) , "<div>" ) ,
60
+ LspFactory . CreateTextEdit ( position : ( 2 , 11 ) , "</div>" )
61
+ ]
62
+ ) ) ;
63
+ }
64
+
65
+ [ Fact ]
66
+ public async Task HtmlInCSharp_WithWhitespace ( )
67
+ {
68
+ await VerifyWrapWithTagAsync (
69
+ input : """
70
+ @if (true)
71
+ {
72
+ [| <p></p> |]
73
+ }
74
+ """ ,
75
+ expected : """
76
+ @if (true)
77
+ {
78
+ <div><p></p></div>
79
+ }
80
+ """ ,
81
+ htmlResponse : new VSInternalWrapWithTagResponse (
82
+ LspFactory . CreateSingleLineRange ( start : ( 1 , 4 ) , length : 0 ) ,
83
+ [
84
+ LspFactory . CreateTextEdit ( 2 , 4 , 2 , 5 , "<div>" ) ,
85
+ LspFactory . CreateTextEdit ( 2 , 12 , 2 , 13 , "</div>" )
86
+ ]
87
+ ) ) ;
88
+ }
89
+
90
+ [ Fact ]
91
+ public async Task NotInHtmlInCSharp_WithNewline ( )
92
+ {
93
+ await VerifyWrapWithTagAsync (
94
+ input : """
95
+ @if (true)
96
+ {[|
97
+ <p></p>|]
98
+ }
99
+ """ ,
100
+ expected : null ,
101
+ htmlResponse : null ) ;
102
+ }
103
+
104
+ [ Fact ]
105
+ public async Task RazorBlockStart ( )
106
+ {
107
+ await VerifyWrapWithTagAsync (
108
+ input : """
109
+ [|@if (true) { }
110
+ <div>
111
+ </div>|]
112
+ """ ,
113
+ expected : """
114
+ <div>
115
+ @if (true) { }
116
+ <div>
117
+ </div>
118
+ </div>
119
+ """ ,
120
+ htmlResponse : new VSInternalWrapWithTagResponse (
121
+ LspFactory . CreateSingleLineRange ( start : ( 1 , 4 ) , length : 0 ) ,
122
+ [
123
+ LspFactory . CreateTextEdit ( position : ( 0 , 0 ) , $ "<div>{ Environment . NewLine } ") ,
124
+ LspFactory . CreateTextEdit ( position : ( 1 , 0 ) , " " ) ,
125
+ LspFactory . CreateTextEdit ( position : ( 2 , 0 ) , " " ) ,
126
+ LspFactory . CreateTextEdit ( position : ( 2 , 6 ) , $ "{ Environment . NewLine } </div>")
127
+ ]
128
+ ) ) ;
129
+ }
130
+
131
+ [ Fact ]
132
+ public async Task NotInCodeBlock ( )
42
133
{
43
134
await VerifyWrapWithTagAsync (
44
135
input : """
@@ -51,7 +142,7 @@ await VerifyWrapWithTagAsync(
51
142
}
52
143
53
144
[ Fact ]
54
- public async Task ImplicitExpression_ReturnsResult ( )
145
+ public async Task ImplicitExpression ( )
55
146
{
56
147
await VerifyWrapWithTagAsync (
57
148
input : """
@@ -71,7 +162,7 @@ await VerifyWrapWithTagAsync(
71
162
}
72
163
73
164
[ Fact ]
74
- public async Task HtmlWithTildes_FixesTextEdits ( )
165
+ public async Task HtmlWithTildes ( )
75
166
{
76
167
await VerifyWrapWithTagAsync (
77
168
input : """
0 commit comments