This repository was archived by the owner on Sep 15, 2021. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Expand file tree Collapse file tree 2 files changed +52
-0
lines changed Original file line number Diff line number Diff line change 1+ ngCordovaMocks . factory ( '$cordovaBrightness' , [ '$q' , function ( $q ) {
2+ var currentBrightness = 100 ;
3+
4+ return {
5+ get : function ( ) {
6+ var q = $q . defer ( ) ;
7+ q . resolve ( currentBrightness ) ;
8+ return q . promise ;
9+ } ,
10+
11+ set : function ( data ) {
12+ var q = $q . defer ( ) ;
13+ currentBrightness = data ;
14+ q . resolve ( 'OK' ) ;
15+ return q . promise ;
16+ } ,
17+
18+ setKeepScreenOn : function ( bool ) {
19+ var q = $q . defer ( ) ;
20+ q . resolve ( 'OK' ) ;
21+ return q . promise ;
22+ }
23+ } ;
24+ } ] ) ;
Original file line number Diff line number Diff line change 1+ describe ( 'ngCordovaMocks' , function ( ) {
2+ beforeEach ( function ( ) {
3+ module ( 'ngCordovaMocks' ) ;
4+ } ) ;
5+
6+ describe ( 'cordovaBrightness' , function ( ) {
7+ var $cordovaBrightness = null ;
8+
9+ beforeEach ( inject ( function ( _$cordovaBrightness_ ) {
10+ $cordovaBrightness = _$cordovaBrightness_ ;
11+ } ) ) ;
12+
13+ it ( 'should get the current brightness' , function ( ) {
14+ $cordovaBrightness . get ( ) . then ( function ( result ) {
15+ expect ( result . value ) . toEqual ( 100 ) ;
16+ } ) ;
17+ } ) ;
18+
19+ it ( 'should set the current brightness' , function ( ) {
20+ $cordovaBrightness . set ( 50 ) ;
21+
22+ var currentBrightness = $cordovaBrightness . get ( ) ;
23+ $cordovaBrightness . get ( ) . then ( function ( result ) {
24+ expect ( result . value ) . toEqual ( 50 ) ;
25+ } ) ;
26+ } ) ;
27+ } ) ;
28+ } )
You can’t perform that action at this time.
0 commit comments