[Commits] r276 - in core/trunk/geoext: lib/GeoExt/data tests/lib/GeoExt/data
commits at geoext.org
commits at geoext.org
Wed Mar 25 22:11:13 CET 2009
Author: elemoine
Date: 2009-03-25 22:11:13 +0100 (Wed, 25 Mar 2009)
New Revision: 276
Modified:
core/trunk/geoext/lib/GeoExt/data/LayerStore.js
core/trunk/geoext/tests/lib/GeoExt/data/LayerStore.html
Log:
LayerStore can only be configured with a LayerReader, r=tschaub (closes #29)
Modified: core/trunk/geoext/lib/GeoExt/data/LayerStore.js
===================================================================
--- core/trunk/geoext/lib/GeoExt/data/LayerStore.js 2009-03-25 16:40:32 UTC (rev 275)
+++ core/trunk/geoext/lib/GeoExt/data/LayerStore.js 2009-03-25 21:11:13 UTC (rev 276)
@@ -47,7 +47,7 @@
reader: null,
/**
- * Constructor: GeoExt.LayerStore
+ * Constructor: GeoExt.data.LayerStore
*
* Parameters:
* config - {Object}
@@ -62,9 +62,10 @@
* every layer record are {OpenLayers.Layer} layer and {String} title.
*/
constructor: function(config) {
- arguments.callee.superclass.constructor.apply(this, arguments);
config = config || {};
- this.reader = new GeoExt.data.LayerReader({}, config.recordType);
+ config.reader = config.reader ||
+ new GeoExt.data.LayerReader({}, config.recordType);
+ arguments.callee.superclass.constructor.call(this, config);
var map = config.map instanceof GeoExt.MapPanel ?
config.map.map : config.map;
if(map) {
Modified: core/trunk/geoext/tests/lib/GeoExt/data/LayerStore.html
===================================================================
--- core/trunk/geoext/tests/lib/GeoExt/data/LayerStore.html 2009-03-25 16:40:32 UTC (rev 275)
+++ core/trunk/geoext/tests/lib/GeoExt/data/LayerStore.html 2009-03-25 21:11:13 UTC (rev 276)
@@ -32,6 +32,26 @@
return mapPanel;
}
+ function test_constructor(t) {
+ t.plan(3);
+
+ var store, reader, map;
+
+ store = new GeoExt.data.LayerStore();
+ t.ok(store.reader instanceof GeoExt.data.LayerReader,
+ "ctor creates a layer reader if none is provided");
+
+ reader = new Ext.data.ArrayReader();
+ store = new GeoExt.data.LayerStore({reader: reader});
+ t.ok(store.reader == reader,
+ "ctor sets the passed reader in the instance");
+
+ map = new OpenLayers.Map();
+ store = new GeoExt.data.LayerStore({map: map});
+ t.ok(store.map == map,
+ "ctor sets the passed map in the instance");
+ }
+
function test_layerstore(t) {
t.plan(6);
More information about the Commits
mailing list