Commit Graph

178 Commits

Author SHA1 Message Date
N. Taylor Mullen c67ec264ed Modify tests to use new ITagHelperDescriptorResolver signature.
- Updated all of the tests to use the new ITagHelperDescriptorResolver signature so instead of passing strings they now construct TagHelperDescriptorResolutionContexts.
- Removed several tests from the AddOrRemoveTagHelperSpanVisitorTests. This was due to the change in responsibility of managing the found TagHelperDescriptors; the TagHelperDescriptorResolver now does this.
- Added several new tests to verify the TagHelperDescriptorResolver manages resolved TagHelperDescriptors based on the given TagHelperDirectiveDescriptors.

#214
2014-11-20 10:42:55 -08:00
N. Taylor Mullen c35d19142c Add ability to resolve all TagHelperDescriptors with one method call.
- Modified the AddOrRemoveTagHelperSpanVisitor to no longer manage TagHelperDescriptors found in the system. Instead it now manages TagHelperDirectiveDescriptors which are then used to resolve TagHelperDescriptors.
- Changed the signature of ITagHelperDescriptorResolver to take in a TagHelperResolutionContext which will allow us to pass more information without breaking tooling.
- TagHelperDescriptorResolver now resolves all TagHelperDescriptors at once and manages descriptors found in the system based on values on the provided TagHelperDirectiveDescriptors.

#214
2014-11-20 10:42:46 -08:00
N. Taylor Mullen 64a5b8ee22 Addressed code review comments. 2014-11-19 10:07:33 -08:00
N. Taylor Mullen bad8b16a2a Add extensibility point to resolve descriptors in assembly.
- Modified our default TagHelperDescriptorResolver to provide a protected virtual method that it uses under the covers to resolve descriptors for an entire assembly. This will enable tooling to cache descriptors on a per-assembly basis.

#214
2014-11-14 10:45:19 -08:00
N. Taylor Mullen 829faaaa4b Change TagHelperAttributeDescriptor to not depend on PropertyInfo.
- Right now the only information that is used from the PropertyInfo is the PropertyName and the PropertyType, therefore changed the PropertyInfo property on TagHelperAttributeDescriptor to be AttributeTypeName since we already had an accessor for AttributePropertyName.
- Modified test comparers to validate type names.

#214
2014-11-14 10:45:14 -08:00
N. Taylor Mullen 2200f7dc3a Add AssemblyName to TagHelperDescriptor.
- TagHelperDescriptor's need a way to showcase where they came from so tooling can reverse look them up.
- Update tests to specify TagHelperDescriptor assembly names.

#214
2014-11-14 10:45:08 -08:00
N. Taylor Mullen 8d4bdbdb84 Allow invalid HTML to be in Razor pages.
- Modified the TagHelperParseTreeRewriter to not remove invalid HTML snippets.
- Added tests to validate invalid HTML is allowed.

#212
2014-11-14 10:30:51 -08:00
Victor Hurdugaci 39accef1ad Update KProj to the latest format 2014-11-12 15:24:16 -08:00
N. Taylor Mullen 54155e47e5 Add DesignTime code generation support for TagHelpers.
- We now generate a subset of the TagHelper runtime code during DesignTime. This enables users to see errors in the editor
- Added tests to validate design time code generation.
- Refactored runtime code generation tests (we now use a lot of their infrastructure for the design time pieces).

#208
2014-11-07 10:57:50 -08:00
Pranav K 878be8922f Merge branch 'release' into dev 2014-11-06 10:48:41 -08:00
Pranav K 2efbc75f8e Updating to release NuGet.config 2014-11-06 10:48:39 -08:00
Kirthi Krishnamraju a858373409 Merge branch 'release' into dev 2014-10-29 13:26:50 -07:00
Kirthi Krishnamraju 85d0ddc45a Added description in project.json for all projects 2014-10-29 11:38:09 -07:00
N. Taylor Mullen 7ab25918e0 Add tests to validate @removetaghelper functionality.
- Added utility methods to construct valid SyntaxTreeNodes that represent the @removetaghelper directive.
- Added parse level unit tests to validate the @removetaghelper generates an accurate SyntaxTreeNode.
- Added parse level unit tests to validate the @removetaghelper throws with bad formats.
- Added TagHelperRegistration unit tests to validate the AddOrRemoveTagHelperCodeGenerators are understood and affect the descriptors found.
- Added Designtime mapping tests to validate correct source mappings are made to ensure proper coloring and lack-of C# intellisense.
- Added end-to-end tests to validate @removetaghelper can essentially disable TagHelpers on a page.

#112
2014-10-29 11:31:00 -07:00
N. Taylor Mullen 30221f7ce0 Add @removetaghelper directive.
- Added parsing recognition of the @removetaghelper directive.
- Added TagHelperDescriptor handling: @removetaghelper will cause the system to ignore TagHelpers that are added via @addtaghelper.
- Added Chunk generation, this involved building a CodeGenerator (soon to be named ChunkGenerator) that pulled out the stringified @removetaghelper lookup text which it then uses to construct a RemoveTagHelperChunk.
- Modified CodeVisitors to now understand RemoveTagHelperChunk's.
- Added code generation, this involved creating a dummy string in order to give the @removetaghelper "..." coloring.

#112
2014-10-29 10:24:57 -07:00
N. Taylor Mullen 0dba621965 Make TagHelperOutput.Attributes case insensitive.
- Changed the Attributes dictionary to utilize a StringComparer.OrdinalIgnoreCase comparer.
- Changed TagHelperExecutionContext to ignore attribute casing.
- Updated the AllAttributes and HtmlAttributes dictionaries to ignore attribute casing.
- Added tests to validate their new behavior.

#186
2014-10-23 22:22:11 -07:00
Pranav K 21d64b4ae2 MQ: Cleanup to use var 2014-10-22 15:35:43 -07:00
Pranav K d12bb79714 Updating build.sh to work on Mono 2014-10-21 12:46:59 -07:00
Pranav K 473f642dde Modifying tests to run in both in aspnet50 and aspnetcore50
* Additionally trimming references from project.json
2014-10-19 21:18:43 -07:00
Pranav K 99fe8294e9 Modifications to support providing tag descriptors from derived hosts 2014-10-16 07:11:46 -07:00
N. Taylor Mullen f8020e8e85 Make @addtaghelper directive not be nested.
- Whenever we encounter an @addtaghelper directive we add it to the CodeTree at the top level (not nested in any chunk blocks).
- Added a test to validate that @addtaghelper inside of a ChunkBlock doesn't add to the ChunkBlock's children.

#195.
2014-10-15 12:10:27 -07:00
NTaylorMullen e5a21520e5 Add HtmlAttributeNameAttribute for TagHelpers.
- Added the ability to override the HTML attribute name for TagHelper properties.
- Tested functionality of overriding the attribute name target and inheriting the attribute name.

#121
2014-10-14 20:16:16 -07:00
Pranav K a2a05e7153 Modify CSharpCodeWriter to generate async lambdas for section
Fixes #85
2014-10-13 17:00:38 -07:00
NTaylorMullen 4f9a6fed93 Fix inherited TagHelper properties.
- Used to only look at declared properties on the tag helper type, now we get the runtime properties.
- Fixed Runtime test projec to work with new CLR changes (looks like it was missed).

#189
2014-10-13 15:33:38 -07:00
Yishai Galatzer 7364c6f6db Expose code builder on generator result, and some tidying up 2014-10-13 09:30:56 -07:00
Pranav K 2637894ab6 Reacting to CLR package versioning changes 2014-10-10 10:34:04 -07:00
N. Taylor Mullen ae4adf6af6 Fixed rebasing issues. 2014-10-09 13:48:23 -07:00
NTaylorMullen 74974d371c Add error mechanism for TagHelperParseTreeRewriter.
- Replaced customer facing Debug.Assert with a new error mechanism to surface errors to GenerateCode callers.
- The new mechanism is a general purpose way for ISyntaxTreeRewriters to add errors to the parsing phase.

#174
2014-10-09 12:58:14 -07:00
NTaylorMullen 72c449bf86 Add TagName attribute for tag helpers.
- Made it so the TagHelperDescriptorFactory could pull tag name targets from TagNameAttributes on types.
- Tested the behavior between TagNameAttribute and TagHelperDescriptorFactory (the only consumer of the attribute).
- Made sure to test duplicate and inherited class scenarios.

#120
2014-10-09 12:58:12 -07:00
N. Taylor Mullen ec638b147a Add ContentBehaviorAttribute for TagHelpers.
- Added detection of custom ContentBehaviors via the ContentBehaviorAttribute in the TagHelperDescriptorFactory.
- Updated some comments in the ContentBehavior enum.
- Add tests to validate custom content behavior resolution.

#122
2014-10-09 12:58:09 -07:00
NTaylorMullen d080dc8f71 Test TagHelperScopeManager functionality.
#155
2014-10-09 12:58:06 -07:00
NTaylorMullen 66aea52542 Add TagHelperScopeManager for runtime.
- Also added an interface ITagHelperScopeManager so we can activate the type via DI.

#155
2014-10-09 12:58:03 -07:00
NTaylorMullen b1a3c8c1d4 Test TagHelperRunner, TagHelperOutput and TagHelperExecutionContext.
#154
2014-10-09 12:58:00 -07:00
NTaylorMullen 4378f9613e Add TagHelperRunner for TagHelper runtime.
- This involved adding the following core classes: TagHelper, TagHelperExecutionContext, TagHelperOutput, TagHelperContext.  All of which aid in running TagHelpers.

