Commit Graph

486 Commits

Author SHA1 Message Date
Ryan Nowak 229724c4ea Reorganize MVC namespaces 2015-09-01 22:28:33 -07:00
Daniel Lo Nigro a2e53e8d1a Explicitly check if URI is file when checking for an absolute URI 2015-09-01 16:33:00 -07:00
Ryan Nowak 98b3f055e1 Change ModelBinding to use a single pass 2015-08-31 11:58:53 -07:00
Kiran Challa e12d44b40a [Fixes #2900] Get rid of manual body-read-state-tracking 2015-08-31 10:34:42 -07:00
Ryan Nowak 66a7c2e389 Revert "Enabling ViewEngine and Localization tests which use expanders. The issues are fixed in the mono beta 4.0.4."
This reverts commit 9915ea3809.
2015-08-31 08:55:31 -07:00
sornaks 9915ea3809 Enabling ViewEngine and Localization tests which use expanders. The issues are fixed in the mono beta 4.0.4. 2015-08-29 16:55:14 -07:00
Chris R f2db0d1483 React to string[] -> StringValues changes. 2015-08-28 16:36:19 -07:00
Sornakumar Sundararajan e8043f92e5 Issue #2757 - Adding Order to exception filters so that they are executed in the same order irrespective of the platform. 2015-08-28 11:22:11 -07:00
Ajay Bhargav Baaskaran 4fbaea2463 [Fixes #2931] AttributeRoute does not replace existing route values with null 2015-08-28 11:11:03 -07:00
N. Taylor Mullen cc5c0d6cbe Update `HelperResult` to take in an async func.
- The corresponding Razor change results in `HelperResult`s being rendered with async lambdas.
- This change enables `TagHelper`s and other async code to exist inside of `HelperResult` blocks.
- Added test to validate Templates (they generate `HelperResult`s) can utilize `TagHelper`s correctly.
- Rename `RazorPage`s `RenderBodyDelegate` to `RenderBodyDelegateAsync`.

aspnet/Razor#494
2015-08-25 22:37:17 -07:00
Ryan Nowak 6d365e9a32 Make ValueProviderResult a string-ish struct 2015-08-21 11:02:40 -07:00
N. Taylor Mullen c3e2e6fa0a Change Script, Link and Image `TagHelper`s to work better with other `TagHelper`s.
- `ScriptTagHelper`, `LinkTagHelper` and `ImageTagHelper` now default to using `output.Attributes["href|src"]` if it's present when they run. This enables other `TagHelper`s to run prior and add those attributes.
- Added unit tests to validate this behavior.
- Updated `ImageTagHelper` functional test resources. Now that we're always defaulting to `output.Attributes["src"]` for `ImageTagHelper.Src` we're properly copying attributes back into the `output.Attributes` collection in the correct order (isntead of appending to the end).

#2902
2015-08-20 20:41:28 -07:00
Pranav K 05226a4a55 Refactor ICompilerCache to be instantiated via ICompilerCacheProvider
Fixes #2933
2015-08-20 10:54:32 -07:00
N. Taylor Mullen f1eefdb650 Enable `CopyHtmlAttribute` to maintain copied attribute order.
- Updated implementation to do a best guess at copying an attribute back into `TagHelperOutput.Attributes`.
- Updated existing functional and unit tests to account for maintained attribute order.
- Added a set of complex order based unit tests to validate `CopyHtmlAttribute` properly maintains order.

#2639
2015-08-19 14:58:00 -07:00
Ryan Nowak 9d89a8cac3 Homogenize MVC startup code patterns
Use builder APIS for both AddMvc() and AddMvcCore()
Change various API patterns to all use .AddXyz(...) off of one or both of
these builders.
2015-08-16 18:48:24 -07:00
Ryan Nowak 07fabde92a Part 3 of #2776 - revert a6ce9abab1 and add
some more tests.

This change reverts the behavior change from
a6ce9abab1 and adds more tests around the
scneario that was actually broken.

The right behavior is that unconvertable values result in a validation
error. There's no special behavior around value types and required values.
2015-08-16 16:20:44 -07:00
N. Taylor Mullen e73e73acdd Add `srcset` to list of application relative resolvable URLs.
- Now allow the attribute to exist on `img` and `source` tags.
- Updated existing `UrlResolutionTagHelper` functional test to validate `srcset` attribute.

#2964
2015-08-14 15:58:02 -07:00
N. Taylor Mullen 21d96eb16a Enabled `LinkTagHelper` to be written in the void format.
- Updated existing tests to showcase it can be written as just the start tag.
2015-08-13 16:19:30 -07:00
N. Taylor Mullen e1572f98ce Added `InputTagHelper` `TagRenderingMode` modificaitons to react to `output.TagMode`. 2015-08-13 16:19:29 -07:00
N. Taylor Mullen 1b51f6bca6 Enable input, image and url resolution `TagHelper`s to be written as void elements.
- Razor rendering now understands `TagMode` which allows void elements to be rendered.
- Added a `TagStructure.WithoutEnd` bit to `InputTagHelper`, `ImageTagHelper` and `UrlResolutionTagHelper`. This will allow users to write the various elements in the void format. Used the HTML5 spec to determine the elements appropriate.
- Added tests to ensure `TagMode.StartTagOnly` is rendered properly.
- Updated a few functional tests to showcase the void element formats.

aspnet/Razor#450
2015-08-13 16:19:28 -07:00
Ajay Bhargav Baaskaran ecfbdf2ae1 React to aspnet/Razor#428 2015-08-13 15:48:16 -07:00
Ryan Nowak a6ce9abab1 Fix #2776 - Add implicit [BindRequired] for value type properties 2015-08-13 15:35:54 -07:00
Pranav K 3558c1d979 Reacting to Logging changes 2015-08-13 11:22:28 -07:00
Ryan Nowak 12ceb6ae1c React to DI namespace change part 3. 2015-08-11 15:44:47 -07:00
Doug Bunting d45e2ee3f5 Handle broader range of collection types in model binding
- #2793
- add `ICollectionModelBinder`, allowing `GenericModelBinder` to call `CreateEmptyCollection()`
- adjust `CollectionModelBinder` and `DictionaryModelBinder` to activate model if default types are incompatible
 - do not create default (empty) top-level collection in fallback case if Model already non-`null`
- change type checks in `GenericModelBinder` to align with `CollectionModelBinder` capabilities
 - add special case for `IEnumerable<T>`
- correct `ModelMetadata` of a few tests that previously did not need that information
2015-08-11 08:26:49 -07:00
sornaks b6a109e2a3 Making DefaultDisplayTemplates and DefaultEditorTemplates use IHtmlContent.
- Making TagBuilder's InnerHtml an IHtmlContent.
- Delay encoding until the content is written.
- Moving BufferedHtmlContent to Common cos it is used in aspnet/Razor also.
- Changing GenerateOption to take in a string and create StringHtmlContent.
- This reduces the space used by around 13%.
2015-08-10 14:55:34 -07:00
N. Taylor Mullen a0da6ec19f Add `AddHtmlAttributeValues` for `TagHelper`s.
- Refactored `WriteAttributeTo` to allow re-use of some of the core attribute writing logic. The refactoring was based on removing the `Begin`/`EndContext` for instrumentation bits which isn't valid in a `TagHelper` attribute scenario.
- Added unit tests to validate attributes are properly added to `TagHelperExecutionContext`.
- Added functional test to validate everything is output as expected with dynamic attributes (encoded and non-encoded).

aspnet/Razor#247
2015-08-10 12:06:02 -07:00
KevinDockx 94fad918a3 Replace of Add operation (jsonpatch dynamic support) 2015-08-07 16:10:07 -07:00
Pranav K dfacd2543b * Remove support for updateable precompiled views.
* Allow precompiled views to be served when source file does not exist in
  file system.
* Cache results for views that do not exist on disk.

Fixes #2462 and fixes #2796.
Partially addresses #2551
2015-08-07 11:08:48 -07:00
Ajay Bhargav Baaskaran fcad4c5c57 [Fixes #2841] Support comma separated globbed include and exclude pattern in Script and Link tag helpers 2015-08-06 16:55:12 -07:00
Pranav K 43e4870fa2 Switching to the official Autofac package. 2015-08-04 15:12:19 -07:00
N. Taylor Mullen 0ef68eefc8 Added default `UrlResolutionTagHelper` to resolve app relative URLs.
- Razor removed the ability to automatically resolve URLs prefixed with `~/`; therefore `ScriptTagHelper`, `LinkTagHelper` and `ImageTagHelper` have changed to take in `IUrlHelper`s and auto-resolve their URL based properties if they start with `~/`.
- Added a catch-all `~/` resolver for non `TagHelper` based HTML elements. Razor used to resolve any attribute value that started with `~/` now the behavior is restricted to attributes that can contain URLs.
- Updated `IUrlHelper` to accept `null` values.
- Added functional tests to validate that URLs resolve correctly.
- Updated `TagHelper` tests to ensure that URLs are resolved via an `IUrlHelper`.

#2807
2015-08-03 16:00:33 -07:00
Ajay Bhargav Baaskaran 2792f10f9a [Fixes #2862] asp-append-version now works with urls containing fragment 2015-08-03 12:06:18 -07:00
Ajay Bhargav Baaskaran e4049c07eb Razor boolean and null attribute special case handled correctly
- Issue #2769
 - Special case is only applied to null and bool value with no surrounding
   whitespace
2015-07-30 10:37:38 -07:00
Victor Hurdugaci e96b4d7b94 React to DNX renames 2015-07-29 04:49:49 -07:00
Ryan Nowak e91ce4560f Fix #2338 - Add ViewComponentResult
Makes it easier to render a view component from inside a controller. This
makes it possible to implement behavior where an ajax request refreshes
part of a page.
2015-07-23 17:52:52 -07:00
Andrew Stanton-Nurse 991dff6b9e react to DNX renames 2015-07-21 17:23:06 -07:00
Doug Bunting b908a7ef6a React to `IAssemptyEnvironment` breaking change 2015-07-20 17:24:13 -07:00
Tugberk Ugurlu 81f8b3edfb removed packExclude from unnecessary places, replaced it with
publishExclude and removed kproj and xproj excludes
2015-07-20 16:49:59 -07:00
Doug Bunting 79a2982441 Add support for model binding dictionaries from `prefix[name]=value` entries
- #1418
- add new fallback binding in `DictionaryModelBinder`
 - similar to MVC 5 approach but more explicit and with better key conversion support
- fix bugs in `PrefixContainer` encountered while adding new tests of #1418 scenarios
 - did not handle entries like "[key]" or "prefix.key[index]" correctly
 - refactor part of `GetKeyFromEmptyPrefix()` into `IndexOfDelimiter()`; share with `GetKeyFromNonEmptyPrefix()`
 - extend `ReadableStringCollectionValueProviderTest` to cover bracketed key segments

nits:
- remove use of "foo", "bar", and "baz" in affected test classes
- `""` -> `string.Empty`
- `vpResult` -> `result`
2015-07-20 16:33:35 -07:00
Kirthi Krishnamraju d8a523a07f Added Mvc localization project 2015-07-16 15:57:24 -07:00
Ajay Bhargav Baaskaran 92f3e21fe6 Fix: Metadata ignored for non model-specific EditorTemplate
Issue - #2778
2015-07-16 15:48:01 -07:00
Kiran Challa 99699d9491 React to ErrorPage middleware changes. 2015-07-15 10:27:26 -07:00
Mugdha Kulkarni 933a13608f Adding fix for 2756 and test cases. Skipping the test cases for 2793. 2015-07-10 15:58:36 -07:00
Ryan Nowak ccb2f2deda React to move of StatusCodes 2015-07-08 12:43:33 -07:00
Ryan Nowak e985fa5d42 Split up MVC.Extensions into smaller packages
Startup.cs API experience to follow in a separate change. This change just
gets the bulk of the code churn out of the way.
2015-07-06 23:41:22 -07:00
N. Taylor Mullen fc2019c973 Modify `TypeConverterModelBinder`'s `ModelBindingResult.IsModelSet` to be false when model value is `null` for non-null accepting types.
- Previously `ModelBindingResult.IsModelSet` would be set to true if type conversions resulted in empty => `null` values for ValueTypes. This resulted in improper usage of `ModelBindingResult`s creating null ref exceptions in certain cases.
- Updated existing functional test to account for new behavior. Previously it was handling the null ref exception by stating that errors were simply invalid; now we can provide a more distinct error.
- Added unit test to validate `TypeConverterModelBinder` does what it's supposed to when conversions result in null values.
- Added additional integration tests for `TypeConverterModelBinder`.

#2720
2015-07-02 20:03:32 -07:00
sornaks 68523a3550 Fixing tests in Mono.
- Disabling tests which have corresponding bugs in mono.
- Fixing a few tests which do not handle *nix file system.
- Updating Travis configuration to use mono's alpha bits.
- Introducing PlatformNormalizer to normalize content across multiple platforms.
2015-07-02 17:24:14 -07:00
Ajay Bhargav Baaskaran 6213354b85 Fixes for FileVersionProvider
- Path with query string works
 - No exception is thrown for absolute path
2015-06-30 11:25:32 -07:00
Hao Kung 7c426f7835 React to Http/AuthNZ changes 2015-06-25 17:30:09 -07:00