Commit Graph

549 Commits

Author SHA1 Message Date
Kiran Challa 3c694ce77c Movig RequestServicesWebsite to BasicWebsite 2015-12-03 14:42:10 -08:00
Doug Bunting 42f3e764b0 Move logic from `HtmlLocalizer` to `LocalizedHtmlString`
- 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
2015-12-02 18:39:37 -08:00
Ryan Nowak 9fc3a80056 Remove IActionContextAccessor from UrlHelper
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.
2015-12-02 17:09:43 -08:00
Ryan Nowak 6875ee55d3 Remove Magic Link Generation
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.
2015-11-30 11:24:23 -08:00
Pranav K 017bf1a20f Changes to use moq-netcore 2015-11-25 16:04:04 -08:00
Doug Bunting 6e299d695f Update `DefaultHtmlGenerator.GenerateAntiforgery()` to match latest `IAntiforgery.GetHtml()`
- #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)
2015-11-25 09:49:15 -08:00
Pranav K 79d517483b Removing PageInstrumentation
Fixes #3497
2015-11-25 08:41:21 -08:00
Pavel Krymets 5ef14e95b7 React to dnx confguration change 2015-11-24 11:54:10 -08:00
ryanbrandenburg b6f8c523a8 * Remove MvcSample and replace with MvcSandbox 2015-11-23 11:53:48 -08:00
Pavel Krymets f25aab8df7 React to hosting changes 2015-11-19 16:12:50 -08:00
Doug Bunting 79d74127b9 Add temporary workarounds for aspnet/External#50 and aspnet/Mvc#3587 2015-11-19 15:50:00 -08:00
Doug Bunting 3be6167aa0 Switch concepts from misnamed `isPartial` to `isMainPage`
- `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`
2015-11-18 15:59:37 -08:00
Doug Bunting cf30bb730f PR comments and some smallish cleanup
- `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/>`
2015-11-18 15:59:28 -08:00
Doug Bunting 08dd77d8c7 Add relative view path support
- #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`
2015-11-18 15:59:11 -08:00
Kiran Challa 85080ae621 Make Cors filters run before any other authorization filters 2015-11-18 10:51:49 -08:00
Kiran Challa 982c7abea8 [Fixes #3503] Removing formatters on a given type only works on collections in MVC options 2015-11-18 09:56:44 -08:00
Pranav K b520b0cb22 Limit [FromServices] to apply only to parameters
Fixes #3507
2015-11-17 16:41:04 -08:00
Pranav K 292207d17d Reacting to DependencyInjection changes 2015-11-13 10:47:34 -08:00
Doug Bunting 845b86963e Fix build break: React to aspnet/Hosting@660f1ca 2015-11-09 21:09:21 -08:00
N. Taylor Mullen decf882341 Update `LinkTagHelper`s `meta` tag to be w3c compliant.
- 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
2015-11-06 12:15:55 -08:00
N. Taylor Mullen bebd3dc9a0 Update test files to showcase block level Razor statements in attributes.
- Block level Razor statements in attributes used to not work. Added a few use cases to ensure that they're properly tested.

aspnet/Razor#594
2015-11-06 11:11:40 -08:00
Kiran Challa 5364468001 [Fixes #3177] Clean up logic for encoding in ViewResult and friends 2015-11-06 10:44:09 -08:00
ryanbrandenburg cd761a644d * Adding test 2015-11-04 13:55:02 -08:00
Doug Bunting ff91e796c1 Revert "Fixing tests"
- 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`
2015-11-02 09:45:56 -08:00
Pranav K a9d5876cd9 Fixing tests 2015-10-30 18:58:33 -07:00
Chris R 52f4a83139 React to WebEncoders changes. 2015-10-30 17:59:19 -07:00
Doug Bunting 53060be2d7 Content negotiation fails in subsequent requests accepting same media type
- #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"
2015-10-30 14:10:31 -07:00
Doug Bunting a69a7a6940 Simplify instrumentation confirmations in `RazorPageExecutionInstrumentationTest`
- 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
2015-10-28 16:45:30 -07:00
Doug Bunting dc32f8ae33 PR comments: Restore most of `PrecompilationTest.PrecompiledView_RendersCorrectly()` 2015-10-28 16:40:28 -07:00
Doug Bunting c8c0c5303e Remove more `TestHelper` functional tests
- 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
2015-10-28 16:40:13 -07:00
Doug Bunting ff19702db5 Remove `WaitService`
- 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
2015-10-28 15:47:16 -07:00
Pavel Krymets 4e8c543489 Rename Microsoft.Runtime.Abstractions to Microsoft.Extensions.PlatformAbstractions 2015-10-22 19:48:55 -07:00
N. Taylor Mullen 911dfc57b0 Transition `SelectTagHelper` and `OptionTagHelper` to use `context.Items`.
- 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
2015-10-22 17:17:01 -07:00
Doug Bunting 40b7636b72 Use `ModelMetadata.GetDisplayName()` in error message replacing `FormatException` and `OverflowException`
- #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`
2015-10-22 15:50:36 -07:00
Pavel Krymets 84bfb8da3b Remove CallContextServiceLocator usages in tests 2015-10-22 12:15:48 -07:00
Chris R 5fd7d58ccd React to IHostingEnvironment initialization changes. 2015-10-22 08:39:16 -07:00
Pavel Krymets 5bb9759166 react to dnx di changes 2015-10-21 11:43:39 -07:00
Pranav K f4a6d634b5 Modify ViewStartUtility to generate always view paths with forward slashes
Fixes #3294
2015-10-19 10:33:05 -07:00
Kiran Challa fbf66168fe React to Cors api review changes 2015-10-15 13:05:08 -07:00
Ajay Bhargav Baaskaran d40e6612a4 Moving the order of generated hidden tags for checkbox to end of the form
- #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
2015-10-14 15:43:13 -07:00
Doug Bunting 03625c38af Correct polarity of MediaTypeHeaderValue.IsSubsetOf()` checks and remove one conneg fallback
- 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
2015-10-14 11:59:20 -07:00
Doug Bunting 35d176f5b2 Update DNX Core on Linux workarounds
- remove skip conditions for aspnet/External#33, aspnet/External#41, aspnet/External#42, aspnet/External#43
- add workaround for aspnet/External#47; avoid "g" custom datetime format specifier
- make tag helper execution order determinate in `TagHelpersWebSite`

Will test DNX Core in Travis builds (use `--test-dnxcore`) once aspnet/Universe#290 fix is in.

nits:
- remove useless `using`s for `Microsoft.AspNet.Razor.TagHelpers`
2015-10-10 23:09:51 -07:00
Pranav K f57e180971 Renaming Microsoft.Framework.* -> Microsoft.Extensions.* 2015-10-03 15:44:53 -07:00
Pranav K 8d7b95655d Removing Autofac dependency 2015-10-03 12:18:19 -07:00
Ryan Nowak 4e08eda58d Use pooled memory for the streamwriter 2015-10-02 14:35:15 -07:00
Kirthi Krishnamraju fa5f9399e8 Remove mono check from localization test 2015-09-30 11:44:00 -07:00
Gerardo Melendrez f162f70c1e Fixed typo (occured to occurred) in comments and resources. 2015-09-29 10:19:26 -07:00
Stefán Jökull Sigurðarson c713aa92ca Making the HtmlHelper.GetEnumSelectList take DisplayAttribute.GroupName into account to create select groups. 2015-09-29 09:53:48 -07:00
Kirthi Krishnamraju 0889b18f95 Add localizers to validation attributes 2015-09-25 16:13:21 -07:00
Kirthi Krishnamraju ed509f65a2 fix #2747: Fix Mvc localization test once dnx support reading resources 2015-09-24 12:53:20 -07:00