Commit Graph

61 Commits

Author SHA1 Message Date
N. Taylor Mullen e5e4a22966 Update LICENSE.txt and license header on files. 2015-05-01 13:58:52 -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 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
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
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
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
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 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
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 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 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 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
N. Taylor Mullen 8c47f6a67e Modify tests to account for new tag and attribute names for TagHelpers.
- Also added additional tests to validate new lower kebab casing.

#240
2015-01-13 22:51:20 -08:00
Ajay Bhargav Baaskaran 891dfa5e3e renamed TagNameAttribute to HtmlElementNameAttribute 2014-12-29 10:50:27 -08:00
Ryan Nowak ceaf257cd5 Update Razor to use official xunit runner 2014-12-16 12:05:53 -08:00
DamianEdwards 7890a1b34c Added TagHelperContext.UniqueId:
- The ID is created at view compilation time and is unique per TagHelperExecutionContext and thus per HTML element in the source for which Tag Helpers will run
- #241
2014-12-12 16:25:42 -08:00
N. Taylor Mullen c680833350 Expose GetExportedTypes on TagHelperTypeResolver.
- This will enable tooling to provide their own mechanism for resolving assemblies.
2014-12-09 12:39:02 -08:00
Victor Hurdugaci 810146115b Add schema version to kproj files 2014-11-25 11:00:49 -08:00
N. Taylor Mullen 0d60da296d Add and modify tests to validate TagHelperDescriptorResolver doesn't throw.
- Modified existing tests that expected the resolvers to throw to no longer throw.
- Added new test to validate that unexpected errors that are thrown are also handled.

#210
2014-11-24 10:30:11 -08:00
Doug Bunting 0f724a51df Delete trailing whitespace
- #EngineeringDay
- Total replaced: 506  Matching files: 118

Did not change any files under test/Microsoft.AspNet.Razor.Test/TestFiles
- avoiding need to redo hashes
2014-11-20 14:16:32 -08:00
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 64a5b8ee22 Addressed code review comments. 2014-11-19 10:07:33 -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
Victor Hurdugaci 39accef1ad Update KProj to the latest format 2014-11-12 15:24:16 -08:00