Skip to content
This repository was archived by the owner on Sep 16, 2022. It is now read-only.

Commit fd7c926

Browse files
committed
Fix default value for properties to match attributres.
PiperOrigin-RevId: 183001593
1 parent 24cb132 commit fd7c926

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

_tests/test/compiler/ast_template_parser_test.dart

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -568,12 +568,13 @@ void main() {
568568
selector: '[a]',
569569
type: new CompileTypeMetadata(
570570
moduleUrl: someModuleUrl, name: 'DirA'),
571-
inputs: ['a']);
572-
expect(humanizeTplAst(parse('<div a></div>', [dirA])), [
571+
inputs: ['a', 'b']);
572+
expect(humanizeTplAst(parse('<div a [b]></div>', [dirA])), [
573573
[ElementAst, 'div'],
574574
[AttrAst, 'a', ''],
575575
[DirectiveAst, dirA],
576-
[BoundDirectivePropertyAst, 'a', '']
576+
[BoundDirectivePropertyAst, 'a', ''],
577+
[BoundDirectivePropertyAst, 'b', '']
577578
]);
578579
});
579580

@@ -1273,7 +1274,7 @@ void main() {
12731274
expect(humanizeTplAst(parse('<div *ngIf></div>', [ngIf])), [
12741275
[EmbeddedTemplateAst],
12751276
[DirectiveAst, ngIf],
1276-
[BoundDirectivePropertyAst, 'ngIf', 'null'],
1277+
[BoundDirectivePropertyAst, 'ngIf', ''],
12771278
[ElementAst, 'div']
12781279
]);
12791280
});

_tests/test/compiler/template_parser_test.dart

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -516,12 +516,13 @@ void main() {
516516
selector: "[a]",
517517
type: new CompileTypeMetadata(
518518
moduleUrl: someModuleUrl, name: "DirA"),
519-
inputs: ["a"]);
520-
expect(humanizeTplAst(parse("<div a></div>", [dirA])), [
519+
inputs: ["a", "b"]);
520+
expect(humanizeTplAst(parse("<div a [b]></div>", [dirA])), [
521521
[ElementAst, "div"],
522522
[AttrAst, "a", ""],
523523
[DirectiveAst, dirA],
524-
[BoundDirectivePropertyAst, "a", ""]
524+
[BoundDirectivePropertyAst, "a", ""],
525+
[BoundDirectivePropertyAst, "b", ""],
525526
]);
526527
});
527528

angular/lib/src/compiler/ast_template_parser.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ class _BindDirectivesVisitor
404404
[_ParseContext context]) {
405405
try {
406406
var value = context.templateContext.parser.parseBinding(
407-
astNode.value ?? 'null',
407+
astNode.value ?? '',
408408
_location(astNode),
409409
context.templateContext.exports);
410410
// If we bind the property to a directive input, or the element is a

0 commit comments

Comments
 (0)