Commit Graph

388 Commits

Author SHA1 Message Date
Kiran Challa b6765d370c Enable pinning build script 2015-08-12 05:29:04 -07:00
Chris R 713c16810c #481 React to CoreCLR Cryptography package changes. 2015-08-11 14:52:23 -07:00
sornaks 168fcbb9c1 Replacing BufferedEntryCollection with BufferedHtmlContent so any IHtmlContent can be added to a TagHelperContent.
- Introducing a new logic to calculate IsEmpty/IsWhitespace.
- Making Buffer private in DefaultTagHelperContent.
- Making SetContent non-abstract.
2015-08-10 14:54:10 -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
Troy Dai fa9f2ace5f Update CoreCLR versions 2015-08-04 10:15:31 -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 a8fd85db1e Add ability to execute child content more than once.
- Added a boolean overload that specifies whether the user wants to retrieve cached content.
- Added tests to validate `TagHelperExecutionContext` `GetChildContentAsync` and that `TagHelperContext` passes the appropriate values through.

#459
2015-07-31 15:23:49 -07:00
Dejan Paležević 6a285ce70a Removed unnecessary blank line 2015-07-30 16:56:49 +02:00
N. Taylor Mullen 3b5692a5a5 Removed extra IVT from `Microsoft.AspNet.Razor`.
- Added tests to validate `IsStringProperty` on `TagHelperAttributeDescriptor`s.

#464
2015-07-28 14:58:59 -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
N. Taylor Mullen b66da76c5c Format project.json's. 2015-07-28 10:43:51 -07:00
N. Taylor Mullen 4d0821f953 Transition Razor test comparers to new project.
- Changed namespaces for test comparers.

#461
2015-07-28 10:38:09 -07:00
N. Taylor Mullen a66490c012 Format runtime tests project.json. 2015-07-27 12:03:06 -07:00
N. Taylor Mullen 3ab6f56284 Fix `DesignTimeDescriptorFactory.CreateDescriptor` call to properly retrieve type from `TypeInfo`.
- Added `TagHelperDescriptorFactory` level tests to validate correct information is being pased to the `TagHelperDesignTimeDescriptorFactory`.

#457
2015-07-24 15:07:07 -07:00
N. Taylor Mullen c87dd8d9de Fix EditorBrowsableAttribute detection to apply to individual attributes.
- Prior to this change we'd return early and not generate any found descriptors if ANY property on a `TagHelper` had editor browsable never.
- This issue was hidden from tests due to us using the wrong comparer. Updated the comparer and failures occurred without the `TagHelperDescriptorFactory` change (yay).

#454
2015-07-23 15:26:46 -07:00
N. Taylor Mullen 7b9de550c7 Merge branch 'release' into dev 2015-07-16 14:50:40 -07:00
N. Taylor Mullen b762830a43 Consume `EditorBrowsableAttribute` on `TagHelper`s.
- Changed `TagHelperDescriptorFactory` to not create individual descriptors when `EditorBrowsableAttribute` is present and set to `EditorBrowsableState.Never`.
- Added tests to validate the `TagHelperDescriptorFactory` creates the attribute correctly.
- Did not look down the inheritance chain for `EditorBrowsableAttribute` because `TargetElement` is not inherited.

#447
2015-07-16 14:49:09 -07:00
Pranav K 1047aa9506 Merge branch 'release' into dev 2015-07-16 08:58:29 -07:00
Pranav K fe28081c34 Updating to release NuGet.config 2015-07-16 08:58:26 -07:00
sornaks ec5d1b4f4a Merge branch 'htmlcontentpart1' into dev 2015-07-10 15:45:48 -07:00
sornaks 6a7cd0f490 Making TagHelperContent implement IHtmlContent. 2015-07-10 15:44:22 -07:00
N. Taylor Mullen 2031a73918 Normalize tests project.json formatting. 2015-07-10 15:40:03 -07:00
N. Taylor Mullen c9c07bd393 Update test project.json to not depend on Moq for CoreCLR. 2015-07-10 15:38:37 -07:00
Victor Hurdugaci f2e1f28908 Add repository information to project files 2015-07-01 20:21:13 -07:00
Doug Bunting 69d8e52bf9 Add support for get-only indexer properties
- #399
- move invalid `HtmlAttributeNameAttribute.Name` checking to `TagHelperDescriptorFactory`
- add a few new error cases
 - but does not cover all the new error cases e.g. `[HtmlAttributeName(...)]` on a get-only `int` property

