| Index: perf/server/tests/oobserve.js
|
| diff --git a/perf/server/tests/oobserve.js b/perf/server/tests/oobserve.js
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..70cb605b2273ccc8f37352d98bb6eb579ffe8aeb
|
| --- /dev/null
|
| +++ b/perf/server/tests/oobserve.js
|
| @@ -0,0 +1,32 @@
|
| +describe('Confirm our polyfill of Object Observe works.',
|
| + function() {
|
| + beforeEach(function() { });
|
| + afterEach(function() { });
|
| +
|
| + function testSimpleOO() {
|
| + // Let's say we have a model with data
|
| + var model = {};
|
| +
|
| + var observations = [];
|
| +
|
| + var observer = new ObjectObserver(model);
|
| + // Which we then observe
|
| + observer.open(function(added, removed, changed, getOldValueFn){
|
| + Object.keys(added).forEach(function(change) {
|
| + observations.push(change);
|
| + });
|
| + });
|
| + model["foo"] = "bar";
|
| + assert.equal(0, observations.length, "Observations should have been added.")
|
| +
|
| + Platform.performMicrotaskCheckpoint()
|
| +
|
| + assert.equal(1, observations.length, "Observations should have been added.")
|
| + }
|
| +
|
| +
|
| + it('should be able to use ObjectObserver', function() {
|
| + testSimpleOO();
|
| + });
|
| + }
|
| +);
|
|
|