- 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
- 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
- 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
- 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
- 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
- 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
- [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
- #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
- 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
- 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
- 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
- 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`
- 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
- Updated the Razor parser to understand minimized attributes instead of just treating them like plain text. This just involved encompassing minimized attributes in their own blocks just like the other attributes found on the HTML tag.
- Updated TagHelperParseTreeRewriter to only accept minimized attributes for unbound attributes.
- Updated IReadOnlyTagHelperAttribute/TagHelperAttribute to have a Minimized property to indicate that an attribute was minimized.
- Updated parser level block structures to represent minimized attributes as null syntax tree nodes.
- Updated chunk level structures to represent minimized attributes as null chunks.
#220
- 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
- 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
- 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
- `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.
- #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
- Added a TagHelperAttributes object that's used to hold 1=>many attributes. Is used for TagHelperOutput.Attributes.
- Added a ReadOnlyTagHelperAttributes object that holds 1=>many IReadOnlyTagHelperAttributes. Is used for TagHelperContext.AllAttributes.
- Added a TagHelperAttribute object which is used to represent attributes.
- Added a IReadOnlyTagHelperAttribute which is used to represent attributes which cannot be modified.
#279
- #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
- 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