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 +49
-0
lines changed Expand file tree Collapse file tree 2 files changed +49
-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
+ var currentBrightness = $cordovaBrightness . get ( ) ;
15
+ expect ( currentBrightness ) . toEqual ( 100 ) ;
16
+ } ) ;
17
+
18
+ it ( 'should set the current brightness' , function ( ) {
19
+ $cordovaBrightness . set ( 50 ) ;
20
+
21
+ var currentBrightness = $cordovaBrightness . get ( ) ;
22
+ expect ( currentBrightness ) . toEqual ( 50 ) ;
23
+ } ) ;
24
+ } ) ;
25
+ } )
You can’t perform that action at this time.
0 commit comments