@@ -5,6 +5,7 @@ import {WizardComponent} from './wizard.component';
55import { WizardStepComponent } from './wizard-step.component' ;
66import { WizardNavigationBarComponent } from './wizard-navigation-bar.component' ;
77import { GoToStepDirective } from '../directives/go-to-step.directive' ;
8+ import { By } from "@angular/platform-browser" ;
89
910@Component ( {
1011 selector : 'test-wizard' ,
@@ -60,6 +61,29 @@ describe('WizardComponent', () => {
6061 expect ( wizardTest ) . toBeTruthy ( ) ;
6162 } ) ;
6263
64+ it ( 'should contain navigation bar at the correct position' , ( ) => {
65+ // check default: the navbar should be at the top of the wizard if no navBarLocation was set
66+ expect ( wizardTestFixture . debugElement . query ( By . css ( ".nav-bar" ) ) ) . toBeTruthy ( ) ;
67+ expect ( wizardTestFixture . debugElement . query ( By . css ( ".wizard-centered > :first-child" ) ) . name ) . toBe ( 'wizard-navigation-bar' ) ;
68+ expect ( wizardTestFixture . debugElement . query ( By . css ( ".nav-bar.top" ) ) ) . toBeTruthy ( ) ;
69+
70+ wizardTest . wizard . navBarLocation = "bottom" ;
71+ wizardTestFixture . detectChanges ( ) ;
72+
73+ // navBar should be at the bottom of the wizard
74+ expect ( wizardTestFixture . debugElement . query ( By . css ( ".nav-bar" ) ) ) . toBeTruthy ( ) ;
75+ expect ( wizardTestFixture . debugElement . query ( By . css ( ".wizard-centered > :last-child" ) ) . name ) . toBe ( 'wizard-navigation-bar' ) ;
76+ expect ( wizardTestFixture . debugElement . query ( By . css ( ".nav-bar.bottom" ) ) ) . toBeTruthy ( ) ;
77+
78+ wizardTest . wizard . navBarLocation = "top" ;
79+ wizardTestFixture . detectChanges ( ) ;
80+
81+ // navBar should be at the top of the wizard
82+ expect ( wizardTestFixture . debugElement . query ( By . css ( ".nav-bar" ) ) ) . toBeTruthy ( ) ;
83+ expect ( wizardTestFixture . debugElement . query ( By . css ( ".wizard-centered > :first-child" ) ) . name ) . toBe ( 'wizard-navigation-bar' ) ;
84+ expect ( wizardTestFixture . debugElement . query ( By . css ( ".nav-bar.top" ) ) ) . toBeTruthy ( ) ;
85+ } ) ;
86+
6387 it ( 'should have steps' , ( ) => {
6488 expect ( wizardTest . wizard . wizardSteps . length ) . toBe ( 3 ) ;
6589 } ) ;
0 commit comments