1 | var should = require("should");
|
2 |
|
3 | var fs = require("fs");
|
4 | var path = require("path");
|
5 |
|
6 | var runLoader = require("./fakeModuleSystem");
|
7 | var twigLoader = require("../");
|
8 |
|
9 | var fixtures = path.join(__dirname, "fixtures");
|
10 |
|
11 | describe("embed", function() {
|
12 | it("should generate proper require embed tag", function(done) {
|
13 | var template = path.join(fixtures, "embed", "template.html.twig");
|
14 | runLoader(twigLoader, path.join(fixtures, "extend"), template, fs.readFileSync(template, "utf-8"), function(err, result) {
|
15 | if(err) throw err;
|
16 |
|
17 | result.should.have.type("string");
|
18 |
|
19 |
|
20 | result.should.match(/require\(\"embed\.html\.twig\"\);/);
|
21 |
|
22 | done();
|
23 | });
|
24 | });
|
25 |
|
26 | it("should generate proper require include tag in block tag", function(done) {
|
27 | var template = path.join(fixtures, "embed", "template.html.twig");
|
28 | runLoader(twigLoader, path.join(fixtures, "extend"), template, fs.readFileSync(template, "utf-8"), function(err, result) {
|
29 | if(err) throw err;
|
30 |
|
31 | result.should.have.type("string");
|
32 |
|
33 |
|
34 | result.should.match(/require\(\"include\.html\.twig\"\);/);
|
35 |
|
36 | done();
|
37 | });
|
38 | });
|
39 | });
|