Commit Graph

430 Commits

Author SHA1 Message Date
Ajay Bhargav Baaskaran a3c593bda9 [Fixes #2409] Return EmptyResult for void actions 2015-06-11 11:51:51 -07:00
Doug Bunting afd5b4f2a6 Demonstrate #1485, #1487, #2662, #2664 in functional and unit tests
- test additional cases _close_ to these bugs as well

for #1485
- show odd `@Html.CheckBox()`, `@Html.Hidden()` behaviour in unit tests
- show odd `@Html.TextBox()` behaviour in functional tests (templates)

for #1487
- show odd `@Html.Value()` behaviour in unit tests
- show odd `@Html.RadioButton()`, `@Html.TextArea()` behaviour in functional tests
- show lack of validation attributes for `@Html.RadioButton()`, `<select>` tag helper

for #2662
- show odd `@Html.RadioButton(string.Empty)` behaviour in functional tests

for #2664
- show failures with `@Html.ListBox()` in unit tests

nits:
- test `IHtmlHelper` methods, not extensions
- use `ViewData`, not `ViewBag` in `HtmlGeneration_FormController`
- name test methods a bit more consistently
- rename `HtmlHelperValueExtensionsTest` to `HtmlHelperValueTest`
2015-06-10 10:22:40 -07:00
Kirthi Krishnamraju 74b193b15d Added configurable option for LanguageViewLocationExpander to use subfolder or suffix 2015-06-08 12:07:49 -07:00
Doug Bunting 261975b0bc Rename `MvcTagHelpersWebSite` to `HtmlGenerationsWebSite`
- name was too specific and I am about to add another HTML helper scenario
2015-06-05 20:30:17 -07:00
Doug Bunting eefa582069 Address #2526; remove use of a required validator when validating `[BindRequired]`
- only use MVC error message when `[BindRequired]` is violated
- update that error message to more clearly describe the problem
- enable all tests skipped due to dupe bug #2493
- update expectations of a few tests using the old messages

nits:
- rename `ModelBinding_MissingRequiredMember` to `ModelBinding_MissingBindRequiredMember`
- remove `<param>` description of removed `requiredValidator` parameter
- remove unused `MutableObjectModelBinderTest.GetRequiredValidator()`
2015-06-05 16:56:05 -07:00
Doug Bunting cda2c6781c Use stable locale when testing date/time formats
- `CultureReplacerMiddleware` no longer helping `RazorWebSite`
 - regressed with @30d11a8
- `[ReplaceCulture]` sets up the correct culture early enough for consistent formatting
- remove `CultureReplacerMiddleware` from `RazorWebSite`
 - only `Startup` class we have that used this with `RequestLocalizationMiddleware`
 - testing `RequestLocalizationMiddleware`; so remove the confusing extra middleware
2015-06-05 14:25:51 -07:00
Kirthi Krishnamraju 30d11a8227 Added LanguageViewLocationExpander into framework and removed it from samples 2015-06-04 14:06:08 -07:00
Doug Bunting ffd1dc1fb0 Add support for generating baseline output files while testing
- baselines include both expected output and design-time line mappings
- controlled by GENERATE_BASELINES
 - assertions related to file content are not checked in this mode
- add design-time test of Basic.cshtml to `MvcRazorHostTest`
- regenerate all files to avoid BOM and blank line noise in future PRs
 - update out-of-date design-time Basic.cs file

nits:
- make a few variable names more consistent
- make `Assembly` fields `static`
- remove unused `_resourcesAssembly` field from `ErrorPageTests`
- remove `ResourceHelpers` which was specific to functional tests
2015-06-01 13:13:39 -07:00
Doug Bunting e31eab0391 `ByteArrayModelBinder` should return `null` only when type is not matched
- #2456
- visible behaviours now match MVC 5
- prevent `CollectionModelBinder` from converting no value to `byte[0]`
- prevent `TypeConverterModelBinder` from converting empty value to `byte[] { '\0' }`

nit:
- remove additional delegates `ModelBindingTestHelper.GetOperationBindingContext()` calls
 - a few left despite #2625 cleanup
2015-06-01 12:20:17 -07:00
CodingGorilla 70b56f157c Updated the ResponseCacheFilter class to store a reference to the CacheProfile passed into the contructor
Updated the ResponseCacheFilter Duration, Location, NoStore, and VaryByHeader properties to return one of 3 values: the specific setting applied to the instance, the setting supplied by the CachePolicy (from the constructor), or a default value.  The emphasis being not to change the outward function of these properties to consumers, but to defer the evaluation of these properties until the OnActionExecuting method.
Updated the ResponseCacheFilter to check whether a cache duration has been supplied when the NoStore property is false and throw an InvalidOperationException when a duration has not been provided.
Updated ResponseCacheFilterTest to reflect the changes in behavior in the ResponseCacheFilter
Updated the ResponseCacheFilterAttributeTest to reflect the change in the behavior of the ResponseCacheFilter

Added unit tests to ResponseCacheFilterTest.cs to verify that the CachePolicy properties are properly overriden with the properties set directly on the ResponseCacheFilter.

Added functional tests to test the ability to override CacheProfile settings with properties on the ResponseCacheAttribute
2015-05-29 12:28:14 -07:00
Harsh Gupta 4f419eee55 Removing creating ModelValidationNode by default in CompositeModelBinder.
This moves the responsibility of of MVN creation to individual model binders if they want the individual models to be validated.
2015-05-29 09:21:11 -07:00
Ryan Nowak 144c1d3cf4 Fix #2151 - Part 4 remove [Activate] support from controllers.
This change completely removes [Activate]. In a controller, you should
constructor injection or [FromServices] to access services.

To access context items (ActionContext, ActionBindingContext, root
ViewDataDictionary) you should use the respected attribute class.

We'd like to consider streamlining this further in the future by getting
down to a single injectable context for controllers, but for now this will
have to do.
2015-05-21 22:57:56 -07:00
Ryan Nowak af5322e2ce Part of #2151 - Remove [Activate] from TagHelpers
This change removes [Activate] support from TagHelpers. TagHelpers which
need access to context should use [ViewContext] to have it injected. To
access services, use constructor injection.
2015-05-21 22:57:51 -07:00
Ryan Nowak b393191cff Part of #2151 - Remove [Activate] from ViewComponents
This change removes [Activate] from ViewComponents. Accessing context
should be done through [ViewComponentContext]. Accessing services should
be done though constructor injection.
2015-05-21 22:57:45 -07:00
Ryan Nowak b64fd7ae39 Fix #2407 - Add back the implicit [Required] for value types
This change adds a [Required] client validator when
ModelMetadata.IsRequired == true. The bulk of the changes here are
mechanical updates to test files.
2015-05-21 17:52:25 -07:00
N. Taylor Mullen e689863461 Add required attributes to AnchorTagHelper and FormTagHelper.
- This involved also adding required attributes with wildcards.
- With this change AnchorTagHelpers and FormTagHelpers should no longer light up on every `<form>` or `<a>` tag.

#2581
2015-05-21 16:42:45 -07:00
Doug Bunting 8a701726b3 Rename _GlobalImport.cshtml files to _ViewImports.cshtml
- also rename files and directories with "GlobalImport" in name
 - nearly blind but avoid "ViewImportss" in new names
- public API change: `ViewHierarchyUtility.GetGlobalImportLocations()` -> `GetViewImportsLocations()`
 - primary source updates were comments, tests, and implementation details

nit:
- rename NestedGlobalImports.cs file to NestedViewImportsController.cs, matching class
2015-05-21 12:27:08 -07:00
Kirthi Krishnamraju 78033fda1f fix build break 2015-05-21 11:25:03 -07:00
Kirthi Krishnamraju 337bbad51d React to aspnet/Configuration #195,#198 and fix few minor build break issues 2015-05-20 20:01:23 -07:00
Ryan Nowak fa56df93c3 Fix #2407 - Part 1 - Make model binding behavior for [Required] compatible
with MVC5.

This change removes the behavior in model binding to validate values 'on
the wire' for requiredness instead of the looking at the model. This
restores the behavior of [Required] for model binding to the MVC5
semantics.
2015-05-19 15:57:56 -07:00
Ajay Bhargav Baaskaran 48e0b3261c [Fixes #2547] Fixed attribute value prefix with dynamic content being ignored 2015-05-18 17:15:38 -07:00
Harsh Gupta d0927bdc75 Fixes #2464 - Does not add extra skipped entries for model bound from services.
Also ensures that when a type is marked as skipped, any sub property which is model bound (and hence a modelstate un validated entry),
is marked as skipped (otherwise it would cause the ModelState to be invalid).
Also fixing a bug in model state dictionary FindKeyWithPrefix was not considering [0] & [0][0] as a valid prefix.
2015-05-15 12:27:43 -07:00
N. Taylor Mullen 12e4307f3a Add tests to account for aspnet/Razor#220.
- Added unit and functional test.
2015-05-15 12:13:15 -07:00
Kirthi Krishnamraju 8b5223518f Fix 2224: [Jsonpatch]Added tests for custom converters on properties 2015-05-14 17:18:42 -07:00
Ryan Nowak 7767251dad Adding some deserialization to a test for SerializableError 2015-05-14 15:38:50 -07:00
Ryan Nowak cc4ee1068d Fix #2414 Part 2 - Add [DefaultValue(...)] support to the invoker for
action parameters
2015-05-14 13:58:02 -07:00
Ryan Nowak 2fc983b23a Fix for #2414 - Remove [DefaultValue] support from ModelBinding
This part of the change removes default value support from ModelBinding.

Updated some unit tests to verify that it does nothing in that case.
Deleted a functional test as it was pure duplication of another
(supported) case where the property has a pre-initialized value.
2015-05-13 20:03:23 -07:00
Kiran Challa 4bed2e6f2b [Fixes #2545] RedirectToRouteResult doesn't use RouteName property when calculating destination URL 2015-05-13 12:35:25 -07:00
Kirthi Krishnamraju caa8ea44fb Fix #448: Support app-wide defaults for HTML helpers 2015-05-12 14:10:59 -07:00
Ryan Nowak 4939181075 Fix #2528 - Revert formatter behavior for [Required]
This change removes the support in the DCS formatter to issue an error
message when [Required] is used on a value type.
2015-05-12 11:17:31 -07:00
James Newton-King de630754bf SerializerSettings refactor
Add SerializerSettings to MvcOptions and pass those options to the JsonInputFormatter and JsonOutputFormatter.
Remove custom contract resolver.

PR feedback
Pass JsonSerializerSettings to JsonPatchInputFormatter

PR feedback
Make DI JsonOutputFormatter formatter use MvcOptions SerializerSettings

Fix JsonPatchInputFormatter using null ContractResolver

Fix tests
2015-05-11 16:43:17 -07:00
James Newton-King ab4cd5c4c4 Add JsonHelper for serializing JSON in views
- remove NotNull from JsonHelper Serialize
2015-05-11 16:01:08 -07:00
Ajay Bhargav Baaskaran d6012d4297 [Fixes #2506] Added overload to Controller.Json to accept JsonSerializerSettings 2015-05-11 12:36:45 -07:00
David Paquette ab4d2eec31 ImageTagHelper
An ImageTagHelper that supports cache busting by appending a file
version hash to the image src attribute
[Resolves #2249]

Code cleanup
2015-05-11 13:41:10 -05:00
Ryan Nowak 0f6b2331ce Fix #2378 - Fully expand models in ApiExplorer
This change dramatically simplifies the parameter discovery logic in
DefaultApiDescriptionProvider. Instead of surfacing POCO objects as
parameters, we now fully expand every model.

The rationale is that we want to show every key/value that can be set by
the user and not force consumers of ApiDescription to do that themselves.

Tests are cleaned up to match the new behavior.
2015-05-08 11:53:38 -07:00
N. Taylor Mullen 64e726d2b2 Update LICENSE.txt and license header on files. 2015-05-01 13:55:25 -07:00
Pranav K 124496a12f Use DateTimeOffset with fixed time zone in tests to allow it to work in
non-PST timezones.
2015-04-30 21:40:20 -07:00
Ajay Bhargav Baaskaran 89ebce0289 [Fixes #2336] Generate some input elements without value attribute 2015-04-29 13:47:17 -07:00
Kirthi Krishnamraju 30e54609cc Fix #1911 : Create a separate package for ApiExplorer 2015-04-28 13:13:20 -07:00
N. Taylor Mullen f152ea7004 React to aspnet/Razor#279 changes.
- Updated all tests and TagHelpers to utilize the new TagHelperOutput.Attributes and TagHelperContext.AllAttribute types.

aspnet/Razor#279
2015-04-27 14:30:30 -07:00
Kirthi Krishnamraju 924d50bd8f Added functionaltests for JsonPatchDocument 2015-04-22 13:44:25 -07:00
Kirthi Krishnamraju e48565dcd8 Adding errors in ModelState 2015-04-22 13:44:09 -07:00
Kirthi Krishnamraju 9d2b1822d9 Fix for #819 : Attribute Routing: Resolve Name + Token Replacement 2015-04-22 11:47:23 -07:00
Kiran Challa 162c4709c1 Refactor attribute route 2015-04-21 11:02:05 -07:00
Ryan Nowak 8bae02928d Fix build break 2015-04-20 12:44:30 -07:00
Ryan Nowak 2719111453 Add more details to ModelAttributes
This change adds more information to ModelAttributes, so that metadata
providers can look at the attributes on the property and type separately
if so desired
2015-04-17 17:35:20 -07:00
Ajay Bhargav Baaskaran a4fd51772f [Fixes #2276] Serialize only simple types to session in TempData 2015-04-17 14:30:47 -07:00
Pranav K fb451b51e5 Added SourceLocation to inherited chunks \ tag helpers
Updated CompilationResult to support compilation failures from multiple
files.

Fixes #2321
2015-04-17 11:23:38 -07:00
Ajay Bhargav Baaskaran f878ca5b15 [Fixes #1919] Added path info to RazorPage exceptions 2015-04-17 10:30:37 -07:00
ianhong 21031a3aa8 Add sample and functional test for custom inline constraints 2015-04-17 08:42:20 -07:00