Commit Graph

313 Commits

Author SHA1 Message Date
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
N. Taylor Mullen 7c604d2b11 Add TagHelperOutput.Attributes and TagHelperContext.AllAttributes replacement.
- 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
2015-04-27 12:06:00 -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 96dc7ea6c5 Change TagHelperDescriptorFactory IsValidProperty => IsAccessibleProperty. 2015-04-14 12:22:10 -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
sornaks 744c9c47b4 Adding NotNulls for format and format provider in DefaultTagHelperContent.AppendFormat. 2015-04-09 11:01:40 -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
N. Taylor Mullen 1831ff57e3 Update .travis.yml and appveyor.yml to build quietly. 2015-04-07 16:16:19 -07:00
N. Taylor Mullen cf98e16436 Merge branch 'release' into dev 2015-04-07 14:48:32 -07:00
N. Taylor Mullen 84afe105ec Add serviceable attribute to projects.
aspnet/DNX#1600
2015-04-07 14:48:25 -07:00
sornaks 585002baf8 Issue #2123 - Adding AppendFormat to TagHelperContent. 2015-04-07 08:31:25 -07:00
N. Taylor Mullen 71b1a57617 Normalize README.md build status badges. 2015-04-06 11:55:11 -07:00
N. Taylor Mullen 62c40ecc89 Add Appveyor status badge. 2015-04-06 11:53:59 -07:00
N. Taylor Mullen c4e7a539fa Fix README.md. 2015-04-05 14:38:58 -07:00
N. Taylor Mullen b02ab87cde Added travis-ci badge. 2015-04-04 00:30:16 -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
Wei Wang 98df1e230b Fix AppVeyor git line ending config 2015-04-03 15:31:35 -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
Troy Dai 9a9ff5084e Update global.json, sources=>projects 2015-04-02 09:20:25 -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
N. Taylor Mullen aedefcd03d Turn off sudo for .travis.yml. 2015-04-01 17:07:16 -07:00
N. Taylor Mullen b00a6828b1 Add travis and appveyor CI support. 2015-04-01 15:54:21 -07:00
Doug Bunting 25376c3377 Merge remote-tracking branch 'origin/release' into dev 2015-03-30 11:19:09 -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
suhasj 718726ed76 Merge branch 'release' into dev 2015-03-25 11:47:11 -07:00
suhasj 80566401f8 Updating to release NuGet.config 2015-03-25 11:47:10 -07:00
Wei Wang 370c986ab3 Remove k command and use dnx instead 2015-03-24 21:36:19 -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