Skip to content

Commit 1c50c6a

Browse files
committed
minors
1 parent d1c3073 commit 1c50c6a

11 files changed

+75
-125
lines changed

lib/core/annotation_src.dart

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -300,14 +300,6 @@ class Component extends Directive {
300300
}
301301
final bool _resetStyleInheritance;
302302

303-
/**
304-
* An expression under which the component's controller instance will be
305-
* published into. This allows the expressions in the template to be referring
306-
* to controller instance and its properties.
307-
*/
308-
@deprecated
309-
final String publishAs;
310-
311303
/**
312304
* If set to true, this component will always use shadow DOM.
313305
* If set to false, this component will never use shadow DOM.
@@ -321,7 +313,6 @@ class Component extends Directive {
321313
cssUrl,
322314
applyAuthorStyles,
323315
resetStyleInheritance,
324-
this.publishAs,
325316
module,
326317
map,
327318
selector,
@@ -351,7 +342,6 @@ class Component extends Directive {
351342
cssUrl: cssUrls,
352343
applyAuthorStyles: applyAuthorStyles,
353344
resetStyleInheritance: resetStyleInheritance,
354-
publishAs: publishAs,
355345
map: newMap,
356346
module: module,
357347
selector: selector,
@@ -420,16 +410,8 @@ class Decorator extends Directive {
420410
*/
421411
@deprecated
422412
class Controller extends Decorator {
423-
/**
424-
* An expression under which the controller instance will be published into.
425-
* This allows the expressions in the template to be referring to controller
426-
* instance and its properties.
427-
*/
428-
final String publishAs;
429-
430413
const Controller({
431414
children: Directive.COMPILE_CHILDREN,
432-
this.publishAs,
433415
map,
434416
module,
435417
selector,
@@ -448,7 +430,6 @@ class Controller extends Decorator {
448430
Directive _cloneWithNewMap(newMap) =>
449431
new Controller(
450432
children: children,
451-
publishAs: publishAs,
452433
module: module,
453434
map: newMap,
454435
selector: selector,

test/core/annotation_src_spec.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ void main() => describe('annotations', () {
3939
cssUrl: [''],
4040
applyAuthorStyles: true,
4141
resetStyleInheritance: true,
42-
publishAs: '',
4342
module: (){},
4443
map: {},
4544
selector: '',
@@ -80,7 +79,6 @@ void main() => describe('annotations', () {
8079
describe('controller', () {
8180
it('should set all fields on clone when all the fields are set', () {
8281
var controller = new Controller(
83-
publishAs: '',
8482
children: 'xxx',
8583
map: {},
8684
selector: '',

test/core/core_directive_spec.dart

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ void main() {
2323
expect(annotation.template).toEqual('template');
2424
expect(annotation.templateUrl).toEqual('templateUrl');
2525
expect(annotation.cssUrls).toEqual(['cssUrls']);
26-
expect(annotation.publishAs).toEqual('ctrl');
2726
expect(annotation.map).toEqual({
2827
'foo': '=>foo',
2928
'attr': '@attr',
@@ -104,15 +103,14 @@ class NullParser implements Parser {
104103
template: 'template',
105104
templateUrl: 'templateUrl',
106105
cssUrl: const ['cssUrls'],
107-
publishAs: 'ctrl',
108106
module: AnnotatedIoComponent.module,
109107
visibility: Directive.LOCAL_VISIBILITY,
110108
exportExpressions: const ['exportExpressions'],
111-
map: const {
112-
'foo': '=>foo'
113-
})
109+
map: const {'foo': '=>foo'})
114110
class AnnotatedIoComponent {
115-
static module() => new Module()..bind(String, toFactory: (i) => i.get(AnnotatedIoComponent),
111+
static module() => new Module()..bind(
112+
String,
113+
toFactory: (i) => i.get(AnnotatedIoComponent),
116114
visibility: Directive.LOCAL_VISIBILITY);
117115

118116
AnnotatedIoComponent(Scope scope) {

test/core_dom/compiler_spec.dart

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -758,18 +758,12 @@ void main() {
758758
}
759759

760760

761-
@Controller(
762-
selector: '[my-parent-controller]',
763-
publishAs: 'my_parent')
761+
@Controller(selector: '[my-parent-controller]')
764762
class MyParentController {
765-
data() {
766-
return "my data";
767-
}
763+
String data() => "my data";
768764
}
769765

770-
@Controller(
771-
selector: '[my-child-controller]',
772-
publishAs: 'my_child')
766+
@Controller(selector: '[my-child-controller]')
773767
class MyChildController {}
774768

775769
@Component(
@@ -882,8 +876,7 @@ class SimpleComponent {
882876
@Component(
883877
selector: 'shadowy',
884878
template: r'With shadow DOM',
885-
useShadowDom: true
886-
)
879+
useShadowDom: true)
887880
class ShadowyComponent {
888881
ShadowyComponent(Logger log) {
889882
log('shadowy');
@@ -893,8 +886,7 @@ class ShadowyComponent {
893886
@Component(
894887
selector: 'shadowless',
895888
template: r'Without shadow DOM',
896-
useShadowDom: false
897-
)
889+
useShadowDom: false)
898890
class ShadowlessComponent {
899891
ShadowlessComponent(Logger log) {
900892
log('shadowless');
@@ -903,13 +895,13 @@ class ShadowlessComponent {
903895

904896
@Component(
905897
selector: 'sometimes',
906-
template: r'<div ng-if="ctrl.sometimes"><content></content></div>',
907-
publishAs: 'ctrl')
898+
template: r'<div ng-if="sometimes"><content></content></div>')
908899
class SometimesComponent {
909900
@NgTwoWay('sometimes')
910901
var sometimes;
911902
}
912903

904+
// todo(vicb)
913905
@Component(
914906
selector: 'io',
915907
template: r'<content></content>',
@@ -920,8 +912,7 @@ class SometimesComponent {
920912
})
921913
class IoComponent {
922914
Scope scope;
923-
IoComponent(Scope scope) {
924-
this.scope = scope;
915+
IoComponent(this.scope) {
925916
scope.rootScope.context['ioComponent'] = this;
926917
scope.context['expr'] = 'initialExpr';
927918
}
@@ -930,7 +921,6 @@ class IoComponent {
930921
@Component(
931922
selector: 'io-controller',
932923
template: r'<content></content>',
933-
publishAs: 'ctrl',
934924
map: const {
935925
'attr': '@attr',
936926
'expr': '<=>expr',
@@ -945,8 +935,7 @@ class IoControllerComponent {
945935
var exprOnce;
946936
var onDone;
947937
var onOptional;
948-
IoControllerComponent(Scope scope) {
949-
this.scope = scope;
938+
IoControllerComponent(this.scope) {
950939
scope.rootScope.context['ioComponent'] = this;
951940
}
952941
}
@@ -1010,24 +999,20 @@ class ParentExpressionComponent {
1010999

10111000
@Component(
10121001
selector: 'publish-me',
1013-
template: r'{{ctrlName.value}}',
1014-
publishAs: 'ctrlName')
1002+
template: r'{{ctrlName.value}}')
10151003
class PublishMeComponent {
10161004
String value = 'WORKED';
10171005
}
10181006

1019-
@Controller (
1020-
selector: '[publish-me]',
1021-
publishAs: 'ctrlName')
1007+
@Controller (selector: '[publish-me]')
10221008
class PublishMeDirective {
10231009
String value = 'WORKED';
10241010
}
10251011

10261012

10271013
@Component(
10281014
selector: 'log',
1029-
template: r'<content></content>',
1030-
publishAs: 'ctrlName')
1015+
template: r'<content></content>')
10311016
class LogComponent {
10321017
LogComponent(Scope scope, Logger logger) {
10331018
logger(scope);
@@ -1058,17 +1043,17 @@ class AttachDetachComponent implements AttachAware, DetachAware, ShadowRootAware
10581043
templateLoader.template.then((_) => logger('templateLoaded'));
10591044
}
10601045

1061-
attach() => logger('attach:@$attrValue; =>$exprValue; =>!$onceValue');
1062-
detach() => logger('detach');
1063-
onShadowRoot(shadowRoot) {
1046+
void attach() => logger('attach:@$attrValue; =>$exprValue; =>!$onceValue');
1047+
1048+
void detach() => logger('detach');
1049+
1050+
void onShadowRoot(shadowRoot) {
10641051
scope.rootScope.context['shadowRoot'] = shadowRoot;
10651052
logger(shadowRoot);
10661053
}
10671054
}
10681055

1069-
@Controller(
1070-
selector: '[my-controller]',
1071-
publishAs: 'myCtrl')
1056+
@Controller(selector: '[my-controller]')
10721057
class MyController {
10731058
MyController(Scope scope) {
10741059
scope.context['name'] = 'MyController';
@@ -1083,15 +1068,12 @@ class InvalidSelector {}
10831068

10841069
@Formatter(name:'hello')
10851070
class SayHelloFormatter {
1086-
call(String str) {
1087-
return 'Hello, $str!';
1088-
}
1071+
String call(String str) => 'Hello, $str!';
10891072
}
10901073

10911074
@Component(
10921075
selector: 'expr-attr-component',
10931076
template: r'<content></content>',
1094-
publishAs: 'ctrl',
10951077
map: const {
10961078
'expr': '<=>expr',
10971079
'one-way': '=>oneWay',
@@ -1115,16 +1097,16 @@ class SimpleAttachComponent implements AttachAware, ShadowRootAware {
11151097
SimpleAttachComponent(this.logger) {
11161098
logger('SimpleAttachComponent');
11171099
}
1118-
attach() => logger('attach');
1119-
onShadowRoot(_) => logger('onShadowRoot');
1100+
void attach() => logger('attach');
1101+
void onShadowRoot(_) => logger('onShadowRoot');
11201102
}
11211103

11221104
@Component(
11231105
selector: 'log-element',
11241106
templateUrl: 'foo.html')
11251107
class LogElementComponent{
11261108
LogElementComponent(Logger logger, Element element, Node node,
1127-
ShadowRoot shadowRoot) {
1109+
ShadowRoot shadowRoot) {
11281110
logger(element);
11291111
logger(node);
11301112
logger(shadowRoot);

test/core_dom/event_handler_spec.dart

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ library event_handler_spec;
22

33
import '../_specs.dart';
44

5-
@Controller(selector: '[foo]', publishAs: 'ctrl')
5+
@Controller(selector: '[foo]')
66
class FooController {
77
var description = "desc";
88
var invoked = false;
@@ -11,14 +11,14 @@ class FooController {
1111
@Component(selector: 'bar',
1212
template: '''
1313
<div>
14-
<span on-abc="ctrl.invoked=true;"></span>
14+
<span on-abc="invoked=true;"></span>
1515
<content></content>
1616
</div>
17-
''',
18-
publishAs: 'ctrl')
17+
''')
1918
class BarComponent {
2019
var invoked = false;
2120
BarComponent(RootScope scope) {
21+
// todo(vicb)
2222
scope.context['ctrl'] = this;
2323
}
2424
}
@@ -58,7 +58,7 @@ main() {
5858
it('shoud register and handle event with long name', inject((TestBed _) {
5959
var e = compile(_,
6060
'''<div foo>
61-
<div on-my-new-event="ctrl.invoked=true;"></div>
61+
<div on-my-new-event="invoked=true;"></div>
6262
</div>''');
6363

6464
_.triggerEvent(e.querySelector('[on-my-new-event]'), 'myNewEvent');
@@ -69,7 +69,7 @@ main() {
6969
it('shoud have model updates applied correctly', inject((TestBed _) {
7070
var e = compile(_,
7171
'''<div foo>
72-
<div on-abc='ctrl.description="new description";'>{{ctrl.description}}</div>
72+
<div on-abc='description="new description";'>{{description}}</div>
7373
</div>''');
7474
var el = document.querySelector('[on-abc]');
7575
el.dispatchEvent(new Event('abc'));
@@ -93,7 +93,7 @@ main() {
9393
var e = compile(_,
9494
'''<div foo>
9595
<bar>
96-
<div on-abc="ctrl.invoked=true;"></div>
96+
<div on-abc="invoked=true;"></div>
9797
</bar>
9898
</div>''');
9999

0 commit comments

Comments
 (0)