Skip to content

Commit

Permalink
Merge pull request #11808 from martndemus/remove-deprecated-binding-o…
Browse files Browse the repository at this point in the history
…ne-way

[CLEANUP beta] Remove deprecated Binding#oneWay
  • Loading branch information
rwjblue committed Jul 18, 2015
2 parents 896c9cd + 275dad7 commit 8560990
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,20 +171,14 @@ QUnit.test('should update bound values after view\'s parent is removed and then
});

QUnit.test('should accept bindings as a string or an Ember.Binding', function() {
var ViewWithBindings;

expectDeprecation(function() {
ViewWithBindings = EmberView.extend({
oneWayBindingTestBinding: Binding.oneWay('context.direction'),
twoWayBindingTestBinding: Binding.from('context.direction'),
stringBindingTestBinding: 'context.direction',
template: compile(
'one way: {{view.oneWayBindingTest}}, ' +
'two way: {{view.twoWayBindingTest}}, ' +
'string: {{view.stringBindingTest}}'
)
});
}, 'Ember.oneWay has been deprecated. Please use Ember.computed.oneWay instead.');
var ViewWithBindings = EmberView.extend({
twoWayBindingTestBinding: Binding.from('context.direction'),
stringBindingTestBinding: 'context.direction',
template: compile(
'two way: {{view.twoWayBindingTest}}, ' +
'string: {{view.stringBindingTest}}'
)
});

view = EmberView.create({
viewWithBindingsClass: ViewWithBindings,
Expand All @@ -196,5 +190,5 @@ QUnit.test('should accept bindings as a string or an Ember.Binding', function()

runAppend(view);

equal(trim(view.$().text()), 'one way: down, two way: down, string: down');
equal(trim(view.$().text()), 'two way: down, string: down');
});
25 changes: 0 additions & 25 deletions packages/ember-metal/lib/binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,32 +313,7 @@ mixinProperties(Binding, {
to(to) {
var C = this;
return new C(to, undefined);
},

/**
Creates a new Binding instance and makes it apply in a single direction.
A one-way binding will relay changes on the `from` side object (supplied
as the `from` argument) the `to` side, but not the other way around.
This means that if you change the "to" side directly, the "from" side may have
a different value.
See `Binding.oneWay`.
@method oneWay
@param {String} from from path.
@param {Boolean} [flag] (Optional) passing nothing here will make the
binding `oneWay`. You can instead pass `false` to disable `oneWay`, making the
binding two way again.
@return {Ember.Binding} `this`
@deprecated
@public
*/
oneWay(from, flag) {
Ember.deprecate('Ember.oneWay has been deprecated. Please use Ember.computed.oneWay instead.', false);
var C = this;
return new C(undefined, from).oneWay(flag);
}

});
/**
An `Ember.Binding` connects the properties of two objects so that whenever
Expand Down

0 comments on commit 8560990

Please sign in to comment.