|
22 | 22 | }
|
23 | 23 |
|
24 | 24 | describe('loader', function() {
|
25 |
| - it('should have default opts for WebLoader', function() { |
26 |
| - var webLoader = new WebLoader(templatesPath); |
27 |
| - expect(webLoader).to.be.a(WebLoader); |
28 |
| - expect(webLoader.useCache).to.be(false); |
29 |
| - expect(webLoader.async).to.be(false); |
30 |
| - }); |
31 |
| - |
32 |
| - if (typeof FileSystemLoader !== 'undefined') { |
33 |
| - it('should have default opts for FileSystemLoader', function() { |
34 |
| - var fileSystemLoader = new FileSystemLoader(templatesPath); |
35 |
| - expect(fileSystemLoader).to.be.a(FileSystemLoader); |
36 |
| - expect(fileSystemLoader.noCache).to.be(false); |
37 |
| - }); |
38 |
| - } |
39 |
| - |
40 | 25 | it('should allow a simple loader to be created', function() {
|
41 | 26 | // From Docs: http://mozilla.github.io/nunjucks/api.html#writing-a-loader
|
42 | 27 | // We should be able to create a loader that only exposes getSource
|
|
82 | 67 | done();
|
83 | 68 | });
|
84 | 69 | });
|
| 70 | + |
| 71 | + describe('WebLoader', function() { |
| 72 | + it('should have default opts for WebLoader', function() { |
| 73 | + var webLoader = new WebLoader(templatesPath); |
| 74 | + expect(webLoader).to.be.a(WebLoader); |
| 75 | + expect(webLoader.useCache).to.be(false); |
| 76 | + expect(webLoader.async).to.be(false); |
| 77 | + }); |
| 78 | + |
| 79 | + it('should emit a "load" event', function(done) { |
| 80 | + var loader = new WebLoader(templatesPath); |
| 81 | + |
| 82 | + if (typeof window === 'undefined') { |
| 83 | + this.skip(); |
| 84 | + } |
| 85 | + |
| 86 | + loader.on('load', function(name, source) { |
| 87 | + expect(name).to.equal('simple-base.njk'); |
| 88 | + done(); |
| 89 | + }); |
| 90 | + |
| 91 | + loader.getSource('simple-base.njk'); |
| 92 | + }); |
| 93 | + }); |
| 94 | + |
| 95 | + if (typeof FileSystemLoader !== 'undefined') { |
| 96 | + describe('FileSystemLoader', function() { |
| 97 | + it('should have default opts', function() { |
| 98 | + var loader = new FileSystemLoader(templatesPath); |
| 99 | + expect(loader).to.be.a(FileSystemLoader); |
| 100 | + expect(loader.noCache).to.be(false); |
| 101 | + }); |
| 102 | + |
| 103 | + it('should emit a "load" event', function(done) { |
| 104 | + var loader = new FileSystemLoader(templatesPath); |
| 105 | + loader.on('load', function(name, source) { |
| 106 | + expect(name).to.equal('simple-base.njk'); |
| 107 | + done(); |
| 108 | + }); |
| 109 | + |
| 110 | + loader.getSource('simple-base.njk'); |
| 111 | + }); |
| 112 | + }); |
| 113 | + } |
85 | 114 | });
|
86 | 115 | }());
|
0 commit comments