@@ -5,7 +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" ;
8+ import { By } from ' @angular/platform-browser' ;
99
1010@Component ( {
1111 selector : 'test-wizard' ,
@@ -63,30 +63,96 @@ describe('WizardComponent', () => {
6363 expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard' ) ) ) . toBeTruthy ( ) ;
6464 } ) ;
6565
66- it ( 'should contain navigation bar at the correct position' , ( ) => {
66+ it ( 'should contain navigation bar at the correct position in default navBarLocation mode' , ( ) => {
67+ const navBar = wizardTestFixture . debugElement . query ( By . css ( 'wizard-navigation-bar' ) ) ;
68+ const wizard = wizardTestFixture . debugElement . query ( By . css ( 'wizard' ) ) ;
69+ const wizardStepsDiv = wizardTestFixture . debugElement . query ( By . css ( 'div.wizard-steps' ) ) ;
70+
6771 // check default: the navbar should be at the top of the wizard if no navBarLocation was set
68- expect ( wizardTestFixture . debugElement . query ( By . css ( "wizard-navigation-bar" ) ) ) . toBeTruthy ( ) ;
69- expect ( wizardTestFixture . debugElement . query ( By . css ( "wizard" ) ) . children . length ) . toBe ( 2 ) ;
70- expect ( wizardTestFixture . debugElement . query ( By . css ( "wizard > :first-child" ) ) . name ) . toBe ( 'wizard-navigation-bar' ) ;
71- expect ( wizardTestFixture . debugElement . query ( By . css ( "wizard > :last-child" ) ) . name ) . toBe ( 'div' ) ;
72+ expect ( navBar ) . toBeTruthy ( ) ;
73+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard' ) ) . children . length ) . toBe ( 2 ) ;
74+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard > :first-child' ) ) . name ) . toBe ( 'wizard-navigation-bar' ) ;
75+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard > :last-child' ) ) . name ) . toBe ( 'div' ) ;
76+
77+ expect ( navBar . classes ) . toEqual ( { 'horizontal' : true , 'vertical' : false } ) ;
78+ expect ( wizard . classes ) . toEqual ( { 'horizontal' : true , 'vertical' : false } ) ;
79+ expect ( wizardStepsDiv . classes ) . toEqual ( { 'wizard-steps' : true , 'horizontal' : true , 'vertical' : false } ) ;
80+ } ) ;
7281
73- wizardTest . wizard . navBarLocation = "bottom" ;
82+ it ( 'should contain navigation bar at the correct position in top navBarLocation mode' , ( ) => {
83+ wizardTest . wizard . navBarLocation = 'top' ;
7484 wizardTestFixture . detectChanges ( ) ;
7585
76- // navBar should be at the bottom of the wizard
77- expect ( wizardTestFixture . debugElement . query ( By . css ( "wizard-navigation-bar" ) ) ) . toBeTruthy ( ) ;
78- expect ( wizardTestFixture . debugElement . query ( By . css ( "wizard" ) ) . children . length ) . toBe ( 2 ) ;
79- expect ( wizardTestFixture . debugElement . query ( By . css ( "wizard > :first-child" ) ) . name ) . toBe ( 'div' ) ;
80- expect ( wizardTestFixture . debugElement . query ( By . css ( "wizard > :last-child" ) ) . name ) . toBe ( 'wizard-navigation-bar' ) ;
86+ const navBar = wizardTestFixture . debugElement . query ( By . css ( 'wizard-navigation-bar' ) ) ;
87+ const wizard = wizardTestFixture . debugElement . query ( By . css ( 'wizard' ) ) ;
88+ const wizardStepsDiv = wizardTestFixture . debugElement . query ( By . css ( 'div.wizard-steps' ) ) ;
89+
90+ // check default: the navbar should be at the top of the wizard if no navBarLocation was set
91+ expect ( navBar ) . toBeTruthy ( ) ;
92+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard' ) ) . children . length ) . toBe ( 2 ) ;
93+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard > :first-child' ) ) . name ) . toBe ( 'wizard-navigation-bar' ) ;
94+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard > :last-child' ) ) . name ) . toBe ( 'div' ) ;
95+
96+ expect ( navBar . classes ) . toEqual ( { 'horizontal' : true , 'vertical' : false } ) ;
97+ expect ( wizard . classes ) . toEqual ( { 'horizontal' : true , 'vertical' : false } ) ;
98+ expect ( wizardStepsDiv . classes ) . toEqual ( { 'wizard-steps' : true , 'horizontal' : true , 'vertical' : false } ) ;
99+ } ) ;
81100
82- wizardTest . wizard . navBarLocation = "top" ;
101+ it ( 'should contain navigation bar at the correct position in left navBarLocation mode' , ( ) => {
102+ wizardTest . wizard . navBarLocation = 'left' ;
83103 wizardTestFixture . detectChanges ( ) ;
84104
85- // navBar should be at the top of the wizard
86- expect ( wizardTestFixture . debugElement . query ( By . css ( "wizard-navigation-bar" ) ) ) . toBeTruthy ( ) ;
87- expect ( wizardTestFixture . debugElement . query ( By . css ( "wizard" ) ) . children . length ) . toBe ( 2 ) ;
88- expect ( wizardTestFixture . debugElement . query ( By . css ( "wizard > :first-child" ) ) . name ) . toBe ( 'wizard-navigation-bar' ) ;
89- expect ( wizardTestFixture . debugElement . query ( By . css ( "wizard > :last-child" ) ) . name ) . toBe ( 'div' ) ;
105+ const navBar = wizardTestFixture . debugElement . query ( By . css ( 'wizard-navigation-bar' ) ) ;
106+ const wizard = wizardTestFixture . debugElement . query ( By . css ( 'wizard' ) ) ;
107+ const wizardStepsDiv = wizardTestFixture . debugElement . query ( By . css ( 'div.wizard-steps' ) ) ;
108+
109+ // check default: the navbar should be at the top of the wizard if no navBarLocation was set
110+ expect ( navBar ) . toBeTruthy ( ) ;
111+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard' ) ) . children . length ) . toBe ( 2 ) ;
112+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard > :first-child' ) ) . name ) . toBe ( 'wizard-navigation-bar' ) ;
113+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard > :last-child' ) ) . name ) . toBe ( 'div' ) ;
114+
115+ expect ( navBar . classes ) . toEqual ( { 'horizontal' : false , 'vertical' : true } ) ;
116+ expect ( wizard . classes ) . toEqual ( { 'horizontal' : false , 'vertical' : true } ) ;
117+ expect ( wizardStepsDiv . classes ) . toEqual ( { 'wizard-steps' : true , 'horizontal' : false , 'vertical' : true } ) ;
118+ } ) ;
119+
120+ it ( 'should contain navigation bar at the correct position in bottom navBarLocation mode' , ( ) => {
121+ wizardTest . wizard . navBarLocation = 'bottom' ;
122+ wizardTestFixture . detectChanges ( ) ;
123+
124+ const navBar = wizardTestFixture . debugElement . query ( By . css ( 'wizard-navigation-bar' ) ) ;
125+ const wizard = wizardTestFixture . debugElement . query ( By . css ( 'wizard' ) ) ;
126+ const wizardStepsDiv = wizardTestFixture . debugElement . query ( By . css ( 'div.wizard-steps' ) ) ;
127+
128+ // check default: the navbar should be at the top of the wizard if no navBarLocation was set
129+ expect ( navBar ) . toBeTruthy ( ) ;
130+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard' ) ) . children . length ) . toBe ( 2 ) ;
131+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard > :first-child' ) ) . name ) . toBe ( 'div' ) ;
132+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard > :last-child' ) ) . name ) . toBe ( 'wizard-navigation-bar' ) ;
133+
134+ expect ( navBar . classes ) . toEqual ( { 'horizontal' : true , 'vertical' : false } ) ;
135+ expect ( wizard . classes ) . toEqual ( { 'horizontal' : true , 'vertical' : false } ) ;
136+ expect ( wizardStepsDiv . classes ) . toEqual ( { 'wizard-steps' : true , 'horizontal' : true , 'vertical' : false } ) ;
137+ } ) ;
138+
139+ it ( 'should contain navigation bar at the correct position in right navBarLocation mode' , ( ) => {
140+ wizardTest . wizard . navBarLocation = 'right' ;
141+ wizardTestFixture . detectChanges ( ) ;
142+
143+ const navBar = wizardTestFixture . debugElement . query ( By . css ( 'wizard-navigation-bar' ) ) ;
144+ const wizard = wizardTestFixture . debugElement . query ( By . css ( 'wizard' ) ) ;
145+ const wizardStepsDiv = wizardTestFixture . debugElement . query ( By . css ( 'div.wizard-steps' ) ) ;
146+
147+ // check default: the navbar should be at the top of the wizard if no navBarLocation was set
148+ expect ( navBar ) . toBeTruthy ( ) ;
149+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard' ) ) . children . length ) . toBe ( 2 ) ;
150+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard > :first-child' ) ) . name ) . toBe ( 'div' ) ;
151+ expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard > :last-child' ) ) . name ) . toBe ( 'wizard-navigation-bar' ) ;
152+
153+ expect ( navBar . classes ) . toEqual ( { 'horizontal' : false , 'vertical' : true } ) ;
154+ expect ( wizard . classes ) . toEqual ( { 'horizontal' : false , 'vertical' : true } ) ;
155+ expect ( wizardStepsDiv . classes ) . toEqual ( { 'wizard-steps' : true , 'horizontal' : false , 'vertical' : true } ) ;
90156 } ) ;
91157
92158 it ( 'should have steps' , ( ) => {
0 commit comments