Skip to content

Commit

Permalink
added: model.destroy test
Browse files Browse the repository at this point in the history
  • Loading branch information
emaphp committed Mar 16, 2015
1 parent 92c275d commit dea4952
Show file tree
Hide file tree
Showing 7 changed files with 326 additions and 11 deletions.
5 changes: 5 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,12 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-jshint');

//copies required libraries for testing
grunt.registerTask('vendor', ['copy:jquery', 'copy:underscore', 'copy:backbone', 'copy:mocha', 'copy:chai', 'copy:promise']);

//applies jshint to project files
grunt.registerTask('test', ['jshint']);

//minifies library
grunt.registerTask('release', ['jshint', 'uglify:dist']);
};
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ var Contact = Backbone.Async.Contact.extend({
var contact = new Contact({id: 1});

//setup event listener
var object = {
var obj = {
beforeFetch: function(data) {
console.log('Contact is being fetched...');
},
Expand All @@ -163,9 +163,9 @@ var object = {
}
};

_.extend(object, Backbone.Events);
object.listenTo(contact, 'before:fetch', object.beforeFetch);
object.listenTo(contact, 'before:save', object.beforeSave);
_.extend(obj, Backbone.Events);
obj.listenTo(contact, 'before:fetch', obj.beforeFetch);
obj.listenTo(contact, 'before:save', obj.beforeSave);

//fetch contact
contact.fetch()
Expand All @@ -192,7 +192,7 @@ The *before:fetch* and *before:destroy* event handlers will receive an object co
* model: The model instance.
* options: The options provided.

The *before:save* event handler also includes an additional property named *attrs* with the attributes being saved. All *after:event* handlers receive the exact same object provided to the fulfilled and rejection callbacks plus a *success* argument.
The *before:save* event handler argument also includes an additional property named *attrs* with the attributes being saved. All *after:[event]* handlers receive the exact same object provided to the fulfilled and rejection callbacks plus a *success* argument.

<br/>
###License
Expand Down
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backbone.async",
"version": "0.3.0",
"version": "1.0.0",
"homepage": "https://github.com/emaphp/backbone.async",
"authors": [
"Emmanuel Antico <[email protected]>"
Expand Down
4 changes: 2 additions & 2 deletions dist/backbone.async.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Backbone.Async v0.3.0
* Backbone.Async v1.0.0
* Copyright 2015 Emmanuel Antico
* This library is distributed under the terms of the MIT license.
*/
Expand Down Expand Up @@ -94,7 +94,7 @@
};

var Async = Backbone.Async = Backbone.Async || {};
Async.VERSION = '0.3.0';
Async.VERSION = '1.0.0';

Async.Model = Backbone.Model.extend(
buildPrototype(Backbone.Model, ['fetch', 'save', 'destroy'])
Expand Down
2 changes: 1 addition & 1 deletion dist/backbone.async.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "backbone.async",
"version": "0.3.0",
"version": "1.0.0",
"description": "Backbone Models meet Promises",
"author": "Emmanuel Antico <[email protected]>",
"license": "MIT",
Expand Down
Loading

0 comments on commit dea4952

Please sign in to comment.