@@ -5,7 +5,7 @@ import {WizardComponent} from './wizard.component';
5
5
import { WizardStepComponent } from './wizard-step.component' ;
6
6
import { WizardNavigationBarComponent } from './wizard-navigation-bar.component' ;
7
7
import { GoToStepDirective } from '../directives/go-to-step.directive' ;
8
- import { By } from " @angular/platform-browser" ;
8
+ import { By } from ' @angular/platform-browser' ;
9
9
10
10
@Component ( {
11
11
selector : 'test-wizard' ,
@@ -63,30 +63,96 @@ describe('WizardComponent', () => {
63
63
expect ( wizardTestFixture . debugElement . query ( By . css ( 'wizard' ) ) ) . toBeTruthy ( ) ;
64
64
} ) ;
65
65
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
+
67
71
// 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
+ } ) ;
72
81
73
- wizardTest . wizard . navBarLocation = "bottom" ;
82
+ it ( 'should contain navigation bar at the correct position in top navBarLocation mode' , ( ) => {
83
+ wizardTest . wizard . navBarLocation = 'top' ;
74
84
wizardTestFixture . detectChanges ( ) ;
75
85
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
+ } ) ;
81
100
82
- wizardTest . wizard . navBarLocation = "top" ;
101
+ it ( 'should contain navigation bar at the correct position in left navBarLocation mode' , ( ) => {
102
+ wizardTest . wizard . navBarLocation = 'left' ;
83
103
wizardTestFixture . detectChanges ( ) ;
84
104
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 } ) ;
90
156
} ) ;
91
157
92
158
it ( 'should have steps' , ( ) => {
0 commit comments