nit:
- `resx` target removed some older resources from `RazorResources.Designer.cs`
2015-06-30 23:03:10 -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 eda9edc41d Fix Travis-CI.
- Added platform specific path handling to the TagHelperUsageDescriptorFactoryTests.
2015-06-29 17:17:13 -07:00
Doug Bunting 308eddc095 Quick fix: Do not check a platform-specific message 2015-06-25 15:56:21 -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 ccf8433f27 Add TagHelper documentation resolution to TagHelperDescriptorResolver.
- Added TagHelperUseageDescriptor and associated factory for the TagHelperDescriptorFactory to utilize.
- TagHelperUseageDescriptors are only created during design time.
- CoreCLR is not supported for XML documentation resolution for now. Can revisit this later when we have better tooling integration with CoreCLR.

#352
2015-06-25 15:10:27 -07:00
N. Taylor Mullen 361a53ba3c Remove empty line. 2015-06-25 11:39:54 -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 039062c5eb Fix C# design time projections for complex TagHelper attributes.
- TagHelper attributes that have expressions intermingled within them (resulting in Block elements) resulted in Spans in the attribute being falsely marked as SpanKind.Markup.
- Updated tests to account for new SpanKind.Code behavior.
- Added complex scenario to validate SpanKind.Code is flowed through to surround attributes.

#387
2015-06-25 10:27:03 -07:00
Doug Bunting a73867eabe Change hardcoded `bash` shebang to `env`
- aspnet/Home#695
- support various `bash` installation locations
- in particular, enable building on FreeBSD
2015-06-23 11:03:41 -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 a1df1702e5 Add support for C# 6 exception filters.
- Added new handling of the C# try catch statement to allow exception filters after catch statements.
- Added tests to validate valid and invalid scenarios.

#402
2015-06-10 10:08:10 -07:00
N. Taylor Mullen 619cbc3716 Refactored several tests from TagHelperParseTreeRewriterTest into TagHelperBlockRewriterTest.
- Split the tests into their corresponding impact areas. We were testing a lot of bits that were not specific to the TagHelperParseTreeRewriter in its corresponding tests.

#370
2015-06-08 14:52:01 -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 113d80c6f5 Ensure `CodeVisitor`s consistenctly find tag helpers
- #412
- fix `CSharpTagHelperRunnerInitializationVisitor` and `CSharpUsingVisitor`
- fix existing test of the tag helper in a section scenario
2015-06-01 09:03:09 -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 1e5ad1154d Updated comment. 2015-05-29 23:01:21 -07:00
N. Taylor Mullen 3ba92523ff Remove special casing of '*' in TagHelperDescriptorProvider.
- Requesting a '*' tagName from the TagHelperDescriptorProvider could only happen if a user was directly calling into it (extremely unlikely). Therefore I've removed the special casing to make the logic more simple.
- Removed tests that expected this behavior.

#324
2015-05-29 15:06:14 -07:00
N. Taylor Mullen ed92b6992d Addressed code review comments. 2015-05-29 12:50:01 -07:00
N. Taylor Mullen 6df8bc23f1 Renamed CodeBuilder related classes to CodeGenerator
- Now that what used to be CodeGenerators are now ChunkGenerators we can rename the CodeBuilder into its correct structure: a CodeGenerator.
- Moved the TagHelperAttributeValueCodeRenderer from the TagHelpers namespace into the CodeGeneration namespace.
- Went through several classes and remove and sorted usings.
- Updated test files to abide by the new naming convention of Builders => CodeGenerators.

