Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit f0a227d

Browse files
committed
style: code cleanup
1 parent 1a2235a commit f0a227d

File tree

7 files changed

+18
-29
lines changed

7 files changed

+18
-29
lines changed

lib/core_dom/view_factory.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ class ViewCache {
129129
ViewFactory fromHtml(String html, DirectiveMap directives) {
130130
ViewFactory viewFactory = _viewFactoryCache.get(html);
131131
if (viewFactory == null) {
132-
var div = new dom.Element.tag('div');
132+
var div = new dom.DivElement();
133133
div.setInnerHtml(html, treeSanitizer: treeSanitizer);
134134
viewFactory = compiler(div.nodes, directives);
135135
_viewFactoryCache.put(html, viewFactory);

lib/directive/ng_base_css.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
part of angular.directive;
22

3-
@Decorator(
4-
selector: '[ng-base-css]',
5-
visibility: Directive.CHILDREN_VISIBILITY
6-
)
3+
@Decorator(selector: '[ng-base-css]')
74
class NgBaseCss {
85
List<String> _urls = const [];
96

lib/directive/ng_form.dart

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,20 @@ part of angular.directive;
77
*/
88
@Decorator(
99
selector: 'form',
10-
module: NgForm.module,
11-
visibility: Directive.CHILDREN_VISIBILITY)
10+
module: NgForm.module)
1211
@Decorator(
1312
selector: 'fieldset',
14-
module: NgForm.module,
15-
visibility: Directive.CHILDREN_VISIBILITY)
13+
module: NgForm.module)
1614
@Decorator(
1715
selector: '.ng-form',
18-
module: NgForm.module,
19-
visibility: Directive.CHILDREN_VISIBILITY)
16+
module: NgForm.module)
2017
@Decorator(
2118
selector: '[ng-form]',
2219
module: NgForm.module,
23-
map: const { 'ng-form': '@name' },
24-
visibility: Directive.CHILDREN_VISIBILITY)
20+
map: const { 'ng-form': '@name' })
2521
class NgForm extends NgControl {
2622
static final Module _module = new Module()
27-
..factory(NgControl, (i) => i.get(NgForm), visibility: Directive.CHILDREN_VISIBILITY);
23+
..factory(NgControl, (i) => i.get(NgForm));
2824
static module() => _module;
2925

3026
final Scope _scope;

lib/directive/ng_model_select.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ part of angular.directive;
1818
*
1919
*/
2020
@Decorator(
21-
selector: 'select[ng-model]',
22-
visibility: Directive.CHILDREN_VISIBILITY)
21+
selector: 'select[ng-model]')
2322
class InputSelect implements AttachAware {
2423
final expando = new Expando<OptionValue>();
2524
final dom.SelectElement _selectElement;

lib/routing/ng_bind_route.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ part of angular.routing;
2323
* however it does not effect view resolution by nested ng-view(s).
2424
*/
2525
@Decorator(
26-
visibility: Directive.CHILDREN_VISIBILITY,
2726
selector: '[ng-bind-route]',
2827
module: NgBindRoute.module,
2928
map: const {'ng-bind-route': '@routeName'})

lib/routing/routing.dart

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class RouteViewFactory {
2121

2222
_configure(Route route, Map<String, NgRouteCfg> config) {
2323
config.forEach((name, cfg) {
24-
var moduledCalled = false;
24+
var modulesCalled = false;
2525
List<Module> newModules;
2626
route.addRoute(
2727
name: name,
@@ -37,8 +37,8 @@ class RouteViewFactory {
3737
}
3838
},
3939
preEnter: (RoutePreEnterEvent e) {
40-
if (cfg.modules != null && !moduledCalled) {
41-
moduledCalled = true;
40+
if (cfg.modules != null && !modulesCalled) {
41+
modulesCalled = true;
4242
var modules = cfg.modules();
4343
if (modules is Future) {
4444
e.allowEnter(modules.then((List<Module> m) {
@@ -92,10 +92,8 @@ class NgRouteCfg {
9292
*
9393
* The [init] method will be called by the framework once the router is
9494
* instantiated but before [NgBindRouteDirective] and [NgViewDirective].
95-
*
96-
* Deprecated: use RouteInitializerFn instead.
9795
*/
98-
@deprecated
96+
@Deprecated("use RouteInitializerFn instead")
9997
abstract class RouteInitializer {
10098
void init(Router router, RouteViewFactory viewFactory);
10199
}
@@ -146,7 +144,7 @@ class NgRoutingHelper {
146144
router.listen(appRoot: _ngApp.element);
147145
}
148146

149-
_reloadViews({Route startingFrom}) {
147+
void _reloadViews({Route startingFrom}) {
150148
var alreadyActiveViews = [];
151149
var activePath = router.activePath;
152150
if (startingFrom != null) {
@@ -169,16 +167,16 @@ class NgRoutingHelper {
169167
}
170168
}
171169

172-
_route(Route route, String template, {bool fromEvent, List<Module> modules,
170+
void _route(Route route, String template, {bool fromEvent, List<Module> modules,
173171
String templateHtml}) {
174172
_templates[_routePath(route)] = new _View(template, templateHtml, modules);
175173
}
176174

177-
_registerPortal(NgView ngView) {
175+
void _registerPortal(NgView ngView) {
178176
portals.add(ngView);
179177
}
180178

181-
_unregisterPortal(NgView ngView) {
179+
void _unregisterPortal(NgView ngView) {
182180
portals.remove(ngView);
183181
}
184182
}

test/directive/ng_if_spec.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ main() {
141141
compile(html);
142142
expect(element).toHaveText('content');
143143
element.querySelector('span').classes.remove('my-class');
144-
expect(element.querySelector('span').classes.contains('my-class')).not.toBe(true);
144+
expect(element.querySelector('span')).not.toHaveClass('my-class');
145145
rootScope.apply(() {
146146
rootScope.context['isVisible'] = false;
147147
});
@@ -150,7 +150,7 @@ main() {
150150
rootScope.context['isVisible'] = true;
151151
});
152152
// The newly inserted node should be a copy of the compiled state.
153-
expect(element.querySelector('span').classes.contains('my-class')).toBe(true);
153+
expect(element.querySelector('span')).toHaveClass('my-class');
154154
}
155155
);
156156

0 commit comments

Comments
 (0)