相关疑难解决方法(0)

什么样的单元测试解决方案在Ember.js的路线?

我正在寻找在Ember.js应用程序中对路线进行单元测试的最佳解决方案.我找到了两个解决方案,我希望你能告诉我什么对你最好.这两个实现可以在这里找到:http://jsbin.com/URaKULa/1/edit

//=====================================
// Source :
//=====================================

App = Em.Application.create({
});

App.UserEditRoute = Ember.Route.extend({
    model: function () {
        // here we tell the route to use its parent model 
        return this.modelFor('user');
    },
    activate: function () {
        this.controllerFor('user').set('editMode', true);
    },
    deactivate: function () {
        this.controllerFor('user').set('editMode', false);
    },
    events: {
        goBack: function () {
            this.transitionTo('user');
        }
    }
});

// defer readiness and set location's router to none in order to stop main application initialization
App.setupForTesting();

//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

//=====================================
// Test : …
Run Code Online (Sandbox Code Playgroud)

javascript unit-testing ember.js

5
推荐指数
0
解决办法
988
查看次数

标签 统计

ember.js ×1

javascript ×1

unit-testing ×1