mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-02-10 10:57:49 +00:00
Update vendors, builds, and docs.
Former-commit-id: 8e6ca9a1334c73671aba1b4c974d738dbd7d72e1
This commit is contained in:
24
vendor/backbone/test/events.js
vendored
24
vendor/backbone/test/events.js
vendored
@@ -86,6 +86,30 @@ $(document).ready(function() {
|
||||
b.trigger('change');
|
||||
});
|
||||
|
||||
test("listenTo with context", 1, function() {
|
||||
var a = _.extend({}, Backbone.Events);
|
||||
var ctx = {};
|
||||
a.listenTo(a, 'foo', function(){ equal(this, ctx); }, ctx);
|
||||
a.trigger('foo');
|
||||
});
|
||||
|
||||
test("stopListening with context", 2, function() {
|
||||
var a = _.extend({}, Backbone.Events);
|
||||
var ctx = {};
|
||||
var calledWithContext = false;
|
||||
var calledWithoutContext = false;
|
||||
|
||||
a.listenTo(a, 'foo', function(){ calledWithContext = true; }, ctx);
|
||||
a.listenTo(a, 'foo', function(){ calledWithoutContext = true; });
|
||||
|
||||
a.stopListening(a, 'foo', null, ctx);
|
||||
|
||||
a.trigger('foo');
|
||||
|
||||
equal(false, calledWithContext);
|
||||
equal(true, calledWithoutContext);
|
||||
});
|
||||
|
||||
test("trigger all for each event", 3, function() {
|
||||
var a, b, obj = { counter: 0 };
|
||||
_.extend(obj, Backbone.Events);
|
||||
|
||||
Reference in New Issue
Block a user