Commit Graph

118 Commits

Author SHA1 Message Date
Ryan Brandenburg 8f8bf5af34 Seperate view and model for enum display 2016-11-30 11:13:38 -08:00
Pranav K 5b2a4aecb6 Make Microsoft.AspNetCore.Mvc.TestCommon a regular project
* This allows specifying all it's dependencies rather than for consuming projects to do this
* Remove unused APIs
* Fix weird downgrade warnings that show up due to P2P references
2016-11-23 16:23:56 -08:00
Pranav K 1506a44cd5 Fix downgrade warnings 2016-11-10 09:22:11 -08:00
Pranav K b82969a557 Updating versions to 1.2.0-* 2016-11-09 14:18:46 -08:00
Doug Bunting 6d4361218e Add builder extensions to simplify use of `CookieTempDataProvider`
- #5515
2016-11-08 15:32:09 -08:00
Kiran Challa 07a2f1de06 Fixes CookieTempDataProvider to set the secure attribute of a cookie only if a request is secure 2016-11-08 13:30:28 -08:00
Kiran Challa a3c06b00cc Fixes CookieTempDataProvider to handle empty request PathBase while setting cookie options 2016-11-08 13:30:27 -08:00
Kiran Challa 32710bbfbe [#5430] CookieTempDataProvider chunking broken 2016-11-01 16:13:27 -07:00
Jass Bagga f629f9a659 Check for null arguments in GetArgumentDictionary
Addresses #5423
2016-10-20 13:40:39 -07:00
Jaspreet Bagga c2fee4d74d AcceptedResult(), AcceptedAtActionResult(), AcceptedAtRouteResult() support
Addresses #4937
2016-10-18 09:48:26 -07:00
Doug Bunting eea297975d Reduce `HtmlContentBuilder` allocations
- #3918
- lazy-load `TagBuilder.InnerHtml`; add `HasInnerHtml` property for conservative use
 - depends on aspnet/HtmlAbstractions@0781b5a (adds `HtmlContentBuilder.Count`)
- don't use a `HtmlContentBuilder` at all in `DefaultHtmlGenerator.GenerateValidationSummary()`
- avoid instantiating `HtmlContentBuilder` when short-circuits make it unnecessary
- provide correct `HtmlContentBuilder` capacity where known
2016-10-17 14:38:30 -07:00
Pranav K a52d692de0 Updating to netcoreapp1.1 2016-10-13 11:21:09 -07:00
Pranav K ed1378a365 Revert "Updating to netcoreapp1.1"
This reverts commit 398a104810.
2016-10-12 16:09:12 -07:00
Pranav K 398a104810 Updating to netcoreapp1.1 2016-10-12 14:24:52 -07:00
Yves57 ed3b750ad2 Less allocations in ViewBuffer when there is only one ViewBufferPage 2016-10-07 11:25:30 -07:00
Doug Bunting 4e6fd823cf Fix bounds checking in `PagedCharBuffer` and related code
- #5347
- inconsistent bounds checking caused problems after `ArrayPool<char>` fell back to `new char[2048]`
 - would fail a `Debug` assertion in Debug builds and loop endlessly in Release builds
- change to `CacheTagHelper+CharBufferHtmlContent` is for correctness only
 - always uses a `CharArrayBufferSource` and that returns arrays of the exact size requested
2016-10-04 10:19:44 -07:00
Pranav K 6fe683c585 Add Microsoft.DotNet.InternalAbstractions to fix tests 2016-10-04 10:11:09 -07:00
Pranav K 6d235e4ef5 Update partner package versions 2016-10-03 14:27:20 -07:00
Kiran Challa 89bd6dc1cd [Fixes #5212] Added a cookie based ITempDataProvider 2016-10-03 14:04:57 -07:00
Doug Bunting 4cca6b09f0 Reduce allocations during HTML generation
- #3918
- precompute size of `StringBuilder` in `ExpressionHelper`
- reduce `string` allocations in `ViewDataEvaluator`
 - also get rid of `Enumeration` state machines
- reduce the size of a few objects; use more expression-valued properties
 - e.g. don't store `_modelType` in `ModelExplorer`
- add `EmptyArray<TElement>`; make empty arrays consistently `static`
- avoid `string.Split()` in HTML and tag helpers

nits:
- make `ExpressionHelperTest` tests more stringent
- correct `Message` for an `ArgumentNullException`
- remove excess `using`s in classes I touched (but often ended up leaving otherwise unchanged)
- improve doc comments
- remove `ToString()` call on a `string`
- avoid encoding `string.Empty`
- fix test file name
- remove useless variables
- correct spelling
- improve whitespace
2016-10-03 12:17:47 -07:00
Ryan Brandenburg 261f73abc7 Add NonViewComponentAttribute 2016-09-30 10:56:08 -07:00
Doug Bunting f222fa4349 Correct examination of `IHtmlHelper.Label()` return value
- #5317
- previously worked only because `TagBuilder` cannot be empty and `HtmlString` overrides `ToString()`
 - `TagBuilder.ToString()` (now the type's `FullName`) is also never empty
- copy `NullHtmlEncoder` from Razor and give it a better name (`PassThroughHtmlEncoder`)
 - not available in this project and (from its namespace) not intended for general use
2016-09-27 10:00:29 -07:00
Pranav K 760c8f3867 Ensure Append writes to the right page after Clear 2016-09-14 18:57:21 -07:00
Ajay Bhargav Baaskaran 42027b6cc2 [Fixes #5243] Handle null values in TempData properly 2016-09-14 15:41:38 -07:00
Pranav K d9ff1d81d6 PagedBufferedTextWriter does not flush synchronous data prior to writing data asynchronously
Fixes #5241
2016-09-14 14:52:06 -07:00
Pranav K 43071319aa Buffer rendered CacheTagHelper content strings to a custom TextWriter
Fixes #4893
2016-09-14 14:47:37 -07:00
Doug Bunting 809d2bf7ec Add `ValidationHtmlAttributeProvider` to make `AddValidationAttributes()` available
- #5028
- helpers similar to our HTML or tag helpers can use the new singleton to examine or add validation attributes
 - in the most common case, helpers add validation attributes to a `TagBuilder`
- separate `DefaultValidationHtmlAttributeProvider` from `DefaultHtmlGenerator`
 - avoids creating two instances of the `DefaultHtmlGenerator` singleton
 - would be even uglier to require callers to cast an `IHtmlGenerator` to `ValidationHtmlAttributeProvider`
- `[Obsolete]` old `DefaultHtmlGenerator` constructor
2016-09-13 21:07:18 -07:00
Doug Bunting eee1a9fef4 Do not generate a validation summary when `excludePropertyErrors` unless specific model has an error
- #5209
- update affected `HtmlHelperValiationSummaryTest` and functional tests
- add `ValidationSummaryTagHelperTest` tests to cover related scenarios

##### Behaviour changes when no errors exist for the model:
###### Tag helper
``` html
<div asp-validation-summary="ModelOnly" class="order"><h3>Oopsie<h3></div>
```
previously generated
``` html
<div class="order validation-summary-errors"><h3>Oopsie</h3><ul><li style="display:none"></li>
</ul></div>
```
and now generates
``` html
<div class="order"><h3>Oopsie</h3></div>
```
###### HTML helper
``` c#
@Html.ValidationSummary(excludePropertyErrors: true, message: "Oopsie")
```
previously generated
``` html
<div class=\"validation-summary-errors\"><span>Oopsie</span>
<ul><li style=\"display:none\"></li>
</ul></div>
```
and now generates nothing (`@HtmlString.Empty`).
2016-09-08 15:36:47 -07:00
Ryan Brandenburg 830983a477 Fixes #5198 Stops caching of Enum display values (#5185)
Fixes #5197 GetEnumSelectList uses IStringLocalizer
Fixes #4215 Html.DisplayFor now checks DisplayAttributes on enums
2016-09-07 16:00:17 -07:00
Ajay Bhargav Baaskaran a6a4b5369a [Fixes #5166] Support passing instance directly when invoking ViewComponents with single parameter 2016-08-26 16:33:42 -07:00
N. Taylor Mullen 7036e2b0f5 Change `ViewComponent.View()` to flow the `ViewData.Model`.
- This is more consistent with how controllers work.

#4882
2016-08-25 10:22:23 -07:00
Pranav K 67dce322df Updating to Moq \ Castle.Core that does not require imports 2016-08-08 12:20:14 -07:00
Doug Bunting 8a6e99c7c0 Always render antiforgery tokens if `!CanRenderAtEndOfForm`
- #5005
- also add `FormContext` doc comments
2016-07-20 15:25:08 -07:00
ivano scifoni 581a5ea573 column attribute for <textarea> is incorrect (#5049)
- Modify tagBuilder.MergeAttribute key to cols
2016-07-20 09:22:39 -07:00
Doug Bunting e5cb6f9595 Add `null` check for `ModelStateEntry.Children`
- #4989
2016-07-18 14:02:17 -07:00
Ryan Brandenburg 310ab25347 Make tests resilient to Localization (#5011) 2016-07-14 09:28:01 -07:00
Doug Bunting 7430efa8cc One build to rule them all
- well, at least VS and command-line builds will share output
- part of aspnet/Coherence-Signed#277
2016-07-06 16:21:18 -07:00
Ajay Bhargav Baaskaran e7de647c10 [Fixes #453] Added unit tests for Display and Value Extensions
- Added more HtmlHelper tests
- Added some tests to cover complex expressions
2016-07-06 15:39:26 -07:00
Pranav K 222165e145 Updating to RTM builds of xunit and Moq (#4946) 2016-07-05 20:58:16 -07:00
Medeni Baykal 4fe758240f Added `ViewResultTest`s. (#4939)
* Added `ViewResultTest`s.
* Fixed the namespace and folder of `PartialViewResultTest `; and some minor fixes.
2016-07-05 15:25:20 -07:00
Doug Bunting 42cea41737 Fail more gracefully when option collections cleared
- #4690
- move `ModelBindingMessageProvider` init from `DefaultBindingMetadataProvider` to `DefaultModelMetadata`
 - in addition to avoiding error cases, this removes some boilerplate
- add specific errors to `BodyModelBinderProvider`, `CompilerCache`, `CompositeViewEngine`, `ModelBinderFactory`,
  and `ObjectResultExecutor`
 - `DefaultRazorViewEngineFileProviderAccessor.FileProvider` now a `NullFileProvider` in empty case
2016-06-30 14:52:50 -07:00
Medeni Baykal a852352223 Fix for https://github.com/aspnet/Mvc/issues/4903. (#4907)
Fix for https://github.com/aspnet/Mvc/issues/4903.
- `HtmlHelperTextAreaTest` added
- fix up `HtmlHelperTextBoxTest`
2016-06-29 10:11:54 -07:00
Crystal Qian e51a118a9d Added consistent model property to view result variants (#4901)
* Added consistent model property/tests to ViewResult, PartialViewResult, ViewComponentResult. This resolves #4813.

* Removed unnecessary model asserts

* Removed redundant model checking
2016-06-28 09:38:37 -07:00
Doug Bunting f8c7f1ab78 Add more tests using `[ViewComponent(Name = "...")]`
- #4851
2016-06-19 13:52:59 -07:00
Shahriar Gholami 94fa34ca41 TempData convenience property added to ViewComponent (#4873)
* TempData convenience property added to ViewComponent

 #4728

* PR feedback
2016-06-17 10:15:50 -07:00
Pranav K cd7954a164 Updating to dev versions 2016-06-16 10:40:11 -07:00
N. Taylor Mullen 8499e3d6bb Remove direct Microsoft.NETCore.Platforms dependency.
- Microsoft.NETCore.App now pulls this package in.

aspnet/Coherence-Signed#344
2016-06-13 15:30:27 -07:00
jacalvar 4b5df98bc3 [Fixes #4224] Remove use of service locator on ViewExecutor 2016-05-31 23:39:22 -07:00
jacalvar 6a6d2e0d9f [Fixes #4506] Move and rename ActionDescriptor.Name to ControllerActionDescriptor.ActionName 2016-05-31 23:13:20 -07:00
jacalvar 5f4ca4fa66 [Fixes #4223] Added a facade for ViewComponentResult 2016-05-31 22:47:33 -07:00