- part of #3123 (4 of 5)
- `LocalizedHtmlString` should not subclass `HtmlString`; now implements `IHtmlContent`
nits:
- clean up a few doc comments
- remove duplicate tests reported while testing these fixes in VS
This change removes the IActionContextAccessor as a dependency of
UrlHelper, and shifts UrlHelper to use a factory pattern. Consumers of
IUrlHelper should create an instance using the factory when needed.
This is the last part of MVC that has a dependency on IActionContext
accessor. As part of this change we no longer register it by default, and
treat it as an optional component.
This change resolves#3512 and #3636 by removing 'magic' link generation
and adding an extension method to add routes to areas correctly using the new
pattern. This is pretty much exactly the same as how MapWebApiRoute works.
For site authors, we recommend adding area-specific routes in a way that
includes a default AND constraint for the area. Put your most specific
(for link generation) routes FIRST.
Ex:
routes.MapRoute(
"Admin/{controller}/{action}/{id?}",
defaults: new { area = "Admin" },
constraints: new { area = "Admin" });
The bulk of the changes here are to tests that unwittingly relied on the
old behavior.
- #3123 (3 of 5 or so)
- react to rest of aspnet/Antiforgery@6a9b38d
- remove `HtmlEncoder` from localization requirements
- literal `hidden` is no longer HTML encoded (was a no-op anyhow)
- `true` has the opposite meaning now but most changes are due to new parameters names in `IViewEngine`
- use name names in `Microsoft.AspNet.Mvc.ViewFound` and not found events
- remove `IRazorPage.IsPartial` and `RazorView.IsPartial`
- remove `IsPartial` properties from `Microsoft.AspNet.Mvc.Razor.BeginInstrumentationContext` and end events
- add parameter checks to `RazorView` constructor; instances are not retrieved from DI
nits:
- remove unused `cacheKey` parameter from `RazorViewEngine.CreateCacheResult()`
- correct duplicate test names in `RazorPageTest`
- also `...OnPageExecutionListenerContext` -> `...OnPageExecutionContext`
- `IRazorViewEngine.MakePathAbsolute()` -> `GetAbsolutePath()`
- set `IsPartial` on all `IRazorPage` instances
- improve consistency of methods in `HtmlHelperPartialExtensions`
- a couple unnecessarily passed `htmlHelper.ViewData`
- add missing tests of these extension methods
- restore parameter checks in `CompositeViewEngine`
- reduce `List<string>` and remove enumerator allocations in `CompositeViewEngine`
nits:
- correct a few comments
- use `<seealso/>`
- #3307
- relative paths are now supported in `View()` calls from components and view components,
`Html.PartialAsync()` and similar calls, and `RazorPage.Layout` settings.
- support absolute paths, relative paths, and view location lookups consistently / everywhere
- support view paths in `TemplateRenderer` e.g. passing an absolute path to `Html.EditorFor()`
- take a big swing at the `IRazorViewEngine` and `IViewEngine` interfaces
- split lookups (view names) from navigation (view paths)
- remove `Partial` separation; use parameters to set `IsPartial` properties
- correct `ViewContext` copy constructor and add unit test
- extend unit tests to cover relative paths
- fix existing tests to handle newly-required extension in an absolute path
- add functional test that chains relative paths
nits:
- remove some YOLO line wrapping
- `""` -> `string.Empty`
- Prior to this change the `<meta ...>` generated had a name attribute. As an alternative we're using the `content` attribute in conjunction with the `name` attribute to ensure compliance.
#3449
- wrong fix especially now that test encoders work as expected
- touch up `HtmlHelperTest` and `RazorViewTest` since test encoders are now consistent
- remove references to old `Microsoft.Extensions.WebEncoders.Testing` package
This reverts commit a9d5876cd9.
- but leave `FormTagHelperTest` and `ValidationMessageTagHelperTest` cleanup alone
nit: use `string.Empty` in `HtmlHelperLinkGenerationTest`
- #3140
- clone `MediaTypeHeaderValue` instance before updating it when content negotiation succeeds
- avoids changes to `MediaTypeConstants` properties and `OutputFormatter.SupportedMediaTypes` entries
- `MediaTypeHeaderValue.Clone()` does not exist in our DNX Core fork of this class
- in previous implementation, was called defensively rather than when required
- update `WebApiCompatShimBasicTest` functional tests to use `MvcTestFixture<TStartup>` everywhere
- #3140 blocked that final migration
- remove `TestHelper` since it's no longer referenced
nits:
- remove comments mentioning `TestHelper`
- correct spelling of "negotiation"
- test class can now use the `MvcTestFixture`
- #3139 part 3 of 3
- dump instrumentation data at end of `_Layout.cshtml`
- include `FilePath` in display
- compare against new `.html` resource
nits:
- normalize line endings to CRLF for consistency with other tests
- add `InstrumentionData` to avoid `Tuple`
- make `TestPageExecutionContext` class `private`
- remove newly-unused actions and associated `.cshtml` files
- remove tests already thoroughly covered in unit tests
- #3139 part 2 of 3
- make checks of `<form>` tag helper more consistent with others
- use a tag helper initializer but testing every variant; covered in unit tests
- remove `MvcStartupTest` and associated web site
- scenario covered elsewhere
- remove `PrecompilationTest.PrecompiledView_RendersCorrectly()`
- scenario covered elsewhere and shouldn't do I/O on checked-in files
- use `MvcTestFixture` instead of `TestHelper`
- part of #3139
- continue to test e2e interaction of `FlushAsync()` with sections, partials, et cetera
- remove `FlushPointTest.FlushBeforeCallingLayout()`
- `RazorPageTest.FlushAsync_ThrowsIfTheLayoutHasBeenSet()` unit test covers the scenario
- Added functional tests to validate data created from a `SelectTagHelper` does not impact following `<select>` tags.
- Also moved the new `SelectTagHelper` communication flow into `TagHelper.Init`.
#3347
- #3227
- much of change is to tests, creating and passing `ModelMetadata`
- updated `InputFormatterContext` to make `ModelMetadata` available to `JsonInputFormatter`
- walk `ModelMetadata` tree to get information about property with an issue
- add missing `null` checks in `ModelStateDictionaryExtensions`
- #2994
- Affects both HtmlHelper and TagHelper scenarios
- Checkboxes not enclosed in a form will generate inline hidden tags
- Added necessary properties to FormContext
- Added some functional and unit tests
- aspnet/Mvc#3138 part 2/2
- request's Content-Type header must be a subset of what an `IInputFormatter` can consume
- `[Consumes]` is similar
- what an `IOutputFormatter` produces must be a subset of the request's Accept header
- `FormatFilter` and `ObjectResult` are similar
- `ObjectResult` no longer falls back to `Content-Type` header if no `Accept` value is acceptable
- left `WebApiCompatShim` code alone for consistency with down-level `System.Net.Http.Formatting`
- correct tests to match new behaviour
- do not test `Accept` values containing a `charset` parameter; that case is not valid
WIP:
- four test failures; something about comparing media types w/ charset included
- why do some localization tests fail in VS?
nits:
- add `InputFormatterTests`
- add / update comments and doc comments
- correct xUnit attributes in `ActionResultTest`; odd it doesn't show up in command-line runs