Commit Graph

351 Commits

Author SHA1 Message Date
Ajay Bhargav Baaskaran 3f34add497 Removed support for regex type names in @addTagHelper and @removeTagHelper
- #426
- Updated tests to not use regex patterns
2015-09-22 17:48:59 -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
Ajay Bhargav Baaskaran 153ed57d66 [Fixes #472] Added temporary parse error for helper directive 2015-09-21 12:09:31 -07:00
N. Taylor Mullen 0253c563be Update tests to run correctly on stable mono. 2015-09-18 17:04:03 -07:00
Kiran Challa 392b7a3710 Reacting to Dnx runtime sources changes 2015-09-18 16:28:26 -07:00
N. Taylor Mullen c494cb344d Enable `TagHelper`s with `[RestrictChildren]` to log errors for no tag name tags when targeted by catch all.
#534
2015-09-18 15:41:58 -07:00
N. Taylor Mullen 635514453b Enable `TagHelper`s with `[RestrictChildren]` to log errors for no tag name tags.
- Added test cases for situations when tags have no names.

#534
2015-09-18 14:47:48 -07:00
N. Taylor Mullen 36450c978b Add support for `@tagHelperPrefix` and `[RestrictChildren]`.
- Added a test to validate prefixed `TagHelper`s can have children with `TagHelper` prefixes.

#532
2015-09-18 12:31: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
Pranav K 33a0f7a0db Replace NotNullAttribute with thrown exceptions 2015-09-16 22:06:25 -07:00
Pranav K 381c055e2f Removing NotNullAttribute from Microsoft.AspNet.Razor 2015-09-14 11:58:28 -07:00
N. Taylor Mullen f71f9fb679 Rename `TargetElementAttribute` => `HtmlTargetElementAttribute`.
- Nearly every other `TagHelper` related element targeting attribute has `Html` a part of its name. With this rename, the attribute will be consistent.

#516
2015-09-13 19:14:08 -07:00
Ryan Nowak fcadbc9095 React to BufferedHtmlContent changes
This changes all TagHelperContent methods to assume that input has NOT
YET been encoded.
2015-09-13 13:49:05 -07:00
N. Taylor Mullen 4fd866f340 Update `RestrictChildrenAttribute`s properties and parameters to have consistent names.
- Other attributes such as `TargetElement` have names referring to tag names as "tags". This update makes both attributes more consistent.

#517
2015-09-13 11:57:48 -07:00
Ajay Bhargav Baaskaran e2881b0eca Extra newline no longer rendered at the end of a code block
- #485
- Using a flag to consume whitespace and newline at the end of a verbatim block
- Added tests to validate nested blocks
2015-09-10 10:39:37 -07:00
Doug Bunting 493e5521b8 Build break: Mock `TypeInfo` as well to get 4 tests working
- as of aspnet/aspnet.xunit@5a12e89 xUnit uses `TypeInfo` more often
2015-09-09 22:49:12 -07:00
Pranav K 9a7be69a0d Produce ITypeInfo \ IPropertyInfo using CodeAnalysis symbol tree 2015-09-09 16:34:12 -07:00
Pranav K 231e8a9cf4 Create an abstraction model for TypeInfo for tag helper discovery. 2015-09-08 17:37:08 -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
Doug Bunting 6568de38d1 Two quick fixes
- add missing closing quote in a resource
- cleanup `project.json` files
  - remove some package references that are found transitively
2015-09-08 08:39:03 -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
N. Taylor Mullen f843aec538 Update tests to reflect new length provided `RazorError`s.
- Added new tests to validate `TagHelperDescriptorResolver` properly calculates assembly location.

#386
2015-09-02 12:05:53 -07:00
N. Taylor Mullen 09bcc67955 Update tests to use `Environment.NewLine` for source locations. 2015-09-01 01:32:21 -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
N. Taylor Mullen 55760b4fcb Add copy constructor to `TagHelperAttribute`.
- Added test to validate copy constructor does its job.

#492
2015-08-20 22:09:46 -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 96f1090ff1 Fix Travis.
- Fixed test that had newlines but indexes not based on them.
2015-08-15 10:07:02 -07:00
N. Taylor Mullen cf1355245f Add `RestrictChildrenAttribute` specific `TagHelperDescriptorFactory` tests.
- We covered invalid tag names in the attribute but not the full end-to-end descriptor factory resolution piece.

#255
2015-08-14 23:52:50 -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
Ajay Bhargav Baaskaran 156f859edc Removed constructors from TagHelperAttributeDesignTimeDescriptor,
TagHelperDesignTimeDescriptor and TagHelperDirectiveDescriptor
2015-08-14 11:42:51 -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
Ajay Bhargav Baaskaran 71c4c8dac6 [Fixes #428] Removed newlines at the end of razor comments 2015-08-13 15:06:09 -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
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 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 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
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
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 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
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 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
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
N. Taylor Mullen 1879ac6427 Add support for static usings.
- Added special cases to the using statement parser to understand `@using static Foo`.
- Added several unit tests to validate the static using structure.
- Modified existing import code generation tests to validate several static usings.

#44
2015-05-20 21:47:23 -07:00
Ajay Bhargav Baaskaran aaa14cd36b More bug fix for #379 2015-05-20 13:55:12 -07:00
Doug Bunting 0e296283f9 Address a round of nits
- clean up trailing curly braces (Java style)
 - affected lots of files touched for #89 fix
- a couple of trailing whitespace removals
2015-05-19 17:39:26 -07:00
Ajay Bhargav Baaskaran 47577fd936 [Fixes #379] Ignoring whitespace at the end of text tag 2015-05-19 17:21:28 -07:00
N. Taylor Mullen 58c0a36200 Add support for null conditional operators in implicit expressions.
- Added case in ImplicitExpression handling to understand question marks.
- text?. is special compared to text. because with text. we currently validate content after text. to determine if it's an expression or if it's a period. Now with ?. we always treat it as an expression because ?. is not a useful sentance of any kind.
- Added unit tests to validate new implicit expression handling
- Added runtime and design time code generation tests to validate null conditional operators.

#44
2015-05-19 16:34:08 -07:00
N. Taylor Mullen b25bf01158 Add TagHelper support for unbound data- attributes.
- Involved updating the HtmlMarkupParser to properly separate data- attributes. Prior to this change `data-foo="abc @DateTime.Now def"` would involve 1 Span for `data-foo="abc` 1 Span for `@DateTime.Now` and 1 Span for `def"`. This was very unique behavior from an attribute standpoint (as far as Razor is concerned) and made it difficult for the TagHelper rewriting system to rewrite attributes. With this change it gets broken out as follows: `|data-foo="|abc| @DateTime.Now| def|"|`.
- Added unit tests to validate the various ways you can write unbound data- attributes.
- Updated the BasicTagHelpers codegeneration test to intermix some unbound data- attributes.

#342
2015-05-18 22:43:03 -07:00
N. Taylor Mullen 407a2ceae6 Remove unneeded NamespaceKeywordLength from AddImportCodeGenerator.
- This was completely unused outside of the AddImportCodeGenerator.
2015-05-18 17:21:50 -07:00
Doug Bunting 94f2f904b3 Add `[HtmlAttributeName(..., DictionaryAttributePrefix="prefix")]` part II
- relates to #89 because that changes `string` property checks and needs this refactor
- determine `string`-ness when creating `TagHelperAttributeDescriptor`s
 - add `TagHelperAttributeDescriptor.IsStringProperty` (set in constructor)
 - avoid repeated `string` comparisons and be more explicit
- change `TagHelperBlockRewriter` to centralize more of the `string`-ness determination
 - also add `TryParseResult` DTO, avoiding multiple `out` parameters
- refactor `CSharpTagHelperCodeRenderer` to allow reuse of core attribute value rendering
- test all of it
 - add `TagHelperDescriptorTest` to confirm serialization / deserialization

minor:
- fix `TagHelperBlockRewriter.TryParseBlock()` end quote removal when tag is malformed

nits:
- remove dangling mention of fixed bug #220
- make recently-added `TagHelperBlockRewriterTest` tests realistic
 - multiple `TagHelperDescriptor`s for same tag helper have identical `Attributes`
2015-05-15 23:17:52 -07:00
Ajay Bhargav Baaskaran 2fe78d70db [Fixes #217] Applying error squiggly to full directive 2015-05-15 12:26:21 -07:00
N. Taylor Mullen 0882ff4a13 Add tests to validate minimized attributes.
- Added parse level rewriting tests to validate new TagHelper rewritten structures for minimized attributes.
- Updated existing parser tests to understand minimized attributes.
- Added codegen test to validate understanding of minimized attributes.
- Added TagHelperExecutionContext tests to validate maintaining of runtime TagHelperOutput tests.
- Refactored part of the TagHelperParseTreeRewriterTest file into a base class file so we can make better rewriting tests.

#220
2015-05-15 12:23:11 -07:00
Pranav K 7d8f5d7b84 Revert "Reacting to updated CoreCLR packages"
This reverts commit f180bd9900.
2015-05-15 12:19:37 -07:00
Pranav K f180bd9900 Reacting to updated CoreCLR packages 2015-05-15 08:59:23 -07:00
Doug Bunting 70486710ea Quick fix: Add `System.Runtime.Serialization.Primitives` dependency
- tests failing
- root cause is likely similar to reason MVC Core has same dependency
 - something must have changed in the framework packages without manifest fixes
2015-05-14 10:47:39 -07:00
Ajay Bhargav Baaskaran 7bd338fc4a [Fixes #266] Maintain HTML provided case for TagHelper attributes 2015-05-13 15:27:38 -07:00
Ajay Bhargav Baaskaran 4d80c96f9c [Fixes #50] Removed unnecessary whitespaces before text tag 2015-05-13 10:55:52 -07:00
Ajay Bhargav Baaskaran c680d6b953 [Fixes #183] Fix error with double transition in value attribute 2015-05-12 17:59:22 -07:00
Doug Bunting 294fb5c3cd Quick fix: Missed `null` checks in 7dc0508 2015-05-11 22:12:28 -07:00
Henk Mollema 89b5f5b1aa Utilize nameof operator 2015-05-11 17:37:54 +02:00
Doug Bunting 7dc0508c03 Add `[HtmlAttributeName(..., DictionaryAttributePrefix="prefix")]` part 1
- related to #89 because we need more descriptor comparers in more places
- separate `TagHelperAttributeDescriptorComparer` and `TypeBasedTagHelperDescriptorComparer`
 - encourages reuse and most will soon be used in multiple classes
- add `null` checks to `EquivalenceComparer`
 - also give parameters better names

nits:
- use `<inheritdoc/>` in `TagHelperDescriptorComparer`
 - also give it an explicit constructor
- make product comparers easier to subclass
 - base test `CaseSensitiveTagHelperAttributeDescriptorComparer` on product code
2015-05-10 22:15:29 -07:00
Doug Bunting cef0971d3e `throw new ArgumentNullException(...)` -> `[NotNull]`
- add `[NotNull]` in some `public` or `protected` callers as well
- add `[NotNull]` in `SeekableTextReader` constructors
- add `where TSymbolType : struct` to replace incorrect `null` checks
- remove `T` type parameters in changed files e.g. change to `TWriter`
- remove tests of removed code

nits:
- change `TextReaderExtensions` to consistently call other extensions as statics
- wrap some long doc comments
2015-05-06 14:21:05 -07:00
Doug Bunting 42552c982d Quick fix: Remove project.json warning
- `resources` -> `resource`

Example warning during `dnu build --quiet`:
```
...\test\Microsoft.AspNet.Razor.Test\project.json(3,34): warning: Property "resources" is deprecated. It is replaced by "resource".
```
Primarily resulted in VS Error List noise. Above does not normally show up in
`build.cmd` runs because `dnx . test` does not show build warnings.
2015-05-05 16:07:24 -07:00
N. Taylor Mullen e5e4a22966 Update LICENSE.txt and license header on files. 2015-05-01 13:58:52 -07:00
N. Taylor Mullen e3fdb8886a Add Multiple attribute same name understanding to TagHelperChunk.
- This also involved adding understanding to CSharpTagHelperCodeRenderer.
- When rebasing this commit was lost as part of: 7c604d2b11 .

#279
2015-04-30 14:57:23 -07:00
Doug Bunting 6384977e96 Improve `GetHashCode()` implementations and their consistency with `Equals()`
- #362 and more
- make a few more properties immutable
 - in a few cases, just remove `private` setters
 - in others, adjust consuming code to handle the changes
- make `Equals()` commutative
 - use `GetType() == obj.GetType()` if necessary
- use only immutable values in `GetHashCode()` calculations
 - avoid `object.GetHashCode()`; that calculates hash of reference
 - add warnings about `RazorError` property setters but use properties
 - BUT lack of immutable values leads to some static `GetHashCode()` calculations
- correct important typo in `TagHelperDescriptorComparer`
- ensure `Equals()` does not `throw` an NRE e.g. in `LineMapping`
- add `SyntaxTreeNode.GetEquivalenceHash()`
- make `SourceLocation.Equals()` and `SourceLocation.CompareTo()` consistent

Update affected tests
- code generators and edit handlers less likely to be equal; adjust expectations

Add lots of tests
- not for all updated classes but enough to see impact of odd choices

nits:
- remove some `Equals()` and `GetHashCode()` overrides in `SpanCodeGenerator` subclasses
 - no longer unique
- remove redundant null checks e.g. when also done in `base.Equals()`
- add `StringComparer.Ordinal` if `StringComparison.Ordinal` used in `Equals()`
- make some `CSharpLineMappingWriter` fields `readonly`
- remove unused `LineMapping` constructor
2015-04-28 20:35:04 -07:00
Doug Bunting 1111405786 Remove extra `[NotNull]` definition and second AssemblyInfo.cs file
- add necessary build-time dependency
- add missing `using Microsoft.Framework.Internal;` statements
- remove `[NotNull]` from tests
 - avoid duplicate definitions of `[NotNull]` from referenced projects
- remove incorrect NotNullArgument.cs and second AssemblyInfo.cs files entirely
 - merge content into AssemblyInfo.cs file in expected location

nit: clean up some trailing whitespace
2015-04-28 15:56:31 -07:00
N. Taylor Mullen 2d20063ba5 Remove layout directive.
- Removed all instances of the layout directive from src and test projects.

#359
2015-04-27 14:48:53 -07:00
N. Taylor Mullen dcee0d2ff7 Add tests for ReadOnlyTagHelperAttributes and TagHelperAttributes.
#279
2015-04-27 12:06:08 -07:00
Doug Bunting de95f67400 Add `HtmlAttributeNotBoundAttribute`
- #182
- ignore otherwise-bound (i.e. `public`) properties in tag helpers

nits:
- add more `TagHelperDescriptorFactory` tests e.g. of `internal` properties
- remove `private` setter from `HtmlAttributeNameAttribute`
- use `null` propagation to shorten `IsAccessibleProperty` expression
- clean up some trailing whitespace
2015-04-24 22:57:41 -07:00
Pranav K dc4ee8b915 * Adding FilePath to SourceLocation
* Using SourceLocation.FilePath when printing line pragmas, if available.
2015-04-16 15:08:36 -07:00
N. Taylor Mullen fedd53aab8 Update Razor directives to format correctly when entering newline.
- Existing Razor directives layout, inherits, addTagHelper, tagHelperPrefix and removeTagHelper should only ever span a single line and need to cause a re-parse when a newline is entered during design time. To do this modified their AcceptedCharacters to accept anything other than newline rather than anything.
- Updated existing tests to now expect AcceptedCharacters.AnyExceptNewLine when directives are present.
- This change also enables the model directive in Mvc since it also uses the inherit directives core parsing.

#332
2015-04-15 11:32:47 -07:00
N. Taylor Mullen 5bcda94b2c Create error when TagHelper binds to HTML attribute starting w/ data-.
- Added TagHelperDescriptorFactory tests to validate TagHelperAttributeDescriptor creation.

#342
2015-04-15 11:24:08 -07:00
N. Taylor Mullen c9c8e802a7 Add PreElement and PostElement to TagHelperOutput.
- These two new properties will enable TagHelper authors to render content before and after the TagHelper's HTML element.
- Added tests to correspond with existing test coverage.
- Modified existing tests to double check for TagHelperOutput.Pre/PostElement.
- Refactored all DefaultTagHelperContent pieces of TagHelperOutput to be get only properties.

#341
2015-04-14 11:49:10 -07:00
N. Taylor Mullen 9722319762 Refactor some pieces of Razor.
- String => string
- Updated RazorTemplateEngine to have better spacing.
2015-04-12 16:49:04 -07:00
Victor Hurdugaci 7e5387e7ab Update resource names 2015-04-08 15:09:10 -07:00
Doug Bunting 3f7c75e299 Remove and sort `using`s; reacting to #320 change
- automated pass then restore any `using`s the compiler needs
- in a couple of cases, make `using` conditional
2015-04-07 17:08:09 -07:00
Doug Bunting e469b26b45 Rationalize some names and namespaces
- #320
- `ParserErrorSink` -> `ErrorSink`
- move `ErrorSink`, `RazorError`, and `SourceLocation` to root namespace
- move `RazorErrorTest` and `SourceLocationTest` to root test namespace
2015-04-07 17:08:03 -07:00
sornaks 585002baf8 Issue #2123 - Adding AppendFormat to TagHelperContent. 2015-04-07 08:31:25 -07:00
N. Taylor Mullen 7d7b2795e1 Change tests to utilize Environment.NewLine.
- Normalized newlines for code generation tests. We default all tests to use \r\n. This way we can have a consistent test experience cross plat.
- For tests that expected indexes that were affected by new lines I modified them to account for cross plat scenarios.
- Added a few test classes to ensure we could normalize newlines for codegen tests.

#106
2015-04-03 23:50:21 -07:00
N. Taylor Mullen 1ac518d9cb Remove RazorDirectiveAttribute and related tests.
- These were not used.

#344
2015-04-03 12:19:50 -07:00
Doug Bunting 261dd108fd Merge remote-tracking branch 'origin/release' into dev 2015-04-03 12:09:04 -07:00
Doug Bunting 01aa492b7e Add a few more `<Service/>` items 2015-04-02 22:57:40 -07:00
Doug Bunting 076d4736ab Update .xproj files for Microsoft.Web.AspNet.* -> Microsoft.DNX.* rename 2015-04-02 13:49:28 -07:00
N. Taylor Mullen 3c622cb8ef Fix theory based test for Mono. 2015-04-01 20:06:46 -07:00
N. Taylor Mullen be4fb7649f Fix reflected attribute ordering in tests for Mono build.
https://github.com/davidfowl/MonoBugs/issues/3
2015-04-01 19:52:56 -07:00
N. Taylor Mullen 37a90af7d0 Fix mono build. 2015-04-01 19:13:34 -07:00
Doug Bunting 33407ef1be Enforce new invariants around HTML encoding
- #335
- bound `string` attribute values are _not_ encoded
 - rework `CSharpCodeVisitor` and `CSharpTagHelperCodeRenderer` to enable this case
- values in `TagHelperOutput.Attributes` are encoded unless special-cased elsewhere
 - `Dictionary<string, object>` type allows `RazorPage` to use `HtmlString`
- wrap HTML unbound attribute values using `Html.Raw()`
2015-03-30 11:09:26 -07:00
N. Taylor Mullen 05eb00b258 Update RazorError to be deserialized.
- Added tests to ensure RazorError can be serialized/deserialized.

#330
2015-03-23 15:25:52 -07:00
Ryan Nowak 444ea25b44 Fix build break in razor tests
This message changed because we got a fix in CoreCLR for a bug in the
host that was impacting Type.GetType and breaking data contract
serializer.
2015-03-20 19:27:26 -07:00
N. Taylor Mullen 2b6220205d Updated duplicate TargetElement TagHelper tests.
#326
2015-03-20 00:20:36 -07:00
N. Taylor Mullen 842549bba9 De-dupe TagHelperDescriptors based on Type for rendering.
- This can occur if you have multiple [TargetElement] attributes that overlap. Ultimately the descriptor is the same because its the same type, just the required attributes differ.
- Added tests to validate.

#326
2015-03-19 22:46:49 -07:00
Ajay Bhargav Baaskaran fa40fe6e46 Fix build break 2015-03-19 16:16:18 -07:00
Ajay Bhargav Baaskaran 7b468344c0 [Fixes #169] Await TagHelper generated objects 2015-03-19 16:08:07 -07:00
N. Taylor Mullen 4345b06e88 Add tests to validate TagHelper attribute targeting.
- Added tests to validate TargetElementAttribute, TagHelperDescriptorFactory, CSharpTagHelperCodeRenderer and TagHelperParseTreeRewriterTests.
- Renamed HtmlElementNameAttributeTest to TargetElementAttributeTest.

#311
2015-03-17 21:48:54 -07:00
Ajay Bhargav Baaskaran b3c60976a4 Removed @helper directive 2015-03-17 13:54:37 -07:00
sornaks 7daec14e49 Issue #318: Removing Generate*() methods. 2015-03-17 13:15:03 -07:00
N. Taylor Mullen c844314ee6 Updated xunit.runner.kre => xunit.runner.aspnet 2015-03-12 15:54:39 -07:00
N. Taylor Mullen 0196df4081 Update .kproj => .xproj. 2015-03-11 14:03:14 -07:00
N. Taylor Mullen 080ef6343c Remove BOM from project.json, *.cmd, *.sh and *.shade files. 2015-03-09 12:58:07 -07:00
N. Taylor Mullen 04276b5ddf Update aspnet50/aspnetcore50 => dnx451/dnxcore50. 2015-03-08 12:54:58 -07:00
sornaks bd9d57d33e Introducing buffering in TagHelperOutput.PreContent, Content, PostContent. 2015-03-04 12:56:13 -08:00
Ajay Bhargav Baaskaran 7ecce1b666 Replaced WebUtility.HtmlEncode with IHtmlEncoder.HtmlEncode 2015-03-03 11:32:05 -08:00
N. Taylor Mullen 4bd02badda Add tests to verify tagHelperPrefix directive.
- Added parsing, sub-rewriting, rewriting and code generation tests for runtime/designtime.
- Fixed existing tests to utilize new class structures.

#309
2015-03-02 17:07:07 -08:00
N. Taylor Mullen 677df32160 Add tests to validate TagHelperExecutionContexts Items bag.
- Added TagHelperScopeManager tests to ensure that the Items bag is correctly wrapped.
- Added test to TagHelperExecutionContext to make sure items bags are properly propogated.
- Updated existing unit tests to abide by the new constructor format of TagHelperScopeManager, TagHelperContext and TagHelperExecutionContext

#238
2015-02-22 19:13:18 -08:00
Youngjune Hong 23e6264715 Fix1571 - Supporting self-closing tags for taghelpers 2015-02-20 16:27:31 -08:00
Pranav K ffb388ab62 Changes for tag helper precompilation with tests 2015-02-19 20:25:24 -08:00
N. Taylor Mullen f53b6bb0e3 Change '?' in add and remove TagHelper to mean 1 character.
- Modified tests to account for new behavior of the '?' character in @addtaghelper and @removetaghelper.

#297
2015-02-16 18:59:20 -08:00
Doug Bunting fbe331c1ab Camel-case tag helper directives
- #264
2015-02-13 15:10:37 -08:00
N. Taylor Mullen e14dbdf9be Add parser error for empty TagHelper bound attributes.
- Errors are only created for TagHelper bound attributes that are not bound to string.
- Added tests to validate proper errors for expected input.

#289
2015-02-13 12:10:50 -08:00
N. Taylor Mullen cf3d049272 Add tests to validate TagHelper escape functionality.
- Added extensive unit tests.
- Added functional test to validate output for runtime and design time.

#187
2015-02-03 14:34:47 -08:00
N. Taylor Mullen 32f0858e8f Add tests for @addtaghelper and @removetaghelper wildcard ability.
- Also added tests to ensure cases of @addtaghelper "MyAssemblyName" create an error.
- Regenerated all CS files to folow new format.

#285
2015-02-03 12:16:01 -08:00
N. Taylor Mullen 7afd78b36a Fix empty attribute projections for TagHelpers.
- Added TagHelperParseTreeRewriter tests, attempted to cover all empty attribute edge cases.
- Added Codegen tests to validate output and DesignTimeLineMappings.

#271
2015-02-02 15:49:08 -08:00
N. Taylor Mullen a0574fb9be Add tests for TagHelper order control.
- Tested runtime run execution order control.

#94
2015-01-27 20:11:44 -08:00
N. Taylor Mullen a658c1336f Added CodeGen for TagHelper content mode redesign.
- Modified the CSharpTagHelperCodeRenderer to understand a single line of TagHelper rendering (instead of doing different things based on ContentBehavior).
- Modified existing CodeGen output to reflect new content changes.

#221
2015-01-16 11:51:02 -08:00
N. Taylor Mullen 0eb614b027 Modify tests to allow new content mode design for runtime components.
- Added a new internal ctor for TagHelperExecutionContext since it's used in multiple tests to allow for less friction testing.

#221
2015-01-16 11:34:47 -08:00
N. Taylor Mullen c38761f504 Remove ContentBehavior.
- Removed all tests and instances of ContentBehavior in preparation for moving to a non-ContentBehavior based design.
- Removed ContentBehavior specific CodeGeneration.

#221
2015-01-16 11:34:45 -08:00
Doug Bunting de4cafa8cd Handle complex expressions for bound non-string tag helper attributes
- #129 and support aspnet/Mvc#1253
- add new `CSharpTagHelperAttributeValueVisitor` that writes the raw expression
- add tests of embedded `@(...)` and mix that with normal expressions
- add new resources for errors in `CSharpTagHelperAttributeValueVisitor`
 - write errors using `ParserErrorSink`
- update baselines to match new code generation

nits:
- cleanup long lines in `CSharpTagHelperCodeRenderer`
- remove a few unused resources
2015-01-15 16:32:16 -08:00
Doug Bunting 7b8126367c Minor: `LineMapping` and `MappingLocation` debug visualizations were types' full names
- add `ToString()` overrides for these classes

Nits:
- improve assertion failures about code mapping mismatches
- add `GENERATE_BASELINES` reminder to test project.json
2015-01-15 16:32:06 -08:00
Doug Bunting 26afdbd889 Plumb `ParserErrorSink` through to `CodeBuilderContext`
- precursor for #129
- remove unused `GeneratorResults` ctor to avoid duplicating `ParserResults` code

nit: make a few `ParserResults` properties immutable
- also change `ParserErrors` type to `IEnumerable<RazorError>`
2015-01-15 16:31:33 -08:00