mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-29 06:27:49 +00:00
Update vendors.
Former-commit-id: e109c9ffd436610d066493b07bd38293e1ec01a7
This commit is contained in:
4
vendor/backbone/backbone.js
vendored
4
vendor/backbone/backbone.js
vendored
@@ -367,7 +367,7 @@
|
||||
|
||||
// If we're "wait"-ing to set changed attributes, validate early.
|
||||
if (options.wait) {
|
||||
if (!this._validate(attrs, options)) return false;
|
||||
if (attrs && !this._validate(attrs, options)) return false;
|
||||
current = _.clone(this.attributes);
|
||||
}
|
||||
|
||||
@@ -1204,7 +1204,7 @@
|
||||
var delegateEventSplitter = /^(\S+)\s*(.*)$/;
|
||||
|
||||
// List of view options to be merged as properties.
|
||||
var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName'];
|
||||
var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];
|
||||
|
||||
// Set up all inheritable **Backbone.View** properties and methods.
|
||||
_.extend(View.prototype, Events, {
|
||||
|
||||
8
vendor/backbone/test/model.js
vendored
8
vendor/backbone/test/model.js
vendored
@@ -99,7 +99,7 @@ $(document).ready(function() {
|
||||
equal(model.url(), '/nested/1/collection/2');
|
||||
});
|
||||
|
||||
test("clone", 8, function() {
|
||||
test("clone", 10, function() {
|
||||
var a = new Backbone.Model({ 'foo': 1, 'bar': 2, 'baz': 3});
|
||||
var b = a.clone();
|
||||
equal(a.get('foo'), 1);
|
||||
@@ -111,6 +111,12 @@ $(document).ready(function() {
|
||||
a.set({foo : 100});
|
||||
equal(a.get('foo'), 100);
|
||||
equal(b.get('foo'), 1, "Changing a parent attribute does not change the clone.");
|
||||
|
||||
var foo = new Backbone.Model({p: 1});
|
||||
var bar = new Backbone.Model({p: 2});
|
||||
bar.set(foo.clone(), {unset: true});
|
||||
equal(foo.get('p'), 1);
|
||||
equal(bar.get('p'), undefined);
|
||||
});
|
||||
|
||||
test("isNew", 6, function() {
|
||||
|
||||
24
vendor/backbone/test/view.js
vendored
24
vendor/backbone/test/view.js
vendored
@@ -331,4 +331,28 @@ $(document).ready(function() {
|
||||
ok(view.$el.is('p:has(a)'));
|
||||
});
|
||||
|
||||
test("events passed in options", 2, function() {
|
||||
var counter = 0;
|
||||
|
||||
var View = Backbone.View.extend({
|
||||
el: '<p><a id="test"></a></p>',
|
||||
increment: function() {
|
||||
counter++;
|
||||
}
|
||||
});
|
||||
|
||||
var view = new View({events:{'click #test':'increment'}});
|
||||
var view2 = new View({events:function(){
|
||||
return {'click #test':'increment'};
|
||||
}});
|
||||
|
||||
view.$('#test').trigger('click');
|
||||
view2.$('#test').trigger('click');
|
||||
equal(counter, 2);
|
||||
|
||||
view.$('#test').trigger('click');
|
||||
view2.$('#test').trigger('click');
|
||||
equal(counter, 4);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
10
vendor/underscore/test/collections.js
vendored
10
vendor/underscore/test/collections.js
vendored
@@ -348,6 +348,11 @@ $(document).ready(function() {
|
||||
|
||||
var array = [{}];
|
||||
_.groupBy(array, function(value, index, obj){ ok(obj === array); });
|
||||
|
||||
var array = [1, 2, 1, 2, 3];
|
||||
var grouped = _.groupBy(array);
|
||||
equal(grouped['1'].length, 2);
|
||||
equal(grouped['3'].length, 1);
|
||||
});
|
||||
|
||||
test('countBy', function() {
|
||||
@@ -372,6 +377,11 @@ $(document).ready(function() {
|
||||
|
||||
var array = [{}];
|
||||
_.countBy(array, function(value, index, obj){ ok(obj === array); });
|
||||
|
||||
var array = [1, 2, 1, 2, 3];
|
||||
var grouped = _.countBy(array);
|
||||
equal(grouped['1'], 2);
|
||||
equal(grouped['3'], 1);
|
||||
});
|
||||
|
||||
test('sortedIndex', function() {
|
||||
|
||||
2
vendor/underscore/underscore-min.js
vendored
2
vendor/underscore/underscore-min.js
vendored
File diff suppressed because one or more lines are too long
2
vendor/underscore/underscore.js
vendored
2
vendor/underscore/underscore.js
vendored
@@ -316,7 +316,7 @@
|
||||
// An internal function used for aggregate "group by" operations.
|
||||
var group = function(obj, value, context, behavior) {
|
||||
var result = {};
|
||||
var iterator = lookupIterator(value);
|
||||
var iterator = lookupIterator(value || _.identity);
|
||||
each(obj, function(value, index) {
|
||||
var key = iterator.call(context, value, index, obj);
|
||||
behavior(result, key, value);
|
||||
|
||||
Reference in New Issue
Block a user