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() { describe('DOM creation', function() {
it('creates the expected DOM elements', function() { it('creates the expected DOM elements', function() {
var zoomSliderContainers = goog.dom.getElementsByClass( var zoomSliderContainers = goog.dom.getElementsByClass(
'ol-zoomslider', target), 'ol-zoomslider', target);
zoomSliderContainer,
zoomSliderThumbs,
zoomSliderThumb,
hasUnselectableCls;
expect(zoomSliderContainers.length).to.be(1); expect(zoomSliderContainers.length).to.be(1);
zoomSliderContainer = zoomSliderContainers[0]; var zoomSliderContainer = zoomSliderContainers[0];
expect(zoomSliderContainer instanceof HTMLDivElement).to.be(true); expect(zoomSliderContainer instanceof HTMLDivElement).to.be(true);
hasUnselectableCls = goog.dom.classlist.contains(zoomSliderContainer, var hasUnselectableCls = goog.dom.classlist.contains(zoomSliderContainer,
'ol-unselectable'); 'ol-unselectable');
expect(hasUnselectableCls).to.be(true); expect(hasUnselectableCls).to.be(true);
zoomSliderThumbs = goog.dom.getElementsByClass('ol-zoomslider-thumb', var zoomSliderThumbs = goog.dom.getElementsByClass('ol-zoomslider-thumb',
zoomSliderContainer); zoomSliderContainer);
expect(zoomSliderThumbs.length).to.be(1); expect(zoomSliderThumbs.length).to.be(1);
zoomSliderThumb = zoomSliderThumbs[0]; var zoomSliderThumb = zoomSliderThumbs[0];
expect(zoomSliderThumb instanceof HTMLButtonElement).to.be(true); expect(zoomSliderThumb instanceof HTMLButtonElement).to.be(true);
hasUnselectableCls = goog.dom.classlist.contains(zoomSliderThumb, hasUnselectableCls = goog.dom.classlist.contains(zoomSliderThumb,

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -49,7 +49,8 @@ describe('ol.proj', function() {
}); });
it('gives that CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, EPSG:4326 are ' + it('gives that CRS:84, urn:ogc:def:crs:EPSG:6.6:4326, EPSG:4326 are ' +
'equivalent', function() { 'equivalent',
function() {
_testAllEquivalent([ _testAllEquivalent([
'CRS:84', 'CRS:84',
'urn:ogc:def:crs:EPSG:6.6:4326', 'urn:ogc:def:crs:EPSG:6.6:4326',

View File

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