diff --git a/packages/ember-metal/lib/binding.js b/packages/ember-metal/lib/binding.js index 5a38a4aa7b7..f18cf9f0faf 100644 --- a/packages/ember-metal/lib/binding.js +++ b/packages/ember-metal/lib/binding.js @@ -466,21 +466,6 @@ export function bind(obj, to, from) { return new Binding(to, from).connect(obj); } -/** - @method oneWay - @for Ember - @param {Object} obj The root object of the transform. - @param {String} to The path to the 'to' side of the binding. - Must be relative to obj. - @param {String} from The path to the 'from' side of the binding. - Must be relative to obj or a global path. - @return {Ember.Binding} binding instance - @public -*/ -export function oneWay(obj, to, from) { - return new Binding(to, from).oneWay().connect(obj); -} - export { Binding, isGlobalPath diff --git a/packages/ember-metal/lib/main.js b/packages/ember-metal/lib/main.js index dc9466af4e2..e8d7a25ed97 100644 --- a/packages/ember-metal/lib/main.js +++ b/packages/ember-metal/lib/main.js @@ -172,8 +172,7 @@ import { import { Binding, bind, - isGlobalPath, - oneWay + isGlobalPath } from 'ember-metal/binding'; import run from 'ember-metal/run_loop'; import Libraries from 'ember-metal/libraries'; @@ -309,7 +308,6 @@ Ember.immediateObserver = _immediateObserver; Ember.mixin = mixin; Ember.Mixin = Mixin; -Ember.oneWay = oneWay; Ember.bind = bind; Ember.Binding = Binding; Ember.isGlobalPath = isGlobalPath; diff --git a/packages/ember-metal/tests/binding/one_way_test.js b/packages/ember-metal/tests/binding/one_way_test.js deleted file mode 100644 index 3496c3e4517..00000000000 --- a/packages/ember-metal/tests/binding/one_way_test.js +++ /dev/null @@ -1,44 +0,0 @@ -import { set } from 'ember-metal/property_set'; -import { get } from 'ember-metal/property_get'; -import run from 'ember-metal/run_loop'; -import { oneWay } from 'ember-metal/binding'; - -var MyApp; - -QUnit.module('system/mixin/binding/oneWay_test', { - setup() { - MyApp = { - foo: { value: 'FOO' }, - bar: { value: 'BAR' } - }; - }, - - teardown() { - MyApp = null; - } -}); - -QUnit.test('oneWay(true) should only sync one way', function() { - var binding; - run(function() { - binding = oneWay(MyApp, 'bar.value', 'foo.value'); - }); - - equal(get(MyApp, 'foo.value'), 'FOO', 'foo synced'); - equal(get(MyApp, 'bar.value'), 'FOO', 'bar synced'); - - run(function() { - set(MyApp, 'bar.value', 'BAZ'); - }); - - equal(get(MyApp, 'foo.value'), 'FOO', 'foo synced'); - equal(get(MyApp, 'bar.value'), 'BAZ', 'bar not synced'); - - run(function() { - set(MyApp, 'foo.value', 'BIFF'); - }); - - equal(get(MyApp, 'foo.value'), 'BIFF', 'foo synced'); - equal(get(MyApp, 'bar.value'), 'BIFF', 'foo synced'); -}); - diff --git a/packages/ember-runtime/tests/legacy_1x/system/binding_test.js b/packages/ember-runtime/tests/legacy_1x/system/binding_test.js index 2e0c84958d6..fd83c51fb07 100644 --- a/packages/ember-runtime/tests/legacy_1x/system/binding_test.js +++ b/packages/ember-runtime/tests/legacy_1x/system/binding_test.js @@ -2,7 +2,7 @@ import Ember from 'ember-metal/core'; import {get} from 'ember-metal/property_get'; import {set} from 'ember-metal/property_set'; import run from 'ember-metal/run_loop'; -import {Binding, bind, oneWay} from 'ember-metal/binding'; +import {Binding, bind } from 'ember-metal/binding'; import {observer as emberObserver} from 'ember-metal/mixin'; import EmberObject from 'ember-runtime/system/object'; @@ -120,41 +120,6 @@ QUnit.test('binding disconnection actually works', function() { equal(get(toObject, 'value'), 'start'); }); -// .......................................................... -// one way binding -// - -QUnit.module('one way binding', { - - setup() { - run(function() { - fromObject = EmberObject.create({ value: 'start' }); - toObject = EmberObject.create({ value: 'end' }); - root = { fromObject: fromObject, toObject: toObject }; - binding = oneWay(root, 'toObject.value', 'fromObject.value'); - }); - }, - teardown() { - run.cancelTimers(); - } -}); - -QUnit.test('fromObject change should propagate after flush', function() { - run(function() { - set(fromObject, 'value', 'change'); - equal(get(toObject, 'value'), 'start'); - }); - equal(get(toObject, 'value'), 'change'); -}); - -QUnit.test('toObject change should NOT propagate', function() { - run(function() { - set(toObject, 'value', 'change'); - equal(get(fromObject, 'value'), 'start'); - }); - equal(get(fromObject, 'value'), 'start'); -}); - var first, second, third, binding1, binding2; // global variables // ..........................................................