Reputation: 447
Project setup:
Server: Rails & Haml
Testing: Capybara - Cucumber - Poltergeist - PhantomJS
Client side: Ember.js
There is a page that uses only one component of Ember (without loading full-stack of route-controller-model) and for some reason, script tag with the template for this component is not rendered on the page, in tests only.
Component works well on page if tested manually, no errors or warnings displayed. If type is differ from 'text/x-handlebars' it will be rendered. There is no such problem for other Ember pages.
Sample markup:
_form.html.haml
=render 'ember/templates/components/foo_bar'
.row
.span12
<form markup>
ember/templates/components/foo_bar.html.haml
%script{type: 'text/x-handlebars', data:{'template-name' => 'components/foo-bar'}}
.input-append
<template markup>
How can I render this template on page?
Upvotes: 1
Views: 307
Reputation: 447
Just a workaround rather than a solution, but worked for me:
Haml replaced with handelbars (.hbs) template
Template moved to 'templates' folder
'templates' folder added to application.js manifest
Ember-rails do the rest - compile & include handlebars code into page
Upvotes: 1
Reputation: 17949
Just add 'js: true'
it 'tests the script on presence', js: true do
. . .
end
Upvotes: 0