Skip to content

Commit

Permalink
Merge pull request #11496 from emberjs/fast-boot-unescaped-mustaches
Browse files Browse the repository at this point in the history
Support {{{unescapedContent}}} in FastBoot
  • Loading branch information
rwjblue committed Jun 18, 2015
2 parents 41be946 + dfbf122 commit 4b74503
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
"express": "^4.5.0",
"github": "^0.2.3",
"glob": "~4.3.2",
"htmlbars": "0.13.30",
"htmlbars": "0.13.32",
"qunit-extras": "^1.3.0",
"qunitjs": "^1.16.0",
"route-recognizer": "0.1.5",
"rsvp": "~3.0.6",
"simple-dom": "^0.2.3",
"simple-dom": "^0.2.4",
"testem": "^0.8.0-0"
}
}
45 changes: 45 additions & 0 deletions tests/node/app-boot-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ function createDOMHelper() {
return (protocol == null) ? ':' : protocol;
};

domHelper.setMorphHTML = function(morph, html) {
var section = this.document.createRawHTMLSection(html);
morph.setNode(section);
};

return domHelper;
}

Expand Down Expand Up @@ -83,6 +88,18 @@ function registerTemplates(app, templates) {
});
}

function registerControllers(app, controllers) {
app.instanceInitializer({
name: 'register-application-controllers',

initialize: function(app) {
for (var key in controllers) {
app.registry.register('controller:' + key, controllers[key]);
}
}
});
}

function renderToElement(instance) {
var element;
run(function() {
Expand Down Expand Up @@ -207,6 +224,34 @@ if (canUseInstanceInitializers && canUseApplicationVisit) {
});
});

QUnit.test("It is possible to render non-escaped content", function(assert) {
debugger;
run(function() {
app = createApplication();

app.Router.map(function() {
this.route('photos');
});

registerDOMHelper(app);
registerTemplates(app, {
application: "<h1>{{{title}}}</h1>"
});

registerControllers(app, {
application: Ember.Controller.extend({
title: "<b>Hello world</b>"
})
});
});

return app.visit('/').then(function(instance) {
var element = renderToElement(instance);

assertHTMLMatches(assert, element.firstChild, /^<div id="ember\d+" class="ember-view"><h1><b>Hello world<\/b><\/h1><\/div>$/);
});
});

QUnit.test("It is possible to render outlets in Node", function(assert) {
run(function() {
app = createApplication();
Expand Down

0 comments on commit 4b74503

Please sign in to comment.