[Pkg-javascript-commits] [dojo] 08/11: Mirrored over minor patch. refs #5357

David Prévot taffit at moszumanska.debian.org
Mon May 11 20:11:45 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to annotated tag 1.0.2
in repository dojo.

commit 38a437093b08c70b7634af21a752f3764207d284
Author: Jared Jurkiewicz <jaredj at dojotoolkit.org>
Date:   Thu Dec 13 19:06:58 2007 +0000

    Mirrored over minor patch.  refs  #5357
    
    git-svn-id: http://svn.dojotoolkit.org/src/branches/1.0/dojo/trunk@11813 560b804f-0ae3-0310-86f3-f6aa0a117693
---
 data/ItemFileWriteStore.js       |  2 +-
 tests/data/ItemFileWriteStore.js | 26 ++++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/data/ItemFileWriteStore.js b/data/ItemFileWriteStore.js
index 43336aa..b226225 100644
--- a/data/ItemFileWriteStore.js
+++ b/data/ItemFileWriteStore.js
@@ -435,7 +435,7 @@ dojo.declare("dojo.data.ItemFileWriteStore", dojo.data.ItemFileReadStore, {
 			newItem[this._storeRefPropName] = null;
 			// null out the new item, but don't change the array index so
 			// so we can keep using _arrayOfAllItems.length.
-			this._arrayOfAllItems[newItem._itemNumPropName] = null;
+			this._arrayOfAllItems[newItem[this._itemNumPropName]] = null;
 			if(newItem[this._rootItemPropName]){
 				this._removeArrayElement(this._arrayOfTopLevelItems, newItem);
 			}
diff --git a/tests/data/ItemFileWriteStore.js b/tests/data/ItemFileWriteStore.js
index f76142e..07ab19d 100644
--- a/tests/data/ItemFileWriteStore.js
+++ b/tests/data/ItemFileWriteStore.js
@@ -621,6 +621,32 @@ doh.register("tests.data.ItemFileWriteStore",
 			store.save({onComplete:onComplete, onError:onError});
 			return deferred; //Object
 		},
+		function testWriteAPI_newItem_revert(){
+			//	summary: 
+			//		Test for bug #5357.  Ensure that the revert properly nulls the identity position
+			//      for a new item after revert.
+			var args = {data: {
+				label:"name",
+				items:[
+					{name:'Ecuador', capital:'Quito'},
+					{name:'Egypt', capital:'Cairo'},
+					{name:'El Salvador', capital:'San Salvador'},
+					{name:'Equatorial Guinea', capital:'Malabo'},
+					{name:'Eritrea', capital:'Asmara'},
+					{name:'Estonia', capital:'Tallinn'},
+					{name:'Ethiopia', capital:'Addis Ababa'}
+				]
+			} }; 
+			var store = new dojo.data.ItemFileWriteStore(args);
+
+			var newCountry = store.newItem({name: "Utopia", capitol: "Perfect"});
+
+			//DO NOT ACCESS THIS WAY.  THESE ARE INTERNAL VARIABLES.  DOING THIS FOR TEST PURPOSES.
+			var itemEntryNum = newCountry[store._itemNumPropName];
+			doh.assertTrue(store._arrayOfAllItems[itemEntryNum] === newCountry);
+			store.revert();
+			doh.assertTrue(store._arrayOfAllItems[itemEntryNum] === null);
+		},
 		function testNotificationAPI_onSet(){
 			//	summary: 
 			//		Simple test of the onSet API

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/dojo.git



More information about the Pkg-javascript-commits mailing list