Changeset 7151
- Timestamp:
- 05/13/08 14:36:55 (5 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
sandbox/vector-behavior/tests/Protocol/WFS/v1_0_0.html
r7143 r7151 105 105 //TODO: Add more commit tests 106 106 function test_Protocol_WFS_v1_0_0_commit(t){ 107 t.plan( 2);107 t.plan(6); 108 108 109 109 var protocol = new OpenLayers.Protocol.WFS.v1_0_0({ … … 119 119 } 120 120 121 122 var test_feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(42, 7), {has : "cheeseburger"}); 123 test_feature.layer = { 124 projection: { 125 getCode : function(){ 126 return "EPSG:4326"; 121 var featureFactory = function(attribute, id){ 122 var feature = new OpenLayers.Feature.Vector(new OpenLayers.Geometry.Point(42, 7), {has : attribute}); 123 124 feature.layer = { 125 projection: { 126 getCode : function(){ 127 return "EPSG:4326"; 128 } 127 129 } 128 130 } 131 132 feature.fid = "fid." + id; 133 134 return feature; 129 135 } 130 test_feature.fid = "fid.7" 136 137 var test_feature1 = featureFactory("cheeseburger",7); 131 138 132 139 133 var request = protocol.commit([test_feature ]);140 var request = protocol.commit([test_feature1]); 134 141 135 142 var xml = new OpenLayers.Format.XML(); 136 143 var xData = xml.read(request.data).firstChild; 137 144 145 146 // Basic tests 138 147 t.eq(request.url, "http://sigma.openplans.org/geoserver/wfs", "Request url is correct.") 139 148 t.eq(xData.nodeName, "wfs:Transaction", "Node name of commit request data is appropriate") 140 149 150 151 //testing getMethod 152 test_feature1.state = OpenLayers.State.INSERT; 153 154 var test_feature2 = featureFactory("lolcat", 8); 155 test_feature2.state = OpenLayers.State.UPDATE; 156 157 158 159 var test_feature3 = featureFactory("asdf", 9); 160 test_feature3.state = OpenLayers.State.DELETE; 161 162 var request = protocol.commit([test_feature1, test_feature2, test_feature3]); 163 164 var xData = xml.read(request.data).firstChild; 165 166 t.eq(xData.textContent,"42,7cheeseburgerthe_geom42,7haslolcat","Data's text content is as expected"); 167 t.eq(xData.childNodes[0].nodeName,"wfs:Insert","has Insert node"); 168 t.eq(xData.childNodes[1].nodeName,"wfs:Update","has Update node"); 169 t.eq(xData.childNodes[2].nodeName,"wfs:Delete","had Delete node"); 141 170 142 171 OpenLayers.Request.POST = old_OpenLayers_Request_POST;
