コード例 #1
0
test("matches the correct routes", function() {
  ok(checkCurrentRoute('whatever', 'application'), 'application is always current');
  ok(checkCurrentRoute('index', 'index'), 'index route matches correctly');
  ok(!checkCurrentRoute('posts.index', 'index'), 'resource match fails even when route name same as resource name');

  ok(checkCurrentRoute('posts.show', 'posts'), 'resource matches correctly');
  ok(!checkCurrentRoute('posts.show', 'comments'), 'resource matches correctly');
  ok(checkCurrentRoute('posts.comments.show', 'posts'), 'parent resource of nested resources matches correctly');
  ok(checkCurrentRoute('comments.show', 'comments.show'), 'exact resource and route matches correctly');
  ok(checkCurrentRoute('posts.comments.show', 'comments.show'), 'child resource and route matches correctly');

});
コード例 #2
0
ファイル: route_tree.js プロジェクト: Gozhack/ember-inspector
  arrangedContent: filter('content', function(routeItem) {
    var currentRoute = this.get('currentRoute'),
        hideRoutes = this.get('options.hideRoutes');

    if( hideRoutes && currentRoute ) {
      return checkCurrentRoute( currentRoute, routeItem.value.name );
    } else {
      return true;
    }
  }).property('content', 'options.hideRoutes'),