File size: 1,083 Bytes
5fae594
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52

describe("oboe loaded using require", function() {
     
   it('is not on the global namespace by default', function () {

      expect(window.oboe).toBe(undefined)
   })
   
   it('can be loaded using require', function () {

      var doneTest;

      require(['oboe'], function(oboe){
         expect(require('oboe')).toBeOboe()
         doneTest = true;
      });
      
      waitsFor('oboe to load using require', function(){return doneTest});

   })
   
   it('it not on global after being loaded', function () {

      var doneTest;

      require(['oboe'], function(oboe){
         expect(window.oboe).toBe(undefined)
         doneTest = true;
      });
      
      waitsFor('oboe to load using require', function(){return doneTest});

   })      
   
   beforeEach(function(){
      this.addMatchers({
         toBeOboe:function(){
         
            var potentialOboe = this.actual;
            
            return !!(  potentialOboe && 
                        potentialOboe('foo.json').node
                     );          
         }
      })
   });
   
});