Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1128)

Unified Diff: perf/server/tests/oobserve.js

Issue 380733002: Add the Polymer object observe library and add a test that it works. (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « perf/server/res/js/logic.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+ });
+ }
+);
« no previous file with comments | « perf/server/res/js/logic.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698