2

I am trying to test my ember.js and rails app with Konacha.

I want to load my ember app and be able to transition to the root.index route and the app should load into the iframe.

I have stripped this down to this code and am simply trying to show the application template in the iframe.

window.App = Ember.Application.create(
  rootElement: 'body'
)

App.store = DS.Store.create(
  revision: 4
  adapter: DS.RESTAdapter.create(bulkCommit: false, namespace: "admin" )
)

App.ApplicationController = Em.Controller.extend()

App.ApplicationView = Em.View.extend
    template: Ember.Handlebars.compile('Hello Rick')

App.Router = Em.Router.extend
    location : Ember.Location.create(
        implementation : 'hash'
    )

    root: Ember.Route.extend
        index: Ember.Route.extend
            route: '/'

App.router = App.Router.create()
App.initialize(App.router)

describe "Testing Ember", ->
    it "Should show Hello Rick", ->
        Em.run ->
            App.router.transitionTo('index') 

The test transitions to the correct route but does not display the template.

I can only get it to display the template if i append the appication view manually like this in the test

App.view = App.ApplicationView.create()
App.view.append()

Can anyone help with this as i want to launch my whole app into the iframe and not just parts of it.

Thanks Rick

dax
  • 10,779
  • 8
  • 51
  • 86
Rick Moss
  • 926
  • 1
  • 17
  • 34
  • i have tried updating this to new ember router etc and setting testing to true but still the same. – Rick Moss Feb 21 '13 at 20:21
  • Have you gotten this to work? Are you setting `Ember.testing = true`? You might need to wrap `App.initialize();` inside an `Ember.run` also. – RyanJM Mar 09 '13 at 03:24
  • currently i have this working now by upgrading to lastest RC1 master and version 12 ember-data. I found that Konacha has a reset method that it calls automatically before each test that clears out the content from within the iframe so stubbing this out prevents this. Also i get an error if i wrap any of Ember.Application.create or App.initialize methods in Em.run. It seems to work without doing that so not sure if this is the way to do it or not!! anyone ? – Rick Moss Mar 11 '13 at 21:40

0 Answers0