inline_partial_require_test.js 502 B

12345678910111213141516171819202122
  1. var concat = require("concat-stream");
  2. var browserify = require("browserify");
  3. var assert = require("assert");
  4. var vm = require("vm");
  5. var b = browserify(__dirname + "/inlinePartialBrowsercode.js");
  6. b.transform(require("hbsfy"), { traverse: true });
  7. var context = {
  8. document: {
  9. body: {}
  10. }
  11. };
  12. b.bundle().pipe(concat(function(data) {
  13. vm.runInNewContext(data.toString(), context);
  14. }));
  15. setTimeout(function() {
  16. assert.equal(context.document.body.innerHTML.trim(), "<p>Test</p>");
  17. }, 400);