Skip to content

Commit c684217

Browse files
authored
Fix script/link tests (#33453)
1 parent 5b29ccb commit c684217

File tree

5 files changed

+23
-29
lines changed

5 files changed

+23
-29
lines changed

src/Mvc/test/Mvc.FunctionalTests/HtmlGenerationTest.cs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ public static TheoryData<string, string> WebPagesData
5252
{ "Customer", "/Customer/HtmlGeneration_Customer" },
5353
{ "Index", null },
5454
{ "Product", null },
55+
{ "Link", null },
56+
{ "Script", null },
5557
// Testing attribute values with boolean and null values
5658
{ "AttributesWithBooleanValues", null },
5759
// Testing SelectTagHelper with Html.BeginForm
@@ -135,13 +137,6 @@ public async Task HtmlGenerationWebSite_GeneratesExpectedResults(string action,
135137
}
136138
}
137139

138-
[ConditionalTheory]
139-
[InlineData("Link", null)]
140-
[InlineData("Script", null)]
141-
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10423")]
142-
public Task HtmlGenerationWebSite_GeneratesExpectedResultsNotReadyForHelix(string action, string antiforgeryPath)
143-
=> HtmlGenerationWebSite_GeneratesExpectedResults(action, antiforgeryPath);
144-
145140
[Fact]
146141
public async Task HtmlGenerationWebSite_GeneratesExpectedResults_WithImageData()
147142
{

src/Mvc/test/Mvc.FunctionalTests/TagHelpersTest.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,7 @@ public async Task CanRenderViewsWithTagHelpers(string action)
6464
[InlineData("GlobbingTagHelpers")]
6565
[InlineData("ViewComponentTagHelpers")]
6666
[SkipOnHelix("https://github.com/dotnet/aspnetcore/issues/10423")]
67-
public Task CanRenderViewsWithTagHelpersNotReadyForHelix(string action)
68-
=> CanRenderViewsWithTagHelpers(action);
67+
public Task CanRenderViewsWithTagHelpersNotReadyForHelix(string action) => CanRenderViewsWithTagHelpers(action);
6968

7069
[Fact]
7170
public async Task GivesCorrectCallstackForSyncronousCalls()

src/Mvc/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/Link.cshtml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010
<link href="~/styles/site.css" rel="stylesheet" title="&lt;the title>" />
1111

1212
<!-- Globbed link tag with existing file -->
13-
<link asp-href-include="**/site.css" rel="stylesheet" title="&lt;the title>" />
13+
<link asp-href-include="**/styles/site.css" rel="stylesheet" title="&lt;the title>" />
1414

1515
<!-- Globbed link tag with comma separated pattern -->
1616
<link asp-href-include="~/styles/*.css, ~/styles/sub/*.css" rel="stylesheet" title="&lt;the title" />
1717

1818
<!-- Globbed link tag with existing file and exclude -->
19-
<link asp-href-include=" **/*.css" asp-href-exclude="**/site3*.css" rel="stylesheet" title='"the" title' />
19+
<link asp-href-include=" **/styles/**/*.css" asp-href-exclude="**/site3*.css" rel="stylesheet" title='"the" title' />
2020

2121
<!-- Globbed link tag missing include -->
2222
<link asp-href-exclude="**/site2.css" rel="stylesheet">
@@ -37,7 +37,7 @@
3737
<link href="~/styles/site.css" asp-href-include="**/site2.css" rel="stylesheet" />
3838

3939
<!-- Globbed link tag with existing file and static href should dedupe -->
40-
<link href="~/styles/site.css" asp-href-include="**/site.css" rel="stylesheet" />
40+
<link href="~/styles/site.css" asp-href-include="**/styles/site.css" rel="stylesheet" />
4141

4242
<!-- Fallback to static href -->
4343
<link href="~/styles/site.min.css?a=b&c=d" rel="stylesheet" data-extra="test" title='"the" title'
@@ -127,7 +127,7 @@
127127

128128
<!-- Fallback to globbed href -->
129129
<link href="~/styles/site.min.css" rel="stylesheet" data-extra="test"
130-
asp-fallback-href-include="**/site.css"
130+
asp-fallback-href-include="**/styles/site.css"
131131
asp-fallback-test-class="hidden"
132132
asp-fallback-test-property="visibility"
133133
asp-fallback-test-value="hidden" />
@@ -143,45 +143,45 @@
143143
<!-- Fallback to static and globbed href should dedupe -->
144144
<link href="~/styles/site.min.css" rel="stylesheet" data-extra="test"
145145
asp-fallback-href="~/styles/site.css"
146-
asp-fallback-href-include="**/site.css"
146+
asp-fallback-href-include="**/styles/site.css"
147147
asp-fallback-test-class="hidden"
148148
asp-fallback-test-property="visibility"
149149
asp-fallback-test-value="hidden" />
150150

151151
<!-- Fallback to static and globbed href with exclude -->
152152
<link href="~/styles/site.min.css" rel="stylesheet" data-extra="test"
153153
asp-fallback-href="~/styles/site.css"
154-
asp-fallback-href-include="**/*.css"
154+
asp-fallback-href-include="**/styles/**/*.css"
155155
asp-fallback-href-exclude="**/site3*.css"
156156
asp-fallback-test-class="hidden"
157157
asp-fallback-test-property="visibility"
158158
asp-fallback-test-value="hidden" />
159159

160160
<!-- Fallback from globbed href to globbed href -->
161161
<link asp-href-include="styles/site.min.css" rel="stylesheet" data-extra="test"
162-
asp-fallback-href-include="**/site.css"
162+
asp-fallback-href-include="**/styles/site.css"
163163
asp-fallback-test-class="hidden"
164164
asp-fallback-test-property="visibility"
165165
asp-fallback-test-value="hidden" />
166166

167167
<!-- Fallback from globbed href with exclude to globbed href -->
168168
<link asp-href-include="**/*.min.css" asp-href-exclude="**/site3.min.css" rel="stylesheet" data-extra="test"
169-
asp-fallback-href-include="**/site.css"
169+
asp-fallback-href-include="**/styles/site.css"
170170
asp-fallback-test-class="hidden"
171171
asp-fallback-test-property="visibility"
172172
asp-fallback-test-value="hidden" />
173173

174174
<!-- Fallback from globbed and static href to globbed href -->
175175
<link href="styles/site.min.css" asp-href-include="styles/site.css" rel="stylesheet" data-extra="test"
176-
asp-fallback-href-include="**/site.css"
176+
asp-fallback-href-include="**/styles/site.css"
177177
asp-fallback-test-class="hidden"
178178
asp-fallback-test-property="visibility"
179179
asp-fallback-test-value="hidden" />
180180

181181
<!-- Fallback from globbed and static href with exclude to globbed href -->
182182
<link href="styles/site.min.css" asp-href-include="**/*.min.css" asp-href-exclude="**/site3.min.css"
183183
rel="stylesheet" data-extra="test"
184-
asp-fallback-href-include="**/site.css"
184+
asp-fallback-href-include="**/styles/site.css"
185185
asp-fallback-test-class="hidden"
186186
asp-fallback-test-property="visibility"
187187
asp-fallback-test-value="hidden">
@@ -190,7 +190,7 @@
190190
<link href="styles/site.min.css" asp-href-include="**/*.min.css" asp-href-exclude="**/site3.min.css"
191191
rel="stylesheet" data-extra="test"
192192
asp-fallback-href="~/styles/site.css"
193-
asp-fallback-href-include="**/*.css"
193+
asp-fallback-href-include="**/styles/**/*.css"
194194
asp-fallback-href-exclude="**/site3*.css"
195195
asp-fallback-test-class="hidden"
196196
asp-fallback-test-property="visibility"
@@ -232,7 +232,7 @@
232232
<link href="~/styles/site.css" rel="stylesheet" asp-append-version="true" />
233233

234234
<!-- Globbed link tag with existing file and file version -->
235-
<link asp-href-include="**/site.css" rel="stylesheet" asp-append-version="true" />
235+
<link asp-href-include="**/styles/site.css" rel="stylesheet" asp-append-version="true" />
236236

237237
<!-- Fallback with file version -->
238238
<link href="~/styles/site.min.css" rel="stylesheet" data-extra="test"
@@ -243,7 +243,7 @@
243243
asp-append-version="true">
244244

245245
<!-- Globbed link tag with existing file, static href and file version -->
246-
<link href="~/styles/site.css" asp-href-include="**/*.css" rel="stylesheet" asp-append-version="true" />
246+
<link href="~/styles/site.css" asp-href-include="**/styles/**/*.css" rel="stylesheet" asp-append-version="true" />
247247
</head>
248248
<body>
249249

src/Mvc/test/WebSites/HtmlGenerationWebSite/Views/HtmlGeneration_Home/Script.cshtml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
</script>
5252

5353
<script src="~/blank.js"
54-
asp-fallback-src-include="**/*.js"
54+
asp-fallback-src-include="**/styles/**/*.js"
5555
asp-fallback-src-exclude="**/site3.js"
5656
asp-fallback-test="false">
5757
// Fallback to globbed src with exclude
@@ -104,7 +104,7 @@
104104
</script>
105105

106106
<!-- Globbed script tag with existing file and exclude -->
107-
<script asp-src-include="**/*.js" asp-src-exclude="**/site3.js">
107+
<script asp-src-include="**/styles/**/*.js" asp-src-exclude="**/site3.js">
108108
// This comment shouldn't be emitted
109109
</script>
110110

@@ -149,12 +149,12 @@
149149
</script>
150150

151151
<!-- Globbed script tag with existing files and version -->
152-
<script asp-src-include="**/*.js" asp-append-version="true">
152+
<script asp-src-include="**/styles/**/*.js" asp-append-version="true">
153153
// This comment shouldn't be emitted
154154
</script>
155155

156156
<!-- Globbed script tag with existing file, exclude and version -->
157-
<script asp-src-include="**/*.js" asp-src-exclude="**/site3.js" asp-append-version="true">
157+
<script asp-src-include="**/styles/**/*.js" asp-src-exclude="**/site3.js" asp-append-version="true">
158158
// This comment shouldn't be emitted
159159
</script>
160160
</body>

src/Mvc/test/WebSites/TagHelpersWebSite/Views/Home/GlobbingTagHelpers.cshtml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
<!-- RazorClassLib folder wildcard -->
1111
<script asp-src-include="/_content/RazorPagesClassLibrary/**/file.js"></script>
1212
<!-- RazorClassLib deep wildcard -->
13-
<script asp-src-include="/**/*.js"></script>
13+
<script asp-src-include="/**/*.js" asp-src-exclude="/styles/**/*.js,/razorlib/*.js,/lib/**/*.js" ></script>
1414
<!-- RazorClassLib Exclude local -->
15-
<script asp-src-exclude="/js/dist/*.js" asp-src-include="**/*.js"></script>
15+
<script asp-src-exclude="/js/dist/*.js,/styles/**/*.js,/razorlib/*.js,/lib/**/*.js" asp-src-include="**/*.js"></script>
1616
<!-- local Exclude lib-->
17-
<script asp-src-exclude="/_content/**/*.js" asp-src-include="**/*.js"></script>
17+
<script asp-src-exclude="/_content/**/*.js,/styles/**/*.js,/razorlib/*.js,/lib/**/*.js" asp-src-include="**/*.js"></script>
1818
}
1919
Globbing

0 commit comments

Comments
 (0)