Commit Graph

32 Commits

Author SHA1 Message Date
Jass Bagga e681c23d5c Add ITagHelperComponentManager (#6302)
Addresses #6282
2017-05-23 13:22:15 -07:00
Jass Bagga 87bb1d0ff5 Refactor GenerateCheckBox (#6229)
Addresses #5981 and #5983
2017-05-05 11:53:53 -07:00
N. Taylor Mullen f165914b40 Update how `FormTagHelper` handles `get` method attributes.
- Added functional test to verify `asp-*` attributes on form taghelpers work as expected.
- Added a unit test to validate `FormTagHelper` behaves as expected.
- Moved `Method == "get"` checks into appropriate code paths. These include the one where a user specifies an empty or non-existent `action` attribute and where a user doesn't utilize any `asp-*` attributes. In the later, we default `Method` to `"get"` if it's not provided.

#6006
2017-04-25 15:17:15 -07:00
N. Taylor Mullen ef0333ac6a Add Antiforgery to the FormTagHelper pre-check for processing.
- Added a test case to the HtmlGeneration functional test (the one verifying complex FormTagHelpers).
- Added unit test verifying antiforgery behavior when it's the only provided parameter.

#6006
2017-04-24 21:46:54 -07:00
N. Taylor Mullen 5c8a161ace Change `FormTagHelper` to apply to all form tags.
- Added functional test to validate that non-attributed form tags have an antiforgery input generated. Re-generated baseline to reflect changes.
- Added a unit test to validate that parameterless `FormTagHelper`s behave as expected.

#6006
2017-04-24 18:39:01 -07:00
N. Taylor Mullen 83faaebdb6 Upgrade Roslyn dependency to 2.0.0.
- Added C# 7 unit and functional test to validate features work end-to-end.

#6149
2017-04-21 11:41:31 -07:00
Doug Bunting 1672820e4e Add functional test covering an `IList<T>` property
- #5656
2017-03-29 12:32:06 -07:00
Jass Bagga eda5028cf4 Add TagHelperComponentTagHelper
Addresses #5728
2017-03-29 11:29:24 -07:00
Ajay Bhargav Baaskaran 7985121bab [Fixes #5207] Support IsIndexer for ViewComponent tag helpers 2016-11-03 16:50:22 -07:00
Ajay Bhargav Baaskaran c28ad48e98 [Fixes #5216] Make generic parameters work with ViewComponent tag helpers 2016-11-02 15:55:23 -07:00
Ajay Bhargav Baaskaran 5b9c01e54d Added a functional test for ViewComponent tag helpers
- Added Copyright ViewComponent tag helper
 - Added Dan ViewComponent tag helper
2016-10-21 16:17:13 -07:00
cjrosa 60d600dd5c Issue #5310 (#5334)
* Issue #5310
2016-09-30 09:40:53 -07:00
Doug Bunting 0a4c06eefb Suppress validation summary `<div>` when nothing is generated
- #2372
- make the `ValidationSummaryTagHelper` behave consistently with `Html.ValidationSummar()`
2016-09-27 15:51:51 -07:00
Doug Bunting 27e4822a7b Preserve `class` casing when merging a `TagBuilder` into a `TagHelperOutput`
- #5313

Also:
- preserve existing `TagHelperAttribute.ValueStyle`
 - fix this in `UrlResolutionTagHelper`, `LinkTagHelper`, and `ScriptTagHelper` as well
- correct handling of non-`string` `classAttribute.Value`s in `TagHelperOutputExtensions`
 - relates to #3918 because new `ClassAttributeHtmlContent` is smaller than any concatenated attribute value

nit: clean up `CacheTagHelper` whitespace and `using`s
2016-09-26 15:56:30 -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
N. Taylor Mullen d60ed06c19 Add link tag attributes to generated fallback tags.
- Updated functional tests and link tag script to include modified extra attributes content.

#4084
2016-07-29 16:30:56 -07:00
N. Taylor Mullen cfd58f1747 React to aspnet/Razor#705
- Updated `ScriptTagHelper` and `LinkTagHelper` to maintain their quotes on generated script tags.
- Removed `TagHelperOutputExtensions`. It's no longer needed.
- We no longer string replace quotes directly. We rely on encoding and the initial representation of an attribute to ensure quotes don't break generated attributes.
- Updated tests.
2016-05-27 12:00:01 -07:00
Kiran Challa 93be3dee6e Fix FormTagHelper to set flag indicating generation of AntiforgeryToken
[Fixes #4595] Better error message with extraneous @Html.AntiforgeryToken
2016-05-20 04:29:01 -07:00
Doug Bunting e3db547011 Add `[Remote(routeName : "name")]` tests
- relates to #4445
- also relates to #4309 / fb07fee though restored and renamed files are slightly different
 - latest Unobtrusive version; copy just one file under `wwwroot`
- add JavaScript file and CDN links to enable manual testing of `[Remote]` tests in `BasicWebSite`
 - include renamed files for recreating the minimized JavaScript file manually
2016-05-03 12:25:00 -07:00
Doug Bunting f05f6d5bd2 Quick fix: Simplify `OrderUsingHtmlHelpers.cshtml` layout
- intent was to make HTML helper output close to the tag helper output but source got over-complicated
- the output files for `Order.cshtml` and `OrderUsingHtmlHelpers.cshtml` now differ only in attribute order
 - i.e. HTML helpers output attribute alphabetically while tag helpers output them in order added
2016-05-02 12:55:11 -07:00
Pranav K 92408a5c22 Move samples to Entropy
Partial fix to #4449
2016-05-02 10:06:17 -07:00
Ajay Bhargav Baaskaran e74aa54d95 React to aspnet/Razor#738 2016-04-27 16:54:16 -07:00
Doug Bunting 7a1ac034f9 Special-case use of `razorPage.Model` property in `ExpressionMetadataProvider`
- #3978
- better-aligns `ExpressionMetadataProvider` with `ExpressionHelper`

nit: mock less in `RazorPageCreateModelExpressionTest`
2016-04-15 17:15:33 -07:00
Doug Bunting a0c8834c70 Preserve existing metadata in `ViewDataDictionary` where possible
- #4116
- generalize rules for `ModelMetadata` creation; minimize metadata changes when Model is updated
 - down to a single special case in VDD for `Nullable<T>`
 - note existing functional tests did not need to change
- remove `ViewDataDictionary(ViewDataDictionary, object)` constructor; use `new VDD<object>(source, model)`
- allow all `Model` assignments in a view component
 - copy-constructed VDD in `ViewComponentContext` previously preserved the source's declared type

nits:
- do not call `virtual SetModel()` method from constructor; now mostly redundant
 - logic in copy constructor and `SetModel()` is consistent but different enough to keep code separate
- add some missing doc comments
- fix doc comment property versus type confusion; never need to specify `ViewDataDictionary.` prefix
- fix a few `TemplateBuilder` comments and remove unnecessary `model: null` argument to VDD constructor
2016-04-08 14:44:36 -07:00
Pranav K f651f18d3a Use a prefix tree as a backing store for ModelStateDictionary 2016-03-17 10:09:36 -07:00
Doug Bunting ffe2d2609a Correct HTML and JavaScript encoding of `<link>` and `<script>` attribute values
- #4083
- `<link>` tag helper did not HTML encode `href` values in fallback elements
- `<script>` tag helper did not correctly encode any attribute value in fallback elements
 - e.g. double quotes in literal strings would slip through
- only needed to change one existing unit test (!!); so added a bunch

nit: use `Process()`, not `ProcessAsync()` in `<script>` tag helper tests
2016-03-11 20:07:32 -08:00
ryanbrandenburg f1fa1bd8f4 * Remove JsonViewComponentResult 2016-03-11 11:40:54 -08:00
jacalvar 6b369ef291 [Fixes #4102] DefaultHtmlGenerator should attempt to properly format values for `<input type="date">` and `<input type="time">` 2016-03-09 17:22:02 -08:00
N. Taylor Mullen 5612ca845f React to aspnet/Razor#684.
- Modified `UrlResolutionTagHelper` to utilize new CSS selector attributes to restrict when it applies. It now only appies to tags that have their values starting with `~/`.
- `UrlResolutionTagHelper` no longer applies to dynamic content such as `href="@SomethingResultingInTildaSlash"`.
- Updated tests to reflect new behavior.
2016-03-08 12:17:16 -08:00
N. Taylor Mullen 096007b394 Updated `Controller`s `ViewComponent` method to handle arguments.
- This bit was missed when changing the `ViewComponent` invocation pattern resulting in the inability to invoke `ViewComponent`s with arguments in a `Controller`.

#4004
2016-02-02 15:42:23 -08:00
Doug Bunting 7446cec516 Update `TagHelperSampleTest` to avoid failures due to statefulness of the service
- have one test muted at the moment in our CI
- add `Reset()` action to the service, enabling `// Arrange` to bring `Index()` content to a known state
  - add a couple more tests to `TagHelperSampleTest` covering the new action and empty `Index()` list

nits:
- use `ViewData`, not `ViewBag`
2016-01-26 10:50:51 -08:00
N. Taylor Mullen 6a6c8ca544 Rename AspNet 5 folders and files.
See https://github.com/aspnet/Announcements/issues/144 for more information.
2016-01-22 12:17:07 -08:00