Skip to content

Instantly share code, notes, and snippets.

@nicoespeon
Created March 23, 2016 23:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicoespeon/6fc4dedcd5ada419d026 to your computer and use it in GitHub Desktop.
Save nicoespeon/6fc4dedcd5ada419d026 to your computer and use it in GitHub Desktop.
Blog - Testing Marionette.js Behaviors - behavior test factory
function addOnClickTests ( context ) {
let model, view;
beforeEach( () => {
model = new context.ModelClass();
view = new context.ViewClass( { model: model } );
} );
it( "should increase the model size by 1 when we click on the view", () => {
model.set( "size", 1 );
view.$el.trigger( "click" );
expect( model.get( "size" ) ).toBe( 2 );
} );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment