OLD | NEW |
(Empty) | |
| 1 describe('Confirm our polyfill of Object Observe works.', |
| 2 function() { |
| 3 beforeEach(function() { }); |
| 4 afterEach(function() { }); |
| 5 |
| 6 function testSimpleOO() { |
| 7 // Let's say we have a model with data |
| 8 var model = {}; |
| 9 |
| 10 var observations = []; |
| 11 |
| 12 var observer = new ObjectObserver(model); |
| 13 // Which we then observe |
| 14 observer.open(function(added, removed, changed, getOldValueFn){ |
| 15 Object.keys(added).forEach(function(change) { |
| 16 observations.push(change); |
| 17 }); |
| 18 }); |
| 19 model["foo"] = "bar"; |
| 20 assert.equal(0, observations.length, "Observations should have been added.
") |
| 21 |
| 22 Platform.performMicrotaskCheckpoint() |
| 23 |
| 24 assert.equal(1, observations.length, "Observations should have been added.
") |
| 25 } |
| 26 |
| 27 |
| 28 it('should be able to use ObjectObserver', function() { |
| 29 testSimpleOO(); |
| 30 }); |
| 31 } |
| 32 ); |
OLD | NEW |