Indentation

This commit is contained in:
Tim Schaub
2016-01-03 11:20:03 -07:00
parent aac1d921c7
commit 3f23dfb87b
11 changed files with 131 additions and 121 deletions

View File

@@ -25,26 +25,22 @@ describe('ol.control.ZoomSlider', function() {
describe('DOM creation', function() {
it('creates the expected DOM elements', function() {
var zoomSliderContainers = goog.dom.getElementsByClass(
'ol-zoomslider', target),
zoomSliderContainer,
zoomSliderThumbs,
zoomSliderThumb,
hasUnselectableCls;
'ol-zoomslider', target);
expect(zoomSliderContainers.length).to.be(1);
zoomSliderContainer = zoomSliderContainers[0];
var zoomSliderContainer = zoomSliderContainers[0];
expect(zoomSliderContainer instanceof HTMLDivElement).to.be(true);
hasUnselectableCls = goog.dom.classlist.contains(zoomSliderContainer,
var hasUnselectableCls = goog.dom.classlist.contains(zoomSliderContainer,
'ol-unselectable');
expect(hasUnselectableCls).to.be(true);
zoomSliderThumbs = goog.dom.getElementsByClass('ol-zoomslider-thumb',
var zoomSliderThumbs = goog.dom.getElementsByClass('ol-zoomslider-thumb',
zoomSliderContainer);
expect(zoomSliderThumbs.length).to.be(1);
zoomSliderThumb = zoomSliderThumbs[0];
var zoomSliderThumb = zoomSliderThumbs[0];
expect(zoomSliderThumb instanceof HTMLButtonElement).to.be(true);
hasUnselectableCls = goog.dom.classlist.contains(zoomSliderThumb,

View File

@@ -3,8 +3,7 @@ goog.provide('ol.test.coordinate');
describe('ol.coordinate', function() {
describe('#add', function() {
var coordinate,
delta;
var coordinate, delta;
beforeEach(function() {
coordinate = [50.73, 7.1];
@@ -31,13 +30,13 @@ describe('ol.coordinate', function() {
});
describe('#equals', function() {
var cologne = [50.93333, 6.95],
bonn1 = [50.73, 7.1],
bonn2 = [50.73000, 7.10000];
var cologne = [50.93333, 6.95];
var bonn1 = [50.73, 7.1];
var bonn2 = [50.73000, 7.10000];
it('compares correctly', function() {
var bonnEqualsBonn = ol.coordinate.equals(bonn1, bonn2),
bonnEqualsCologne = ol.coordinate.equals(bonn1, cologne);
var bonnEqualsBonn = ol.coordinate.equals(bonn1, bonn2);
var bonnEqualsCologne = ol.coordinate.equals(bonn1, cologne);
expect(bonnEqualsBonn).to.be(true);
expect(bonnEqualsCologne).to.be(false);
});
@@ -61,9 +60,7 @@ describe('ol.coordinate', function() {
});
describe('#createStringXY', function() {
var coordinate,
created,
formatted;
var coordinate, created, formatted;
beforeEach(function() {
coordinate = [6.6123, 46.7919];
created = null;

View File

@@ -270,8 +270,8 @@ describe('ol.format.EsriJSON', function() {
describe('#readFeatures', function() {
it('parses feature collection', function() {
var str = JSON.stringify(data),
array = format.readFeatures(str);
var str = JSON.stringify(data);
var array = format.readFeatures(str);
expect(array.length).to.be(2);
@@ -545,12 +545,12 @@ describe('ol.format.EsriJSON', function() {
});
it('parses polygon', function() {
var outer = [[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]],
inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]],
inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]],
str = JSON.stringify({
rings: [outer, inner1, inner2]
});
var outer = [[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]];
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
var str = JSON.stringify({
rings: [outer, inner1, inner2]
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Polygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XY);
@@ -563,13 +563,13 @@ describe('ol.format.EsriJSON', function() {
});
it('parses XYZ polygon', function() {
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]],
inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]],
inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]],
str = JSON.stringify({
rings: [outer, inner1, inner2],
hasZ: true
});
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]];
var inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]];
var inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
var str = JSON.stringify({
rings: [outer, inner1, inner2],
hasZ: true
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Polygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZ);
@@ -582,13 +582,13 @@ describe('ol.format.EsriJSON', function() {
});
it('parses XYM polygon', function() {
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]],
inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]],
inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]],
str = JSON.stringify({
rings: [outer, inner1, inner2],
hasM: true
});
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]];
var inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]];
var inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
var str = JSON.stringify({
rings: [outer, inner1, inner2],
hasM: true
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Polygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYM);
@@ -601,17 +601,23 @@ describe('ol.format.EsriJSON', function() {
});
it('parses XYZM polygon', function() {
var outer = [[0, 0, 5, 1], [0, 10, 5, 1], [10, 10, 5, 1],
[10, 0, 5, 1], [0, 0, 5, 1]],
inner1 = [[1, 1, 3, 2], [2, 1, 3, 2], [2, 2, 3, 2],
[1, 2, 3, 2], [1, 1, 3, 2]],
inner2 = [[8, 8, 2, 1], [9, 8, 2, 1], [9, 9, 2, 1],
[8, 9, 2, 1], [8, 8, 2, 1]],
str = JSON.stringify({
rings: [outer, inner1, inner2],
hasZ: true,
hasM: true
});
var outer = [
[0, 0, 5, 1], [0, 10, 5, 1], [10, 10, 5, 1],
[10, 0, 5, 1], [0, 0, 5, 1]
];
var inner1 = [
[1, 1, 3, 2], [2, 1, 3, 2], [2, 2, 3, 2],
[1, 2, 3, 2], [1, 1, 3, 2]
];
var inner2 = [
[8, 8, 2, 1], [9, 8, 2, 1], [9, 9, 2, 1],
[8, 9, 2, 1], [8, 8, 2, 1]
];
var str = JSON.stringify({
rings: [outer, inner1, inner2],
hasZ: true,
hasM: true
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Polygon);
expect(obj.getLayout()).to.eql(ol.geom.GeometryLayout.XYZM);
@@ -811,9 +817,9 @@ describe('ol.format.EsriJSON', function() {
});
it('encodes polygon', function() {
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]],
inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]],
inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
var polygon = new ol.geom.Polygon([outer, inner1, inner2]);
var esrijson = format.writeGeometry(polygon);
expect(polygon.getCoordinates(false)).to.eql(
@@ -821,9 +827,9 @@ describe('ol.format.EsriJSON', function() {
});
it('encodes XYZ polygon', function() {
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]],
inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]],
inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]];
var inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]];
var inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
var polygon = new ol.geom.Polygon([outer, inner1, inner2],
ol.geom.GeometryLayout.XYZ);
var esrijson = format.writeGeometry(polygon);
@@ -832,9 +838,9 @@ describe('ol.format.EsriJSON', function() {
});
it('encodes XYM polygon', function() {
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]],
inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]],
inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
var outer = [[0, 0, 5], [0, 10, 5], [10, 10, 5], [10, 0, 5], [0, 0, 5]];
var inner1 = [[1, 1, 3], [2, 1, 3], [2, 2, 3], [1, 2, 3], [1, 1, 3]];
var inner2 = [[8, 8, 2], [9, 8, 2], [9, 9, 2], [8, 9, 2], [8, 8, 2]];
var polygon = new ol.geom.Polygon([outer, inner1, inner2],
ol.geom.GeometryLayout.XYM);
var esrijson = format.writeGeometry(polygon);
@@ -843,12 +849,15 @@ describe('ol.format.EsriJSON', function() {
});
it('encodes XYZM polygon', function() {
var outer = [[0, 0, 5, 1], [0, 10, 5, 2], [10, 10, 5, 1],
[10, 0, 5, 1], [0, 0, 5, 1]],
inner1 = [[1, 1, 3, 1], [2, 1, 3, 2], [2, 2, 3, 1], [1, 2, 3, 1],
[1, 1, 3, 1]],
inner2 = [[8, 8, 2, 1], [9, 8, 2, 2], [9, 9, 2, 1], [8, 9, 2, 1],
[8, 8, 2, 1]];
var outer = [
[0, 0, 5, 1], [0, 10, 5, 2], [10, 10, 5, 1], [10, 0, 5, 1], [0, 0, 5, 1]
];
var inner1 = [
[1, 1, 3, 1], [2, 1, 3, 2], [2, 2, 3, 1], [1, 2, 3, 1], [1, 1, 3, 1]
];
var inner2 = [
[8, 8, 2, 1], [9, 8, 2, 2], [9, 9, 2, 1], [8, 9, 2, 1], [8, 8, 2, 1]
];
var polygon = new ol.geom.Polygon([outer, inner1, inner2],
ol.geom.GeometryLayout.XYZM);
var esrijson = format.writeGeometry(polygon);
@@ -995,8 +1004,8 @@ describe('ol.format.EsriJSON', function() {
describe('#writeFeatures', function() {
it('encodes feature collection', function() {
var str = JSON.stringify(data),
array = format.readFeatures(str);
var str = JSON.stringify(data);
var array = format.readFeatures(str);
var esrijson = format.writeFeaturesObject(array);
var result = format.readFeatures(esrijson);
expect(array.length).to.equal(result.length);
@@ -1015,8 +1024,8 @@ describe('ol.format.EsriJSON', function() {
});
it('transforms and encodes feature collection', function() {
var str = JSON.stringify(data),
array = format.readFeatures(str);
var str = JSON.stringify(data);
var array = format.readFeatures(str);
var esrijson = format.writeFeatures(array, {
featureProjection: 'EPSG:3857',
dataProjection: 'EPSG:4326'

View File

@@ -231,8 +231,8 @@ describe('ol.format.GeoJSON', function() {
describe('#readFeatures', function() {
it('parses feature collection', function() {
var str = JSON.stringify(data),
array = format.readFeatures(str);
var str = JSON.stringify(data);
var array = format.readFeatures(str);
expect(array.length).to.be(2);
@@ -344,13 +344,13 @@ describe('ol.format.GeoJSON', function() {
});
it('parses polygon', function() {
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]],
inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]],
inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]],
str = JSON.stringify({
type: 'Polygon',
coordinates: [outer, inner1, inner2]
});
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
var str = JSON.stringify({
type: 'Polygon',
coordinates: [outer, inner1, inner2]
});
var obj = format.readGeometry(str);
expect(obj).to.be.a(ol.geom.Polygon);
@@ -495,8 +495,8 @@ describe('ol.format.GeoJSON', function() {
describe('#writeFeatures', function() {
it('encodes feature collection', function() {
var str = JSON.stringify(data),
array = format.readFeatures(str);
var str = JSON.stringify(data);
var array = format.readFeatures(str);
var geojson = format.writeFeaturesObject(array);
var result = format.readFeatures(geojson);
expect(array.length).to.equal(result.length);
@@ -515,8 +515,8 @@ describe('ol.format.GeoJSON', function() {
});
it('transforms and encodes feature collection', function() {
var str = JSON.stringify(data),
array = format.readFeatures(str);
var str = JSON.stringify(data);
var array = format.readFeatures(str);
var geojson = format.writeFeatures(array, {
featureProjection: 'EPSG:3857'
});
@@ -576,9 +576,9 @@ describe('ol.format.GeoJSON', function() {
});
it('encodes polygon', function() {
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]],
inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]],
inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
var outer = [[0, 0], [10, 0], [10, 10], [0, 10], [0, 0]];
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
var polygon = new ol.geom.Polygon([outer, inner1, inner2]);
var geojson = format.writeGeometry(polygon);
expect(polygon.getCoordinates()).to.eql(

View File

@@ -280,7 +280,8 @@ describe('ol.format.GML3', function() {
describe('axis order', function() {
it('can read and write a linestring geometry with ' +
'correct axis order', function() {
'correct axis order',
function() {
var text =
'<gml:LineString xmlns:gml="http://www.opengis.net/gml" ' +
' srsName="urn:x-ogc:def:crs:EPSG:4326">' +

View File

@@ -19,20 +19,22 @@ describe('ol.geom.flat.interpolate', function() {
});
it('returns the expected value when the mid point is an existing ' +
'coordinate', function() {
var flatCoordinates = [0, 1, 2, 3, 4, 5];
var point = ol.geom.flat.interpolate.lineString(
flatCoordinates, 0, 6, 2, 0.5);
expect(point).to.eql([2, 3]);
});
'coordinate',
function() {
var flatCoordinates = [0, 1, 2, 3, 4, 5];
var point = ol.geom.flat.interpolate.lineString(
flatCoordinates, 0, 6, 2, 0.5);
expect(point).to.eql([2, 3]);
});
it('returns the expected value when the midpoint falls halfway between ' +
'two existing coordinates', function() {
var flatCoordinates = [0, 1, 2, 3, 4, 5, 6, 7];
var point = ol.geom.flat.interpolate.lineString(
flatCoordinates, 0, 8, 2, 0.5);
expect(point).to.eql([3, 4]);
});
'two existing coordinates',
function() {
var flatCoordinates = [0, 1, 2, 3, 4, 5, 6, 7];
var point = ol.geom.flat.interpolate.lineString(
flatCoordinates, 0, 8, 2, 0.5);
expect(point).to.eql([3, 4]);
});
it('returns the expected value when the coordinates are not evenly spaced',
function() {

View File

@@ -70,7 +70,8 @@ describe('ol.geom.flat.intersectsextent', function() {
});
});
describe('boundary does not intersect the extent and ring does not ' +
'contain a corner of the extent', function() {
'contain a corner of the extent',
function() {
it('returns false', function() {
var extent = [2.0, 0.5, 3, 1.5];
var r = ol.geom.flat.intersectsextent.linearRing(

View File

@@ -4,9 +4,9 @@ goog.require('ol.extent');
describe('ol.geom.GeometryCollection', function() {
var outer = [[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]],
inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]],
inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
var outer = [[0, 0], [0, 10], [10, 10], [10, 0], [0, 0]];
var inner1 = [[1, 1], [2, 1], [2, 2], [1, 2], [1, 1]];
var inner2 = [[8, 8], [9, 8], [9, 9], [8, 9], [8, 8]];
describe('constructor', function() {

View File

@@ -24,13 +24,13 @@ describe('ol.interaction.Translate', function() {
source.addFeatures(features);
var layer = new ol.layer.Vector({source: source});
map = new ol.Map({
target: target,
layers: [layer],
view: new ol.View({
target: target,
layers: [layer],
view: new ol.View({
projection: 'EPSG:4326',
center: [0, 0],
resolution: 1
})
})
});
map.once('postrender', function() {
done();

View File

@@ -49,13 +49,14 @@ describe('ol.proj', function() {
});
it('gives that CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, EPSG:4326 are ' +
'equivalent', function() {
_testAllEquivalent([
'CRS:84',
'urn:ogc:def:crs:EPSG:6.6:4326',
'EPSG:4326'
]);
});
'equivalent',
function() {
_testAllEquivalent([
'CRS:84',
'urn:ogc:def:crs:EPSG:6.6:4326',
'EPSG:4326'
]);
});
it('requires code and units to be equal for projection evquivalence',
function() {

View File

@@ -71,8 +71,9 @@ describe('ol.source.Tile', function() {
var zoom = 1;
var range = new ol.TileRange(0, 1, 0, 1);
var covered = source.forEachLoadedTile(source.getProjection(), zoom,
range, function() {
var covered = source.forEachLoadedTile(
source.getProjection(), zoom, range,
function() {
return true;
});
expect(covered).to.be(true);
@@ -90,8 +91,9 @@ describe('ol.source.Tile', function() {
var zoom = 1;
var range = new ol.TileRange(0, 1, 0, 1);
var covered = source.forEachLoadedTile(source.getProjection(), zoom,
range, function() {
var covered = source.forEachLoadedTile(
source.getProjection(), zoom,
range, function() {
return true;
});
expect(covered).to.be(false);
@@ -109,8 +111,9 @@ describe('ol.source.Tile', function() {
var zoom = 1;
var range = new ol.TileRange(0, 1, 0, 1);
var covered = source.forEachLoadedTile(source.getProjection(), zoom,
range, function() {
var covered = source.forEachLoadedTile(
source.getProjection(), zoom, range,
function() {
return false;
});
expect(covered).to.be(false);