#140
2015-05-27 17:00:41 -07:00
N. Taylor Mullen 5df9b52afe Renamed and moved several Razor classes for clarity.
- Renamed CodeGenerators to ChunkGenerators.
- Updated location of TestFiles from TestFiles/CodeGenerator/CS/{Output|Source} => TestFiles/CodeGenerator/{Output|Source}.
- Removed ChunkTree test; it was a legacy test used to experiment with Razor rendering (not a real test).
- Removed CSharpRazorCodeGenerator; it's now replaced with RazorCodeGenerator. It was an empty class that did nothing.
- Updated ChunkBlock => ParentChunk. Also updated several patterns throughout the code base that referenced these blocks as blocks and not parents.
- Moved Chunks and ChunkGenerators into the Chunks/Chunks.Generators namespace/folder structure. Updated test project to reflect the same.
- Moved CodeBuilders and CodeVisitors to the CodeGeneration/CodeGeneration.Visitors namespace/folder structure. Updated test project to reflect the same.
- Moved several TagHelper assets outside of their own namespaces and into Razors more general structures; such as CodeGeneration and Chunks/Chunks.Generators.

#140
2015-05-27 17:00:25 -07:00
Pranav K b33bff1866 Merge branch 'release' into dev 2015-05-27 16:26:48 -07:00
Pranav K 8ff0214b73 Updating to release NuGet.config 2015-05-27 16:26:44 -07:00
N. Taylor Mullen 0e61b49881 Add support for '*' at the end of required attributes.
- [TargetElement(Attributes ="prefix-*")] is now supported.
- Added '*' to the list of invalid non whitespace characters in TagHelperDescriptorFactory.
- Modified TagHelperDescriptorProvider to respect suffixed wildcards in TagHelperAttributeDescriptor.Attributes.
- Added tests to validate wildcard required attributes

#361
2015-05-21 15:01:32 -07:00
Doug Bunting 60c47c8874 Add `[HtmlAttributeName(..., DictionaryAttributePrefix="prefix")]` part III
- #89 remainder
- support adding attributes (that aren't otherwise bound) to a tag helper dictionary
- use two `TagHelperAttributeDescriptor`s for dictionary and indexer
 - most exising descriptor properties have two meanings depending on new `IsIndexer`
 - add `TagHelperAttributeDescriptor.IsNameMatch()`
- create no `TagHelperAttributeDescriptor`s if property name or `HtmlAttributeNameAttribute`
  is invalid
 - avoid corner case misfeatures where invalidity removes just one descriptor
- extend handling of invalid attribute names to include `[HtmlAttributeName]`
- handle prefix matches in `TagHelperBlockRewriter`
 - add parse error when resolved dictionary key is `string.Empty`
- generate code for indexer property assignments
 - add code generation for runtime error if using indexer when property is `null`
 - use new `GeneratedTagHelperContext.FormatInvalidIndexerAssignmentMethodName` for message
- code generation now handles attributes in source order; thus above errors occur only when
  expected if dictionary is also initialized in the Razor source
 - surprisingly generation order change did not break existing tests!

nits:
- improve `TagHelperDescriptorFactory_InvalidBoundAttributeName` wording
 - rename resource to `TagHelperDescriptorFactory_InvalidAttributeNameOrPrefixStart`
- correct order of arguments to `FormatTagHelperDescriptorFactory_InvalidBoundAttributeName`
- correct `TagHelperBlockRewriter_TagHelperAttributeListMustBeWellFormed` resource
- correct `TagHelperDescriptorFactoryTest` test names
 - remove a few unnecessary `ToArray()` calls
- update `TagHelperAttributeDescriptorComparer` comments
2015-05-20 22:01:00 -07:00