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

Unified Diff: test/mjsunit/harmony/object-observe.js

Issue 14978007: Implement Array.observe and emit splice change records for ArrayPush (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: todo to freeze removed Created 7 years, 7 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 | « src/object-observe.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/harmony/object-observe.js
diff --git a/test/mjsunit/harmony/object-observe.js b/test/mjsunit/harmony/object-observe.js
index 8200e9084e69dbeed8fca6b2ba5bbfb468a3b589..372ffdbdb7068240dfd441dd28baba2f5209d22b 100644
--- a/test/mjsunit/harmony/object-observe.js
+++ b/test/mjsunit/harmony/object-observe.js
@@ -1068,13 +1068,22 @@ observer.assertCallbackRecords([
reset();
var array = [1, 2];
Object.observe(array, observer.callback);
+Array.observe(array, observer2.callback);
array.push(3, 4);
+array.push(5);
Object.deliverChangeRecords(observer.callback);
observer.assertCallbackRecords([
{ object: array, name: '2', type: 'new' },
{ object: array, name: 'length', type: 'updated', oldValue: 2 },
{ object: array, name: '3', type: 'new' },
{ object: array, name: 'length', type: 'updated', oldValue: 3 },
+ { object: array, name: '4', type: 'new' },
+ { object: array, name: 'length', type: 'updated', oldValue: 4 },
+]);
+Object.deliverChangeRecords(observer2.callback);
+observer2.assertCallbackRecords([
+ { object: array, type: 'splice', index: 2, removed: [], addedCount: 2 },
+ { object: array, type: 'splice', index: 4, removed: [], addedCount: 1 }
]);
// Pop
« no previous file with comments | « src/object-observe.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698