template.js 883 B

12345678910111213141516171819202122
  1. casper.test.begin('Templates and Partials', 7, function (test) {
  2. casper
  3. .start('./fixtures/template.html')
  4. .then(function () {
  5. test.assertSelectorHasText('#usa', 'Hi dude', 'global partial')
  6. test.assertSelectorHasText('#japan', 'こんにちは', 'local partial')
  7. test.assertSelectorHasText('#china', '你好', 'direct option')
  8. test.assertSelectorHasText('#hawaii', 'Aloha', 'extend option')
  9. test.assertSelectorHasText('#repeat', 'Repeat', 'inline partial with repeat')
  10. test.assertEvalEquals(function () {
  11. return document.querySelector('#content').textContent
  12. .replace(/\n/g, ' ')
  13. .replace(/\s+/g, ' ')
  14. }, ' before A B rest rest after ')
  15. test.assertSelectorHasText('#fallback', 'This is fallback')
  16. })
  17. .run(function () {
  18. test.done()
  19. })
  20. })