All files / app/features/article/resolvers article-tab-title.resolver.ts

100% Statements 4/4
100% Branches 6/6
100% Functions 2/2
100% Lines 4/4

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15                1x 4x 4x 4x      
import { ActivatedRouteSnapshot, ResolveFn } from '@angular/router';
import { ArticleVersion } from '@drevo-web/shared';
 
/**
 * Factory for creating tab title resolvers.
 * Reads article data from parent route's resolved data to build a composite title.
 * Parent resolvers are guaranteed to complete before child resolvers run.
 */
export function createArticleTabTitleResolver(tabName: string): ResolveFn<string> {
    return (route: ActivatedRouteSnapshot) => {
        const article = route.parent?.data['article'] as ArticleVersion | undefined;
        return article ? `${tabName}: ${article.title}` : tabName;
    };
}