#154
2014-10-09 12:57:57 -07:00
NTaylorMullen dfe41eced8 Updated versions for runtime project. 2014-10-09 12:57:54 -07:00
NTaylorMullen b37b11d4b6 Add tests to validate TagHelperDescriptorResolver.
- Tested the descriptor resolver and its underlying dependencies (TagHelperTypeResolver and TagHelperDescriptorFactory).

#99
#158
2014-10-09 12:57:52 -07:00
NTaylorMullen f9c70a0644 Add TagHelperDescriptorResolver.
- This involved also adding a TagHelperTypeResolver and TagHelperDescriptorFactory.
- The TagHelperTypeResolver is responsible for determining the format of lookup text's used throughout the tag helper system.  By default it handles the following formats:
"assemblyName"
"specificType, assemblyName"
- It also restricts what types are considered TagHelpers.  In this implementation we only accept public, non-nested, non-abstract, non-generic TagHelpers.
- The TagHelperDescriptorFactory is responsible for converting a Type to a TagHelperDescriptor.
- Added tests to validate TagHelperDescriptorResolver, TagHelperTypeResolver and TagHelperDescriptorFactory.

#99
#158
2014-10-09 12:57:49 -07:00
N. Taylor Mullen 7db4ed7f7e Add tests to validate @addtaghelper directive.
- Fixed existing tests to work with new RazorParser.
- Validated directive syntax tree creation, errors and code generation.

#111
2014-10-09 12:57:46 -07:00
N. Taylor Mullen b67b8dae3d Add @addtaghelper directive.
- Also added some infrastructure pieces for it such as the ITagHelperDescriptorResolver and the default implementation TagHelperDescriptorResolver which will be filled out in a later commit.
- Reworked some extensibility points to allow accessibility of the descriptor resolvers per offline discussions.

#111
2014-10-09 12:57:43 -07:00
NTaylorMullen 05d8193775 Add test for TagHelperAttributeValueCodeRenderer extensibility.
- Tested that we can successfully plugin our own TagHelperAttributeValueCodeRenderer.
- Moved some existing TagHelper test logic into its own base type to enhance code reusability.

#119
2014-10-09 12:57:40 -07:00
NTaylorMullen 2b6b437952 Add extensibility point for TH attribute code gen.
- Enabled the CSharpCodeBuilder to create the CSharpCodeVisitor which exposes a CSharpTagHelperCodeRenderer which is indirectly used to render attribute values.
- Fixed up some existing classes that just new'd up the CSharpCodeVisitor class to instead take in the decorated version.

#119
2014-10-09 12:57:37 -07:00
N. Taylor Mullen c3b51cbbdf Add code generation tests for tag helpers.
#72
2014-10-09 12:57:34 -07:00
N. Taylor Mullen 50fa3ee3e3 Create TagHelper specific C# code Generation.
- Added TagHelperChunk generation.
- Added CSharp visitors to understand TagHelperChunks and render corresponding C# code.
- Refactored some code in the CSharpCodeVisitor so it could be utilized in other classes.
- Added a CSharpFieldDeclarationVisitor to render declaration pieces for TagHelper's
- Added metadata to represent specific TagHelper code generation constructs.

#72
2014-10-09 12:57:31 -07:00
N. Taylor Mullen 0b5f0cd565 Rebased onto latest dev.
- Fixed tag helper parse tree visitor rebase error.
2014-10-09 12:50:56 -07:00
N. Taylor Mullen b1b1da0781 Add Microsoft.AspNet.Razor.Runtime src and test project.
#136
2014-10-09 12:50:52 -07:00
N. Taylor Mullen 950828cbab Refactored CodeGeneratorContext to CodeBuilderContext.
- Needed to separate the context's of "generation" and "building" to enable the communication of the TagHelperProvider.
2014-10-09 12:50:49 -07:00
N. Taylor Mullen 20824f37e0 Add tests to verify TagHelperParseTreeVisitor.
- Added tests to validate TagHelperParseTreeVisitor when dealing with valid HTML elements.

#71
2014-10-09 12:50:45 -07:00
N. Taylor Mullen bb3ad0ede4 Fix test to work with TH rewriters.
- Added understanding to the ParserTestBase for TagHelperBlock's
- Added a helper class MarkupTagHelperBlock to make building test TagHelpers easier.
- Fixed some existing tests that "new"d up the RazorParser and didn't obide by the new contract (to provide optimizers).

#71
2014-10-09 12:50:42 -07:00
N. Taylor Mullen 3cba84104d Add TagHelper parse tree visitor.
- The visitor looks for TagBlock's that match registered TagHelpers and rebuilds them into TagHelperBlock's.
- Added the code generator and corresponding chunk for a TagHelperBlock.
- Added syntax tree specific objects & helper methods to create accurate tag helper structures.

#71
2014-10-09 12:50:39 -07:00
Pranav K 83da8e257d Generate code for expressions in design time to enable intellisense
Fixes #80
2014-10-08 09:53:27 -07:00