globals.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. var should = require('should')
  2. var polymer = require('../')
  3. describe("data", function(){
  4. describe("valid", function(){
  5. var root = __dirname + "/fixtures/globals"
  6. var poly = polymer.root(root, { "title": "Default Title" })
  7. it("should have global available by default", function(done){
  8. poly.render("index.jade", function(error, body){
  9. should.not.exist(error)
  10. should.exist(body)
  11. body.should.include("<title>Default Title</title>")
  12. done()
  13. })
  14. })
  15. it("should be able to override globals in the template vars", function(done){
  16. poly.render("about.jade", function(error, body){
  17. should.not.exist(error)
  18. should.exist(body)
  19. body.should.include("<title>About Page</title>")
  20. done()
  21. })
  22. })
  23. it("should include global in nunjucks", function(done) {
  24. poly.render("index.nunjucks", function(error, body) {
  25. should.not.exist(error)
  26. should.exist(body)
  27. body.should.include("<title>Default Title</title>")
  28. done()
  29. })
  30. })
  31. it("should provide context for custom partial tag", function(done){
  32. poly.render("partialGlobals.nunjucks", function(error, body) {
  33. should.not.exist(error)
  34. should.exist(body)
  35. body.should.include("<title>Default Title</title>")
  36. done()
  37. })
  38. })
  39. })
  40. })