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

Commit 03a7516

Browse files
committed
refactor(ng_view_spec): Use the new router API
1 parent d267af6 commit 03a7516

File tree

1 file changed

+22
-40
lines changed

1 file changed

+22
-40
lines changed

test/routing/ng_view_spec.dart

Lines changed: 22 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -168,50 +168,32 @@ main() {
168168
}
169169

170170
class FlatRouteInitializer implements Function {
171-
void call(Router router, RouteViewFactory view) {
172-
router.root
173-
..addRoute(
174-
name: 'foo',
175-
path: '/foo',
176-
enter: view('foo.html'))
177-
..addRoute(
178-
name: 'bar',
179-
path: '/bar',
180-
enter: view('bar.html'))
181-
..addRoute(
182-
name: 'baz',
183-
path: '/baz'); // route without a template
171+
void call(Router router, RouteViewFactory views) {
172+
views.configure({
173+
'foo': ngRoute(path: '/foo', view:'foo.html'),
174+
'bar': ngRoute(path: '/bar', view: 'bar.html'),
175+
'baz': ngRoute(path: '/baz'),
176+
});
184177
}
185178
}
186179

187180
class NestedRouteInitializer implements Function {
188-
void call(Router router, RouteViewFactory view) {
189-
router.root
190-
..addRoute(
191-
name: 'library',
181+
void call(Router router, RouteViewFactory views) {
182+
views.configure({
183+
'library': ngRoute(
192184
path: '/library',
193-
enter: view('library.html'),
194-
mount: (Route route) => route
195-
..addRoute(
196-
name: 'all',
197-
path: '/all',
198-
enter: view('book_list.html'))
199-
..addRoute(
200-
name: 'book',
201-
path: '/:bookId',
202-
mount: (Route route) => route
203-
..addRoute(
204-
name: 'overview',
205-
path: '/overview',
206-
defaultRoute: true,
207-
enter: view('book_overview.html'))
208-
..addRoute(
209-
name: 'read',
210-
path: '/read',
211-
enter: view('book_read.html'))))
212-
..addRoute(
213-
name: 'admin',
214-
path: '/admin',
215-
enter: view('admin.html'));
185+
view: 'library.html',
186+
mount: {
187+
'all': ngRoute(path: '/all', view: 'book_list.html'),
188+
'book': ngRoute(
189+
path: '/:bookId',
190+
mount: {
191+
'overview': ngRoute(path: '/overview', view: 'book_overview.html',
192+
defaultRoute: true),
193+
'read': ngRoute(path: '/read', view: 'book_read.html'),
194+
'admin': ngRoute(path: '/admin', view: 'admin.html'),
195+
})
196+
})
197+
});
216198
}
217199
}

0 commit comments

Comments
 (0)