Commit Graph

27 Commits

Author SHA1 Message Date
N. Taylor Mullen bd2a98e5ec Rename `Microsoft.AspNet.Razor.TagHelpers`.
- Name changed to `Microsoft.AspNet.Razor.Compilation.TagHelpers`.
- Changed folder locations to reflect namespace change.

#578
2015-10-22 10:25:19 -07:00
N. Taylor Mullen deaf2dc828 Enable `TagHelper`s to properly flatten to enable partial parsing.
- `TagHelper`s used to not flatten correctly resulting in inconsistent start locations for `SyntaxTreeNode`s following/within `TagHelper`s.
- This change indirectly corrected bad indentation that existed in generated C#.
- Added a test to validate `TreesAreDifferent` returns expected behavior when modifying content inside of `TagHelper`.
- Added `TagHelperBlock` `Flatten` test.

#553
2015-10-16 15:57:37 -07:00
Pranav K 11af72a9c6 Renaming Microsoft.Framework.* -> Microsoft.Extensions.* 2015-10-03 15:44:39 -07:00
Ajay Bhargav Baaskaran bc103fcaa4 Fix: Index out of bounds for incomplete attribute value
- #555
- Added a unit and a code generation test
2015-09-30 14:51:43 -07:00
N. Taylor Mullen 7239eb015c Add support for data bound symbols as attribute names.
- Took the HTML5 spec approach of disallowing specific characters and accepting all others.
- Added several parser and code generation tests to cover both `TagHelper` and non-`TagHelper` variations of symbol bound attribute names.

#137
2015-09-22 16:12:37 -07:00
Pranav K 9c456965a6 ITypeInfo.FullName should return the same value as TypeInfo.FullName
Fixes #523
2015-09-21 17:00:35 -07:00
Pranav K 388362245f Making HashCodeCombiner usage non-fluent
React to https://github.com/aspnet/Common/issues/40
2015-09-21 14:46:07 -07:00
N. Taylor Mullen fb6a08d5de Allow `TagHelper`s inside of text/html typed script tags.
- To limit the impact of the change ensured that we only do extra work in the case that we detect a script tag with a `type` attribute.
- The parsing changes include normal HTML parsing behaviors when we detect that a script tag has a `type` attribute with value `text/html`.
- Added unit and code generation tests to validate `text/html` script tag behavior.

#502
2015-09-17 21:14:40 -07:00
Ajay Bhargav Baaskaran 08c8f9f7ba Parse the whitespace surrounding equals in attribute correctly
- #123
 - Handled the corresponding cases in tag helper scenarios
 - Added unit and code generation tests
2015-09-08 11:43:37 -07:00
N. Taylor Mullen d458e8ecb2 Change HTML in nested C# blocks to properly handle dots.
- Prior to this change adding a `.` after an implicit expression would result in compile errors due to Razor thinking the `.` was part of the C# (normally not the case).
- Added a code generation and unit tests to validate behavior.

