Skip to content

Instantly share code, notes, and snippets.

@tomdale
Created July 28, 2011 20:50
Show Gist options
  • Save tomdale/1112528 to your computer and use it in GitHub Desktop.
Save tomdale/1112528 to your computer and use it in GitHub Desktop.
testBoth('should fire observer that contains a path', function(get, set) {
var CarMixin = SC.Mixin.create({
acceleration: 0
});
var car = SC.mixin({}, CarMixin);
var tireAcceleration;
var TireMixin = SC.Mixin.create({
accelerationDidChange: SC.observer(function() {
tireAcceleration = get(this, 'car.acceleration');
}, 'car.acceleration')
});
var tire = SC.mixin({
car: car
}, TireMixin);
set(car, 'acceleration', 50);
equals(tireAcceleration, 50, "observer should fire");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment