I'd like to test the binding of a durandal view to it's viewmodel; to ensure that the property names on the view and viewmodel are in sync.
Ideally using the durandal composition engine in order to include any plugins that are enabled (mainly observable).
Is there any examples available? (I can't find anything) Is there a more durandal way than just getting the view and calling ko.applyBindings?
Update:
This is what I currently am doing, binding errors are throw for mismatches, then I can use the bound view to test expected elements.
beforeEach(function(done) {
var me = this;
require(['durandal/viewLocator', 'knockout', 'durandal/binder', 'viewmodels/category', "underscore"], function(viewLocator, ko, binder, vm, _){
me._ = _;
binder.throwOnErrors = true;
viewLocator.locateView('views/category').then(function(view){
me.view = view;
me.viewModel = vm;
me.viewModel.categories = [
{id:1, name:"Test 1",enabled:true},
{id:2, name:"Test 2",enabled:false}
];
ko.cleanNode(me.view);
//This will throw if any name mismatches the viewmodel
binder.bind(vm, view);
done();
});
});
});