Skip to content

Commit dbce753

Browse files
committed
minors
1 parent b1ec91f commit dbce753

12 files changed

+75
-126
lines changed

example/pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ packages:
1818
barback:
1919
description: barback
2020
source: hosted
21-
version: "0.12.0"
21+
version: "0.13.0"
2222
browser:
2323
description: browser
2424
source: hosted

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: 3 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,13 @@ 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()..factory(String,
111+
static module() => new Module()..factory(
112+
String,
116113
(i) => i.get(AnnotatedIoComponent),
117114
visibility: Directive.LOCAL_VISIBILITY);
118115

test/core_dom/compiler_spec.dart

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

717717

718-
@Controller(
719-
selector: '[my-parent-controller]',
720-
publishAs: 'my_parent')
718+
@Controller(selector: '[my-parent-controller]')
721719
class MyParentController {
722-
data() {
723-
return "my data";
724-
}
720+
String data() => "my data";
725721
}
726722

727-
@Controller(
728-
selector: '[my-child-controller]',
729-
publishAs: 'my_child')
723+
@Controller(selector: '[my-child-controller]')
730724
class MyChildController {}
731725

732726
@Component(
@@ -839,8 +833,7 @@ class SimpleComponent {
839833
@Component(
840834
selector: 'shadowy',
841835
template: r'With shadow DOM',
842-
useShadowDom: true
843-
)
836+
useShadowDom: true)
844837
class ShadowyComponent {
845838
ShadowyComponent(Logger log) {
846839
log('shadowy');
@@ -850,8 +843,7 @@ class ShadowyComponent {
850843
@Component(
851844
selector: 'shadowless',
852845
template: r'Without shadow DOM',
853-
useShadowDom: false
854-
)
846+
useShadowDom: false)
855847
class ShadowlessComponent {
856848
ShadowlessComponent(Logger log) {
857849
log('shadowless');
@@ -860,13 +852,13 @@ class ShadowlessComponent {
860852

861853
@Component(
862854
selector: 'sometimes',
863-
template: r'<div ng-if="ctrl.sometimes"><content></content></div>',
864-
publishAs: 'ctrl')
855+
template: r'<div ng-if="sometimes"><content></content></div>')
865856
class SometimesComponent {
866857
@NgTwoWay('sometimes')
867858
var sometimes;
868859
}
869860

861+
// todo(vicb)
870862
@Component(
871863
selector: 'io',
872864
template: r'<content></content>',
@@ -877,8 +869,7 @@ class SometimesComponent {
877869
})
878870
class IoComponent {
879871
Scope scope;
880-
IoComponent(Scope scope) {
881-
this.scope = scope;
872+
IoComponent(this.scope) {
882873
scope.rootScope.context['ioComponent'] = this;
883874
scope.context['expr'] = 'initialExpr';
884875
}
@@ -887,7 +878,6 @@ class IoComponent {
887878
@Component(
888879
selector: 'io-controller',
889880
template: r'<content></content>',
890-
publishAs: 'ctrl',
891881
map: const {
892882
'attr': '@attr',
893883
'expr': '<=>expr',
@@ -902,8 +892,7 @@ class IoControllerComponent {
902892
var exprOnce;
903893
var onDone;
904894
var onOptional;
905-
IoControllerComponent(Scope scope) {
906-
this.scope = scope;
895+
IoControllerComponent(this.scope) {
907896
scope.rootScope.context['ioComponent'] = this;
908897
}
909898
}
@@ -967,24 +956,20 @@ class ParentExpressionComponent {
967956

968957
@Component(
969958
selector: 'publish-me',
970-
template: r'{{ctrlName.value}}',
971-
publishAs: 'ctrlName')
959+
template: r'{{ctrlName.value}}')
972960
class PublishMeComponent {
973961
String value = 'WORKED';
974962
}
975963

976-
@Controller (
977-
selector: '[publish-me]',
978-
publishAs: 'ctrlName')
964+
@Controller (selector: '[publish-me]')
979965
class PublishMeDirective {
980966
String value = 'WORKED';
981967
}
982968

983969

984970
@Component(
985971
selector: 'log',
986-
template: r'<content></content>',
987-
publishAs: 'ctrlName')
972+
template: r'<content></content>')
988973
class LogComponent {
989974
LogComponent(Scope scope, Logger logger) {
990975
logger(scope);
@@ -1015,17 +1000,17 @@ class AttachDetachComponent implements AttachAware, DetachAware, ShadowRootAware
10151000
templateLoader.template.then((_) => logger('templateLoaded'));
10161001
}
10171002

1018-
attach() => logger('attach:@$attrValue; =>$exprValue; =>!$onceValue');
1019-
detach() => logger('detach');
1020-
onShadowRoot(shadowRoot) {
1003+
void attach() => logger('attach:@$attrValue; =>$exprValue; =>!$onceValue');
1004+
1005+
void detach() => logger('detach');
1006+
1007+
void onShadowRoot(shadowRoot) {
10211008
scope.rootScope.context['shadowRoot'] = shadowRoot;
10221009
logger(shadowRoot);
10231010
}
10241011
}
10251012

1026-
@Controller(
1027-
selector: '[my-controller]',
1028-
publishAs: 'myCtrl')
1013+
@Controller(selector: '[my-controller]')
10291014
class MyController {
10301015
MyController(Scope scope) {
10311016
scope.context['name'] = 'MyController';
@@ -1040,15 +1025,12 @@ class InvalidSelector {}
10401025

10411026
@Formatter(name:'hello')
10421027
class SayHelloFilter {
1043-
call(String str) {
1044-
return 'Hello, $str!';
1045-
}
1028+
String call(String str) => 'Hello, $str!';
10461029
}
10471030

10481031
@Component(
10491032
selector: 'expr-attr-component',
10501033
template: r'<content></content>',
1051-
publishAs: 'ctrl',
10521034
map: const {
10531035
'expr': '<=>expr',
10541036
'one-way': '=>oneWay',
@@ -1072,16 +1054,16 @@ class SimpleAttachComponent implements AttachAware, ShadowRootAware {
10721054
SimpleAttachComponent(this.logger) {
10731055
logger('SimpleAttachComponent');
10741056
}
1075-
attach() => logger('attach');
1076-
onShadowRoot(_) => logger('onShadowRoot');
1057+
void attach() => logger('attach');
1058+
void onShadowRoot(_) => logger('onShadowRoot');
10771059
}
10781060

10791061
@Component(
10801062
selector: 'log-element',
10811063
templateUrl: 'foo.html')
10821064
class LogElementComponent{
10831065
LogElementComponent(Logger logger, Element element, Node node,
1084-
ShadowRoot shadowRoot) {
1066+
ShadowRoot shadowRoot) {
10851067
logger(element);
10861068
logger(node);
10871069
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)