Code coverage report for src/nav-model.js

Statements: 50% (3 / 6)      Branches: 0% (0 / 2)      Functions: 66.67% (2 / 3)      Lines: 50% (3 / 6)      Ignored: none     

All files » src/ » nav-model.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56                                                                      1 32 32                                    
/**
* Class for storing and interacting with a route's navigation settings.
*/
export class NavModel {
 
  /**
  * True if this nav item is currently active.
  */
  isActive: boolean = false;
 
  /**
  * The title.
  */
  title: string = null;
 
  /**
  * This nav item's absolute href.
  */
  href: string = null;
 
  /**
  * This nav item's relative href.
  */
  relativeHref: string = null;
 
  /**
  * Data attached to the route at configuration time.
  */
  settings: any = {};
 
  /**
  * The route config.
  */
  config: RouteConfig = null;
 
  constructor(router: Router, relativeHref: string) {
    this.router = router;
    this.relativeHref = relativeHref;
  }
 
  /**
  * Sets the route's title and updates document.title.
  *  If the a navigation is in progress, the change will be applied
  *  to document.title when the navigation completes.
  *
  * @param title The new title.
  */
  setTitle(title: string): void {
    this.title = title;
 
    if (this.isActive) {
      this.router.updateTitle();
    }
  }
}