@@ -65,35 +65,28 @@ describe('Controller: MainCtrl', function() {
65
65
expect ( scope . sections ) . to . eql ( json . sections ) ;
66
66
} ) ;
67
67
68
- describe ( 'getting markup visibility state from localstorage' , function ( ) {
69
- it ( 'should return true with true values' , function ( ) {
70
- sinon . stub ( localstorage , 'get' ) . returns ( true ) ;
71
- scope . checkIfMarkupVisible ( ) ;
72
- expect ( scope . showAllMarkup ) . to . eql ( true ) ;
73
- } ) ;
68
+ it ( 'should have markup shown by default' , function ( ) {
69
+ expect ( scope . markup . isVisible ) . to . eql ( true ) ;
70
+ } ) ;
74
71
75
- it ( 'should return true by default' , function ( ) {
76
- sinon . stub ( localstorage , 'get' ) ;
77
- scope . checkIfMarkupVisible ( ) ;
78
- expect ( scope . showAllMarkup ) . to . eql ( true ) ;
79
- } ) ;
72
+ it ( 'should change markup visibility when toggling state' , function ( ) {
73
+ scope . toggleMarkup ( ) ;
74
+ expect ( scope . markup . isVisible ) . to . eql ( false ) ;
75
+ } ) ;
80
76
81
- it ( 'should return false with false string value ' , function ( ) {
82
- sinon . stub ( localstorage , 'get' ) . returns ( 'false' ) ;
83
- scope . checkIfMarkupVisible ( ) ;
84
- expect ( scope . showAllMarkup ) . to . eql ( false ) ;
85
- } ) ;
77
+ it ( 'should persist new state when toggling state ' , function ( ) {
78
+ scope . toggleMarkup ( ) ;
79
+ scope . $digest ( ) ;
80
+ expect ( localstorage . get ( 'markup' ) . isVisible ) . to . eql ( false ) ;
81
+ } ) ;
86
82
87
- it ( 'should return false with false boolean value' , function ( ) {
88
- sinon . stub ( localstorage , 'get' ) . returns ( false ) ;
89
- scope . checkIfMarkupVisible ( ) ;
90
- expect ( scope . showAllMarkup ) . to . eql ( false ) ;
91
- } ) ;
83
+ it ( 'should hide designer tool by default' , function ( ) {
84
+ expect ( scope . designerTool . isVisible ) . to . eql ( false ) ;
85
+ } ) ;
92
86
93
- it ( 'should return true with unknown values' , function ( ) {
94
- sinon . stub ( localstorage , 'get' ) . returns ( 'foobar' ) ;
95
- scope . checkIfMarkupVisible ( ) ;
96
- expect ( scope . showAllMarkup ) . to . eql ( true ) ;
97
- } ) ;
87
+ it ( 'should persist new state when designer tool visibility is changed' , function ( ) {
88
+ scope . designerTool . isVisible = true ;
89
+ scope . $digest ( ) ;
90
+ expect ( localstorage . get ( 'designerTool' ) . isVisible ) . to . eql ( true ) ;
98
91
} ) ;
99
92
} ) ;
0 commit comments