@@ -12,7 +12,7 @@ it("should bind this context on require callback", function(done) {
12
12
done ( ) ;
13
13
} catch ( e ) { done ( e ) ; }
14
14
} . bind ( this ) ) ;
15
- } )
15
+ } ) ;
16
16
} ) ;
17
17
18
18
it ( "should bind this context on require callback (loaded)" , function ( done ) {
@@ -25,7 +25,42 @@ it("should bind this context on require callback (loaded)", function(done) {
25
25
done ( ) ;
26
26
} catch ( e ) { done ( e ) ; }
27
27
} . bind ( this ) ) ;
28
- } )
28
+ } ) ;
29
+ } ) ;
30
+
31
+ it ( "should bind this context on require callback (foo)" , function ( done ) {
32
+ var foo = { ok : true } ;
33
+ require ( [ ] , function ( load ) {
34
+ try {
35
+ require ( "./file" ) . should . be . eql ( "file" ) ;
36
+ this . should . be . eql ( { ok : true } ) ;
37
+ done ( ) ;
38
+ } catch ( e ) { done ( e ) ; }
39
+ } . bind ( foo ) ) ;
40
+ } ) ;
41
+
42
+ it ( "should bind this context on require callback (foo, loaded)" , function ( done ) {
43
+ var foo = { ok : true } ;
44
+ require ( [ "./load.js" ] , function ( load ) {
45
+ try {
46
+ require ( "./file" ) . should . be . eql ( "file" ) ;
47
+ load . should . be . eql ( "load" ) ;
48
+ this . should . be . eql ( { ok : true } ) ;
49
+ done ( ) ;
50
+ } catch ( e ) { done ( e ) ; }
51
+ } . bind ( foo ) ) ;
52
+ } ) ;
53
+
54
+ it ( "should bind this context on require callback (foo)" , function ( done ) {
55
+ runWithThis ( { ok : true } , function ( ) {
56
+ require ( [ ] , function ( load ) {
57
+ try {
58
+ require ( "./file" ) . should . be . eql ( "file" ) ;
59
+ this . should . be . eql ( { ok : { ok : true } } ) ;
60
+ done ( ) ;
61
+ } catch ( e ) { done ( e ) ; }
62
+ } . bind ( { ok : this } ) ) ;
63
+ } ) ;
29
64
} ) ;
30
65
31
66
it ( "should bind this context on require.ensure callback" , function ( done ) {
@@ -37,7 +72,7 @@ it("should bind this context on require.ensure callback", function(done) {
37
72
done ( ) ;
38
73
} catch ( e ) { done ( e ) ; }
39
74
} . bind ( this ) ) ;
40
- } )
75
+ } ) ;
41
76
} ) ;
42
77
43
78
it ( "should bind this context on require.ensure callback (loaded)" , function ( done ) {
@@ -49,5 +84,5 @@ it("should bind this context on require.ensure callback (loaded)", function(done
49
84
done ( ) ;
50
85
} catch ( e ) { done ( e ) ; }
51
86
} . bind ( this ) ) ;
52
- } )
87
+ } ) ;
53
88
} ) ;
0 commit comments