#491
2015-09-07 19:18:09 -07:00
Ajay Bhargav Baaskaran 39dda01f47 [Fixes #484] Attributes parsed correctly when newlines precedes attributes 2015-08-28 14:59:24 -07:00
N. Taylor Mullen d0688a7e00 Add the ability for `TagHelper`s to exist inside templates.
- Previously doing `@<mytaghelper />` was invalid due to how we constructed templates lambdas.

#489
2015-08-21 16:51:47 -07:00
Ajay Bhargav Baaskaran dad3e3ade3 [Fixes #441] Removed constructors from TagHelperAttributeDescriptor and
TagHelperDescriptor
2015-08-16 18:09:07 -07:00
N. Taylor Mullen 465ff9713d Add ability for `TagHelper`s to specify restricted children.
- Specifying the `RestrictChildrenAttribute` enables `TagHelper`s to only allow other `TagHelper`s targeting specified names to be in the children.
- Used the `null` value to indicate that `AllowedChildren` was not specified and therefore everything is allowed. This is the default.
- Added name verification to name values to ensure that no bad values pass through the system.
- Added parsing tests to validate a mixture of content generates errors when expected.

#255
2015-08-14 23:13:57 -07:00
Pranav K 3361507c29 Remove ability to specify ignored '@' in the middle of non-string
TagHelper bound attributes.

Fixes #436
2015-08-14 18:12:31 -07:00
N. Taylor Mullen e9292a0e30 Add ability to write start tag only `TagHelper` elements.
- To write a start tag only `TagHelper` you can now utilize the `TagStructure` property on the `TargetElement` attribute. If none is specified it'll be treated as unspecified and default to old behavior of being start/end tag or self-closing.
- Added `TagMode` to showcase what the user initially wrote in their Razor document. This way `TagHelper`s can flow end-to-end in thesame format as they were written with.
- Updated code generation to specify `TagMode` instead of the boolean self-closing.
- Updated existing tests to move from `SelfClosing` => `TagMode`.
- Added `TagStructure` related tests to the set of tests that we currently have for `TagHelperBlockRewriter` and `TagHelperParseTreeRewriter`.

#450
2015-08-13 16:18:06 -07:00
N. Taylor Mullen 4604c807c4 Add ability for unbound complex `TagHelper` attributes to flow through MVC attribute resolution system.
- Today MVC has specific rules about resolving Razor attribute values. Ex: `true` => attribute name being used as attribute value. This change ensures that unbound complex `TagHelper` attribute use that same logic.
- Added configuration to `GeneratedTagHelperContext` for `AddHtmlAttributeValues`.
- Had to be careful with code generating `AddHtmlAttributeValues`. In the case of `data-`; they can appear as complex attributes but may not contain any pieces that are `DynamicAttributeBlockChunk`s. Had to protect against this scenario.
- Updated existing test files.
- Added a new code gen test case to showcase the various use-cases of unbound dynamic `TagHelper` attributes.

#247
2015-08-10 11:29:22 -07:00
N. Taylor Mullen 48a6b567d6 Remove ~/ handling from core Razor.
- Removed parsing, chunk generation and code generation.
- Removed related tests.
- Did not modify existing unrelated tests with ~/ since it's just plain text and may be valid for end-users.

#427
2015-07-31 15:55:29 -07:00
N. Taylor Mullen e722f90481 Transition `HashCodeCombiner` to use the `aspnet/Common` variation.
- Updated `LocationTagged<TValue>` to handle `null` implicit values.
- Removed `InternalsVisibleTo` declaration on `Microsoft.AspNet.Razor` to the runtime test project.
- Updated `TagHelperDescriptor` tests to utilize helper methods to construct `TagHelperDescriptor`s. This was needed since the `InternalsVisibleTo` declaration was removed.

#449
2015-07-28 10:45:08 -07:00
Sornakumar Sundararajan 1f480386f4 Making CreateCodeWriter protected so that it can be overridden in Mvc. 2015-06-30 14:51:23 -07:00
N. Taylor Mullen 85be731e2b Add OutputElementHintAttribute to control design time IntelliSense for TagHelpers.
- Decided to not have the attribute inheritable since TargetElement is not inheritable.
- Added tests to validate serialization, deserialization and construction of TagHelperDescriptors with OutputElementHints.
- Changed TagHelperUsageDescriptor to TagHelperDesignTimeDescriptor and TagHelperAttributeDesignTImeDescriptor.

#382
2015-06-30 12:13:04 -07:00
N. Taylor Mullen 9055da1894 Add tests to validate creation of TagHelperUsageDescriptors.
- Could not add tests to validate the full TagHelperDescriptorFactory.CreateDescriptors => TagHelperUsageDescriptors due to how the runtime loads assemblies (does it in memory without XML).
- Added serialization tests to include TagHelperUsageDescriptors.
- Updated existing tests to use new TagHelperDescriptor/TagHelperAttributeDescriptor constructors.

#352
2015-06-25 15:10:38 -07:00
N. Taylor Mullen 0bb9457fd9 Change duplicate TagHelper bound attributes to flow to output.
- Duplicate TagHelper bound attributes used to be ignored entirely; they now flow to the output as if they were unbound.
- Added code generation test to verify duplicate attributes. Added runtime and design time versions.
- Updated existing tests that happened to have duplicate bound attributes.

#418
2015-06-25 11:11:04 -07:00
N. Taylor Mullen ddbd603653 Enable instrumentation for TagHelpers.
- Removed old code that disabled instrumentation for TagHelper bodies. Instrumentation will throw out sections for begin/end context that don't make it to the final output.
- Added instrumentation around WriteTagHelperAsync. Any content inside of the TagHelper will get sub-mapped via begin/end context.
- Hand verified BasicTagHelpers.cs begin/end context tests to ensure correctness.

#172
2015-06-10 12:52:25 -07:00
N. Taylor Mullen b0b4ac4f3f Enable TagHelper attributes to render in the order they were originally.
- This was accomplished by changing when/how TagHelper attributes are rendered. Previously they were rendered: Bound => Unbound. Now they're rendered in the order that they exist on the TagHelperChunk.
- Regenerated test files to account for new re-ordering of TagHelper attributes.
- Added duplicate, unbound HTML attribute, unminimized same name test to ComplexTagHelpers.
- Did not add additional tests (other than the one noted above) since the current tests seem to be heavily impacted by the re-organization of code rendering; effectively showcasing the fix.

#225
2015-06-04 15:32:45 -07:00
Doug Bunting d545f47fe4 Avoid errors when generating baselines
- ignore missing expected output resources in this mode
- update `BaselineWriter` to avoid `IOException`s (file access issues)
 - serialize file operations
 - one file handle per file
- repeatedly `rm TestFiles/CodeGenerator/Output/*; `dnx . test`; no errors

also
- add generation of design-time line mappings
- fix ChunkGenerator -> CodeGenerator typo in path names
- update files only if they have changed
 - new `TestFiles.Exists()` method to support this check
- do not check results in `CSharpCodeBuilderTests` if `GENERATE_BASELINES` set

nits:
- update BOM in CodeBlockWithTextElement.cs to avoid future `git diff`s
- use more `var` and improve variable names in `TestFile`
- wrap long lines
2015-06-01 08:42:23 -07:00
N. Taylor Mullen ed92b6992d Addressed code review comments. 2015-05-29 12:50:01 -07:00