named exports from ol/xml

This commit is contained in:
raiyni
2018-02-07 14:36:18 -06:00
parent 3266ffc58f
commit 4449da3e63
21 changed files with 1144 additions and 1131 deletions

View File

@@ -9,10 +9,10 @@ import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
import Point from '../../../../src/ol/geom/Point.js';
import Polygon from '../../../../src/ol/geom/Polygon.js';
import {transform} from '../../../../src/ol/proj.js';
import _ol_xml_ from '../../../../src/ol/xml.js';
import {createElementNS, parse} from '../../../../src/ol/xml.js';
const readGeometry = function(format, text, opt_options) {
const doc = _ol_xml_.parse(text);
const doc = parse(text);
// we need an intermediate node for testing purposes
const node = document.createElement('PRE');
node.appendChild(doc.documentElement);
@@ -146,7 +146,7 @@ describe('ol.format.GML2', function() {
let node;
const featureNS = 'http://www.openlayers.org/';
beforeEach(function() {
node = _ol_xml_.createElementNS(featureNS, 'layer');
node = createElementNS(featureNS, 'layer');
});
it('can serialize a LineString', function() {
@@ -173,7 +173,7 @@ describe('ol.format.GML2', function() {
}];
format.writeFeatureElement(node, feature, objectStack);
expect(node).to.xmleql(_ol_xml_.parse(expected));
expect(node).to.xmleql(parse(expected));
});
it('can serialize a Polygon', function() {
@@ -204,7 +204,7 @@ describe('ol.format.GML2', function() {
}];
format.writeFeatureElement(node, feature, objectStack);
expect(node).to.xmleql(_ol_xml_.parse(expected));
expect(node).to.xmleql(parse(expected));
});
it('can serialize a Point', function() {
@@ -231,7 +231,7 @@ describe('ol.format.GML2', function() {
}];
format.writeFeatureElement(node, feature, objectStack);
expect(node).to.xmleql(_ol_xml_.parse(expected));
expect(node).to.xmleql(parse(expected));
});
it('can serialize a Multi Point', function() {
@@ -262,7 +262,7 @@ describe('ol.format.GML2', function() {
}];
format.writeFeatureElement(node, feature, objectStack);
expect(node).to.xmleql(_ol_xml_.parse(expected));
expect(node).to.xmleql(parse(expected));
});
it('can serialize a Multi Line String', function() {
@@ -293,7 +293,7 @@ describe('ol.format.GML2', function() {
}];
format.writeFeatureElement(node, feature, objectStack);
expect(node).to.xmleql(_ol_xml_.parse(expected));
expect(node).to.xmleql(parse(expected));
});
it('can serialize a Multi Polygon', function() {
@@ -328,7 +328,7 @@ describe('ol.format.GML2', function() {
}];
format.writeFeatureElement(node, feature, objectStack);
expect(node).to.xmleql(_ol_xml_.parse(expected));
expect(node).to.xmleql(parse(expected));
});
});
});
@@ -358,7 +358,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(Point);
expect(g.getCoordinates()).to.eql([1, 2, 0]);
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('can read a point geometry with scientific notation', function() {
@@ -428,7 +428,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(Point);
expect(g.getCoordinates()).to.eql([1, 2, 0]);
const serialized = formatWGS84.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
});
@@ -445,7 +445,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(LineString);
expect(g.getCoordinates()).to.eql([[1, 2, 0], [3, 4, 0]]);
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('can read, transform and write a linestring geometry', function() {
@@ -484,7 +484,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(LineString);
expect(g.getCoordinates()).to.eql([[1, 2, 0], [3, 4, 0]]);
const serialized = formatWGS84.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
});
@@ -503,7 +503,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(LineString);
expect(g.getCoordinates()).to.eql([[-180, -90, 0], [180, 90, 0]]);
const serialized = formatWGS84.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('can read and write a point geometry with correct axis order',
@@ -517,7 +517,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(Point);
expect(g.getCoordinates()).to.eql([-180, -90, 0]);
const serialized = formatWGS84.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('can read and write a surface geometry with right axis order',
@@ -549,7 +549,7 @@ describe('ol.format.GML3', function() {
srsName: 'urn:x-ogc:def:crs:EPSG:4326',
surface: false});
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
});
@@ -582,7 +582,7 @@ describe('ol.format.GML3', function() {
expect(g.getCoordinates()).to.eql(
[[1, 2, 0], [3, 4, 0], [5, 6, 0], [1, 2, 0]]);
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
});
@@ -615,7 +615,7 @@ describe('ol.format.GML3', function() {
[1, 2, 0]], [[2, 3, 0], [2, 5, 0], [4, 5, 0], [2, 3, 0]],
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
});
@@ -659,7 +659,7 @@ describe('ol.format.GML3', function() {
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]]);
format = new _ol_format_GML_({srsName: 'CRS:84', surface: true});
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
});
@@ -681,7 +681,7 @@ describe('ol.format.GML3', function() {
expect(g.getCoordinates()).to.eql([[1, 2, 0], [3, 4, 0]]);
format = new _ol_format_GML_({srsName: 'CRS:84', curve: true});
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
});
@@ -727,7 +727,7 @@ describe('ol.format.GML3', function() {
expect(g).to.be.an(MultiPoint);
expect(g.getCoordinates()).to.eql([[1, 2, 0], [2, 3, 0], [3, 4, 0]]);
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('can read a plural multipoint geometry', function() {
@@ -776,7 +776,7 @@ describe('ol.format.GML3', function() {
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
format = new _ol_format_GML_({srsName: 'CRS:84', multiCurve: false});
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('can read a plural multilinestring geometry', function() {
@@ -852,7 +852,7 @@ describe('ol.format.GML3', function() {
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
format = new _ol_format_GML_({srsName: 'CRS:84', multiSurface: false});
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('can read a plural multipolygon geometry', function() {
@@ -920,7 +920,7 @@ describe('ol.format.GML3', function() {
expect(g.getCoordinates()).to.eql(
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('can read and write a singular multicurve-curve geometry', function() {
@@ -952,7 +952,7 @@ describe('ol.format.GML3', function() {
[[[1, 2, 0], [2, 3, 0]], [[3, 4, 0], [4, 5, 0]]]);
format = new _ol_format_GML_({srsName: 'CRS:84', curve: true});
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
});
@@ -1008,7 +1008,7 @@ describe('ol.format.GML3', function() {
[[3, 4, 0], [3, 6, 0], [5, 6, 0], [3, 4, 0]]],
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('can read a plural multisurface geometry', function() {
@@ -1111,7 +1111,7 @@ describe('ol.format.GML3', function() {
[[[1, 2, 0], [3, 2, 0], [3, 4, 0], [1, 2, 0]]]]);
format = new _ol_format_GML_({srsName: 'CRS:84', surface: true});
const serialized = format.writeGeometryNode(g);
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
});
@@ -1277,7 +1277,7 @@ describe('ol.format.GML3', function() {
it('writes back features as GML', function() {
const serialized = gmlFormat.writeFeaturesNode(features);
expect(serialized).to.xmleql(_ol_xml_.parse(text), {ignoreElementOrder: true});
expect(serialized).to.xmleql(parse(text), {ignoreElementOrder: true});
});
});

View File

@@ -5,7 +5,7 @@ import MultiLineString from '../../../../src/ol/geom/MultiLineString.js';
import Point from '../../../../src/ol/geom/Point.js';
import Polygon from '../../../../src/ol/geom/Polygon.js';
import {get as getProjection, transform} from '../../../../src/ol/proj.js';
import _ol_xml_ from '../../../../src/ol/xml.js';
import {parse} from '../../../../src/ol/xml.js';
describe('ol.format.GPX', function() {
@@ -76,7 +76,7 @@ describe('ol.format.GPX', function() {
expect(f.get('number')).to.be(1);
expect(f.get('type')).to.be('Type');
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('can read and write a rte with multiple rtepts', function() {
@@ -99,7 +99,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([[2, 1], [4, 3]]);
expect(g.getLayout()).to.be('XY');
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('can transform, read and write a rte', function() {
@@ -128,7 +128,7 @@ describe('ol.format.GPX', function() {
const serialized = format.writeFeaturesNode(fs, {
featureProjection: 'EPSG:3857'
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('does not write rte attributes in rtepts', function() {
@@ -145,7 +145,7 @@ describe('ol.format.GPX', function() {
'</gpx>';
const fs = format.readFeatures(text);
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -200,7 +200,7 @@ describe('ol.format.GPX', function() {
expect(f.get('number')).to.be(1);
expect(f.get('type')).to.be('Type');
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('can read and write a trk with an empty trkseg', function() {
@@ -222,7 +222,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([[]]);
expect(g.getLayout()).to.be('XY');
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('can read/write a trk with a trkseg with multiple trkpts', function() {
@@ -255,7 +255,7 @@ describe('ol.format.GPX', function() {
]);
expect(g.getLayout()).to.be('XYZM');
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('can transform, read and write a trk with a trkseg', function() {
@@ -294,7 +294,7 @@ describe('ol.format.GPX', function() {
const serialized = format.writeFeaturesNode(fs, {
featureProjection: 'EPSG:3857'
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('can read and write a trk with multiple trksegs', function() {
@@ -338,7 +338,7 @@ describe('ol.format.GPX', function() {
]);
expect(g.getLayout()).to.be('XYZM');
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('does not write trk attributes in trkpts', function() {
@@ -373,7 +373,7 @@ describe('ol.format.GPX', function() {
'</gpx>';
const fs = format.readFeatures(text);
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -397,7 +397,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([2, 1]);
expect(g.getLayout()).to.be('XY');
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('can transform, read and write a wpt', function() {
@@ -422,7 +422,7 @@ describe('ol.format.GPX', function() {
const serialized = format.writeFeaturesNode(fs, {
featureProjection: 'EPSG:3857'
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('can read and write a wpt with ele', function() {
@@ -444,7 +444,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([2, 1, 3]);
expect(g.getLayout()).to.be('XYZ');
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('can read and write a wpt with time', function() {
@@ -466,7 +466,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([2, 1, 1263115752]);
expect(g.getLayout()).to.be('XYM');
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('can read and write a wpt with ele and time', function() {
@@ -489,7 +489,7 @@ describe('ol.format.GPX', function() {
expect(g.getCoordinates()).to.eql([2, 1, 3, 1263115752]);
expect(g.getLayout()).to.be('XYZM');
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('can read and write various wpt attributes', function() {
@@ -542,7 +542,7 @@ describe('ol.format.GPX', function() {
expect(f.get('ageofdgpsdata')).to.be(9);
expect(f.get('dgpsid')).to.be(10);
const serialized = format.writeFeaturesNode(fs);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -672,7 +672,7 @@ describe('ol.format.GPX', function() {
'xsi:schemaLocation="http://www.topografix.com/GPX/1/1 ' +
'http://www.topografix.com/GPX/1/1/gpx.xsd" version="1.1" ' +
'creator="OpenLayers"></gpx>';
expect(gpx).to.xmleql(_ol_xml_.parse(expected));
expect(gpx).to.xmleql(parse(expected));
});
});

View File

@@ -21,7 +21,7 @@ import IconOrigin from '../../../../src/ol/style/IconOrigin.js';
import Stroke from '../../../../src/ol/style/Stroke.js';
import Style from '../../../../src/ol/style/Style.js';
import Text from '../../../../src/ol/style/Text.js';
import _ol_xml_ from '../../../../src/ol/xml.js';
import {parse} from '../../../../src/ol/xml.js';
describe('ol.format.KML', function() {
@@ -128,7 +128,7 @@ describe('ol.format.KML', function() {
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark/>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write a Feature as string', function() {
@@ -142,7 +142,7 @@ describe('ol.format.KML', function() {
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark/>' +
'</kml>';
expect(_ol_xml_.parse(node)).to.xmleql(_ol_xml_.parse(text));
expect(parse(node)).to.xmleql(parse(text));
});
it('can write a Feature\'s id', function() {
@@ -158,7 +158,7 @@ describe('ol.format.KML', function() {
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark id="foo"/>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
});
@@ -189,7 +189,7 @@ describe('ol.format.KML', function() {
' https://developers.google.com/kml/schema/kml22gx.xsd">' +
' <Placemark/>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
@@ -216,7 +216,7 @@ describe('ol.format.KML', function() {
' </LineString>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can read Point geometries', function() {
@@ -332,7 +332,7 @@ describe('ol.format.KML', function() {
' </Point>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write XYZ Point geometries', function() {
@@ -352,7 +352,7 @@ describe('ol.format.KML', function() {
' </Point>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can transform and write XYZ Point geometries', function() {
@@ -384,7 +384,7 @@ describe('ol.format.KML', function() {
' </Point>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
removeTransform(getProjection('EPSG:4326'), getProjection('double'));
removeTransform(getProjection('double'), getProjection('EPSG:4326'));
@@ -407,7 +407,7 @@ describe('ol.format.KML', function() {
' </Point>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write XYZM Point geometries', function() {
@@ -427,7 +427,7 @@ describe('ol.format.KML', function() {
' </Point>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can read LineString geometries', function() {
@@ -471,7 +471,7 @@ describe('ol.format.KML', function() {
' </LineString>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write XYZ LineString geometries', function() {
@@ -492,7 +492,7 @@ describe('ol.format.KML', function() {
' </LineString>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write XYM LineString geometries', function() {
@@ -513,7 +513,7 @@ describe('ol.format.KML', function() {
' </LineString>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write XYZM LineString geometries', function() {
@@ -534,7 +534,7 @@ describe('ol.format.KML', function() {
' </LineString>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can read LinearRing geometries', function() {
@@ -573,7 +573,7 @@ describe('ol.format.KML', function() {
' </LinearRing>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write XYZ LinearRing geometries', function() {
@@ -594,7 +594,7 @@ describe('ol.format.KML', function() {
' </LinearRing>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write XYM LinearRing geometries', function() {
@@ -615,7 +615,7 @@ describe('ol.format.KML', function() {
' </LinearRing>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write XYZM LinearRing geometries', function() {
@@ -636,7 +636,7 @@ describe('ol.format.KML', function() {
' </LinearRing>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can read Polygon geometries', function() {
@@ -688,7 +688,7 @@ describe('ol.format.KML', function() {
' </Polygon>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write XYZ Polygon geometries', function() {
@@ -715,7 +715,7 @@ describe('ol.format.KML', function() {
' </Polygon>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write XYM Polygon geometries', function() {
@@ -742,7 +742,7 @@ describe('ol.format.KML', function() {
' </Polygon>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write XYZM Polygon geometries', function() {
@@ -768,7 +768,7 @@ describe('ol.format.KML', function() {
' </Polygon>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can read complex Polygon geometries', function() {
@@ -842,7 +842,7 @@ describe('ol.format.KML', function() {
' </Polygon>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can read MultiPolygon geometries', function() {
@@ -920,7 +920,7 @@ describe('ol.format.KML', function() {
' </MultiGeometry>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can read MultiPoint geometries', function() {
@@ -981,7 +981,7 @@ describe('ol.format.KML', function() {
' </MultiGeometry>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can read MultiLineString geometries', function() {
@@ -1046,7 +1046,7 @@ describe('ol.format.KML', function() {
' </MultiGeometry>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can read MultiPolygon geometries', function() {
@@ -1126,7 +1126,7 @@ describe('ol.format.KML', function() {
' </MultiGeometry>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can read empty GeometryCollection geometries', function() {
@@ -1237,7 +1237,7 @@ describe('ol.format.KML', function() {
' </MultiGeometry>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can read gx:Track', function() {
@@ -1428,7 +1428,7 @@ describe('ol.format.KML', function() {
' <description>My description</description>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write Feature\'s boolean attributes', function() {
@@ -1448,7 +1448,7 @@ describe('ol.format.KML', function() {
' <visibility>0</visibility>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
});
@@ -1539,7 +1539,7 @@ describe('ol.format.KML', function() {
' </ExtendedData>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write ExtendedData with values', function() {
@@ -1565,7 +1565,7 @@ describe('ol.format.KML', function() {
' </ExtendedData>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write ExtendedData pair with displayName and value', function() {
@@ -1594,7 +1594,7 @@ describe('ol.format.KML', function() {
' </ExtendedData>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can read ExtendedData', function() {
@@ -2308,7 +2308,7 @@ describe('ol.format.KML', function() {
' </Style>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('does not write styles when writeStyles option is false', function() {
@@ -2330,7 +2330,7 @@ describe('ol.format.KML', function() {
' <Placemark>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('skips image styles that are not icon styles', function() {
@@ -2356,7 +2356,7 @@ describe('ol.format.KML', function() {
' </Style>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write an feature\'s text style', function() {
@@ -2388,7 +2388,7 @@ describe('ol.format.KML', function() {
' </Style>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write an feature\'s stroke style', function() {
@@ -2416,7 +2416,7 @@ describe('ol.format.KML', function() {
' </Style>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write an feature\'s fill style', function() {
@@ -2442,7 +2442,7 @@ describe('ol.format.KML', function() {
' </Style>' +
' </Placemark>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
it('can write multiple features with Style', function() {
@@ -2479,7 +2479,7 @@ describe('ol.format.KML', function() {
' </Placemark>' +
' </Document>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
});
@@ -3008,7 +3008,7 @@ describe('ol.format.KML', function() {
' </Placemark>' +
' </Document>' +
'</kml>';
expect(node).to.xmleql(_ol_xml_.parse(text));
expect(node).to.xmleql(parse(text));
});
});

View File

@@ -1,5 +1,5 @@
import OWS from '../../../../src/ol/format/OWS.js';
import _ol_xml_ from '../../../../src/ol/xml.js';
import {parse} from '../../../../src/ol/xml.js';
describe('ol.format.OWS 1.1', function() {
@@ -7,7 +7,7 @@ describe('ol.format.OWS 1.1', function() {
const parser = new OWS();
it('should read ServiceProvider tag properly', function() {
const doc = _ol_xml_.parse(
const doc = parse(
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
'<ows:ServiceProvider>' +
@@ -56,7 +56,7 @@ describe('ol.format.OWS 1.1', function() {
});
it('should read ServiceIdentification tag properly', function() {
const doc = _ol_xml_.parse(
const doc = parse(
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
'<ows:ServiceIdentification>' +
@@ -91,7 +91,7 @@ describe('ol.format.OWS 1.1', function() {
});
it('should read OperationsMetadata tag properly', function() {
const doc = _ol_xml_.parse(
const doc = parse(
'<ows:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" ' +
'xmlns:xlink="http://www.w3.org/1999/xlink" >' +
'<ows:OperationsMetadata>' +

View File

@@ -26,7 +26,7 @@ import MultiPolygon from '../../../../src/ol/geom/MultiPolygon.js';
import Polygon from '../../../../src/ol/geom/Polygon.js';
import {addCommon, clearAllProjections, transform} from '../../../../src/ol/proj.js';
import {register} from '../../../../src/ol/proj/proj4.js';
import _ol_xml_ from '../../../../src/ol/xml.js';
import {parse} from '../../../../src/ol/xml.js';
describe('ol.format.WFS', function() {
@@ -251,7 +251,7 @@ describe('ol.format.WFS', function() {
srsName: 'urn:ogc:def:crs:EPSG::4326',
propertyNames: ['STATE_NAME', 'STATE_FIPS', 'STATE_ABBR']
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('creates paging headers', function() {
@@ -276,7 +276,7 @@ describe('ol.format.WFS', function() {
featurePrefix: 'topp',
featureTypes: ['states']
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('creates a BBOX filter', function() {
@@ -303,7 +303,7 @@ describe('ol.format.WFS', function() {
geometryName: 'the_geom',
bbox: [1, 2, 3, 4]
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates a property filter', function() {
@@ -325,7 +325,7 @@ describe('ol.format.WFS', function() {
featureTypes: ['states'],
filter: equalToFilter('name', 'New York', false)
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates two property filters', function() {
@@ -355,7 +355,7 @@ describe('ol.format.WFS', function() {
equalToFilter('name', 'New York'),
equalToFilter('area', 1234))
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates greater/less than property filters', function() {
@@ -404,7 +404,7 @@ describe('ol.format.WFS', function() {
)
)
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates isBetween property filter', function() {
@@ -427,7 +427,7 @@ describe('ol.format.WFS', function() {
featureTypes: ['states'],
filter: betweenFilter('area', 100, 1000)
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates isNull property filter', function() {
@@ -448,7 +448,7 @@ describe('ol.format.WFS', function() {
featureTypes: ['states'],
filter: isNullFilter('area')
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates isLike property filter', function() {
@@ -470,7 +470,7 @@ describe('ol.format.WFS', function() {
featureTypes: ['states'],
filter: likeFilter('name', 'New*')
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates isLike property filter with arguments', function() {
@@ -492,7 +492,7 @@ describe('ol.format.WFS', function() {
featureTypes: ['states'],
filter: likeFilter('name', 'New*', '*', '.', '!', false)
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates a Not filter', function() {
@@ -516,7 +516,7 @@ describe('ol.format.WFS', function() {
featureTypes: ['states'],
filter: notFilter(equalToFilter('name', 'New York'))
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates an AND filter', function() {
@@ -556,7 +556,7 @@ describe('ol.format.WFS', function() {
greaterThanFilter('population', 2000000)
)
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates a contains filter', function() {
@@ -593,7 +593,7 @@ describe('ol.format.WFS', function() {
]])
)
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates a intersects filter', function() {
@@ -630,7 +630,7 @@ describe('ol.format.WFS', function() {
]])
)
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates a within filter', function() {
@@ -667,7 +667,7 @@ describe('ol.format.WFS', function() {
]])
)
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
it('creates During property filter', function() {
@@ -698,7 +698,7 @@ describe('ol.format.WFS', function() {
featureTypes: ['states'],
filter: duringFilter('date_prop', '2010-01-20T00:00:00Z', '2012-12-31T00:00:00Z')
});
expect(serialized.firstElementChild).to.xmleql(_ol_xml_.parse(text));
expect(serialized.firstElementChild).to.xmleql(parse(text));
});
});
@@ -714,7 +714,7 @@ describe('ol.format.WFS', function() {
'http://schemas.opengis.net/wfs/1.1.0/wfs.xsd"/>';
const serialized = new WFS().writeTransaction(null, null, null,
{handle: 'handle_t'});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -745,7 +745,7 @@ describe('ol.format.WFS', function() {
featurePrefix: 'feature',
gmlOptions: {multiCurve: true, srsName: 'EPSG:900913'}
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -776,7 +776,7 @@ describe('ol.format.WFS', function() {
featurePrefix: 'foo',
gmlOptions: {srsName: 'EPSG:900913'}
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
it('creates the correct update if geometry name is alias', function() {
@@ -796,7 +796,7 @@ describe('ol.format.WFS', function() {
featurePrefix: 'foo',
gmlOptions: {srsName: 'EPSG:900913'}
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -882,7 +882,7 @@ describe('ol.format.WFS', function() {
featurePrefix: 'foo',
gmlOptions: {srsName: 'EPSG:900913'}
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -924,7 +924,7 @@ describe('ol.format.WFS', function() {
featureType: 'states',
featurePrefix: 'topp'
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -951,7 +951,7 @@ describe('ol.format.WFS', function() {
value: 'Another native line goes here'
}]
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -996,7 +996,7 @@ describe('ol.format.WFS', function() {
version: '1.0.0'
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -1038,7 +1038,7 @@ describe('ol.format.WFS', function() {
featureType: 'topp:states',
featurePrefix: 'topp'
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -1081,7 +1081,7 @@ describe('ol.format.WFS', function() {
version: '1.0.0'
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -1121,7 +1121,7 @@ describe('ol.format.WFS', function() {
hasZ: true,
featurePrefix: 'topp'
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -1141,7 +1141,7 @@ describe('ol.format.WFS', function() {
featureTypes: ['states', 'cities'],
featurePrefix: 'topp'
});
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});
@@ -1320,7 +1320,7 @@ describe('ol.format.WFS', function() {
equalToFilter('waterway', 'riverbank')
)
);
expect(serialized).to.xmleql(_ol_xml_.parse(text));
expect(serialized).to.xmleql(parse(text));
});
});