Add tests for parsing of NetworkLink tags
This commit is contained in:
@@ -2489,6 +2489,45 @@ describe('ol.format.KML', function() {
|
||||
|
||||
});
|
||||
|
||||
describe('#readNetworkLinks', function() {
|
||||
it('returns empty array if no network links found', function() {
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2">' +
|
||||
' <Document>' +
|
||||
' </Document>' +
|
||||
'</kml>';
|
||||
var nl = format.readNetworkLinks(text);
|
||||
expect(nl).to.have.length(0);
|
||||
});
|
||||
|
||||
it('returns an array of network links', function() {
|
||||
var text =
|
||||
'<kml xmlns="http://www.opengis.net/kml/2.2">' +
|
||||
' <Document>' +
|
||||
' <NetworkLink>' +
|
||||
' <name>bar</name>' +
|
||||
' <Link>' +
|
||||
' <href>bar/bar.kml</href>' +
|
||||
' </Link>' +
|
||||
' </NetworkLink>' +
|
||||
' </Document>' +
|
||||
' <Folder>' +
|
||||
' <NetworkLink>' +
|
||||
' <Link>' +
|
||||
' <href>http://foo.com/foo.kml</href>' +
|
||||
' </Link>' +
|
||||
' </NetworkLink>' +
|
||||
' </Folder>' +
|
||||
'</kml>';
|
||||
var nl = format.readNetworkLinks(text);
|
||||
expect(nl).to.have.length(2);
|
||||
expect(nl[0].name).to.be('bar');
|
||||
expect(nl[0].href).to.be('bar/bar.kml');
|
||||
expect(nl[1].href).to.be('http://foo.com/foo.kml');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user