Adding tests, and fixing an issue revealed by the tests

This commit is contained in:
ahocevar
2013-07-31 23:42:08 +02:00
parent 5acff857e7
commit 58949ed856
3 changed files with 28 additions and 6 deletions

View File

@@ -26,8 +26,30 @@ describe('ol.source.wms', function() {
});
});
describe('ol.source.wms.getFeatureInfo', function() {
it('calls a callback with a feature info IFRAME as result', function(done) {
ol.source.wms.getFeatureInfo('?REQUEST=GetMap&LAYERS=foo',
{params: {'INFO_FORMAT': 'text/plain'}},
function(info) {
expect(info).to.eql('<iframe seamless src="' +
'?REQUEST=GetFeatureInfo&LAYERS=foo&QUERY_LAYERS=foo&' +
'INFO_FORMAT=text%2Fplain"></iframe>');
done();
});
});
it('can do xhr to retrieve feature info', function(done) {
ol.source.wms.getFeatureInfo('?REQUEST=GetMap&LAYERS=foo', {
method: ol.source.WMSGetFeatureInfoMethod.XHR_GET
}, function(info) {
expect(info).to.contain('<html>');
done();
});
});
});
});
goog.require('ol.proj');
goog.require('ol.source.WMSGetFeatureInfoMethod');
goog.require('ol.source.wms');