1+ describe ( 'wizard' , function ( ) {
2+
3+ beforeEach ( module ( 'angularify.semantic.wizard' ) ) ;
4+
5+ describe ( 'controller' , function ( ) {
6+ var controller ,
7+ scope ;
8+
9+ beforeEach ( inject ( function ( $controller , $rootScope ) {
10+ scope = $rootScope . $new ( ) ;
11+ controller = $controller ( 'WizardController' , { $scope : scope } ) ;
12+ } ) ) ;
13+
14+ describe ( 'with 2 steps' , function ( ) {
15+ it ( "should contain 2 steps" , function ( ) {
16+ controller . addStep ( { title : 'step1' } ) ;
17+ controller . addStep ( { title : 'step2' } ) ;
18+ expect ( scope . steps . length ) . toBe ( 2 ) ;
19+ } ) ;
20+ } ) ;
21+ } ) ;
22+
23+ describe ( 'directive (wizard)' , function ( ) {
24+ var controller ,
25+ scope ,
26+ elm ;
27+
28+ beforeEach ( inject ( function ( $rootScope , $compile ) {
29+ scope = $rootScope ;
30+ elm = angular . element ( '<wizard fullwidth="true">' +
31+ '<wizard-pane title="Step1"><h1>Step 1</h1></wizard-pane>' +
32+ '<wizard-pane title="Step2"><h1>Step 2</h1></wizard-pane>' +
33+ '<wizard-pane title="Step3"><h1>Step 3</h1></wizard-pane>' +
34+ '</wizard>' ) ;
35+ $compile ( elm ) ( scope ) ;
36+ scope . $digest ( ) ;
37+ } ) ) ;
38+
39+ it ( 'should create a .steps div' , function ( ) {
40+ expect ( elm . find ( '.steps' ) . length ) . toBe ( 1 ) ;
41+ } ) ;
42+
43+ it ( 'should create a have class `three`' , function ( ) {
44+ expect ( elm . find ( '.steps' ) . hasClass ( 'three' ) ) . toBeTruthy ( ) ;
45+ } ) ;
46+
47+ it ( 'should contain 3 wizard pane' , function ( ) {
48+ expect ( elm . find ( '.ui.segment' ) . length ) . toBe ( 3 ) ;
49+ } ) ;
50+ } ) ;
51+
52+ describe ( 'directive (wizard-pane)' , function ( ) {
53+ var controller ,
54+ scope ,
55+ elm ,
56+ subElm ;
57+
58+ beforeEach ( inject ( function ( $rootScope , $compile ) {
59+ scope = $rootScope ;
60+ elm = angular . element ( '<wizard fullwidth="true"></wizard>' ) ;
61+ subElm = angular . element ( '<wizard-pane title="Step1"><h1>Step 1</h1></wizard-pane>' ) ;
62+
63+ elm . append ( subElm ) ;
64+
65+ $compile ( elm ) ( scope ) ;
66+ scope . $digest ( ) ;
67+ } ) ) ;
68+
69+
70+ it ( 'should contain a h1' , function ( ) {
71+ expect ( elm . find ( 'h1' ) . length ) . toBe ( 1 ) ;
72+ } ) ;
73+ } ) ;
74+ } ) ;
0 commit comments