2

我正在尝试使用 Konacha 测试我的 ember.js 和 rails 应用程序。

我想加载我的 ember 应用程序并能够转换到 root.index 路由,并且应用程序应该加载到 iframe 中。

我已将其简化为这段代码,只是试图在 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') 

测试转换到正确的路线,但不显示模板。

如果我在测试中像这样手动附加应用程序视图,我只能让它显示模板

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

任何人都可以帮助解决这个问题,因为我想将我的整个应用程序启动到 iframe 中,而不仅仅是其中的一部分。

谢谢瑞克

4

0 回答 0