Use blocked scoped variables

In addition to using const and let, this also upgrades our linter config and removes lint (mostly whitespace).
This commit is contained in:
Tim Schaub
2018-01-11 23:32:36 -07:00
parent 0bf2b04dee
commit ad62739a6e
684 changed files with 18120 additions and 18184 deletions
+22 -22
View File
@@ -8,19 +8,19 @@ import Fill from '../../../../../src/ol/style/Fill.js';
import Stroke from '../../../../../src/ol/style/Stroke.js';
describe('ol.render.webgl.CircleReplay', function() {
var replay;
let replay;
var strokeStyle = new Stroke({
const strokeStyle = new Stroke({
color: [0, 255, 0, 0.4]
});
var fillStyle = new Fill({
const fillStyle = new Fill({
color: [255, 0, 0, 1]
});
beforeEach(function() {
var tolerance = 0.1;
var maxExtent = [-10000, -20000, 10000, 20000];
const tolerance = 0.1;
const maxExtent = [-10000, -20000, 10000, 20000];
replay = new _ol_render_webgl_CircleReplay_(tolerance, maxExtent);
});
@@ -48,7 +48,7 @@ describe('ol.render.webgl.CircleReplay', function() {
describe('#drawCircle', function() {
it('sets the buffer data', function() {
var circle = new Circle([0, 0], 5000);
const circle = new Circle([0, 0], 5000);
replay.setFillStrokeStyle(fillStyle, strokeStyle);
replay.drawCircle(circle, null);
@@ -61,7 +61,7 @@ describe('ol.render.webgl.CircleReplay', function() {
});
it('does not draw if radius is zero', function() {
var circle = new Circle([0, 0], 0);
const circle = new Circle([0, 0], 0);
replay.drawCircle(circle, null);
expect(replay.vertices).to.have.length(0);
@@ -71,7 +71,7 @@ describe('ol.render.webgl.CircleReplay', function() {
});
it('resets state and removes style if it belongs to a zero radius circle', function() {
var circle = new Circle([0, 0], 0);
const circle = new Circle([0, 0], 0);
replay.setFillStrokeStyle(fillStyle, strokeStyle);
replay.setFillStrokeStyle(null, strokeStyle);
@@ -97,7 +97,7 @@ describe('ol.render.webgl.CircleReplay', function() {
});
describe('#setUpProgram', function() {
var context, gl;
let context, gl;
beforeEach(function() {
context = {
getProgram: function() {},
@@ -114,9 +114,9 @@ describe('ol.render.webgl.CircleReplay', function() {
});
it('returns the locations used by the shaders', function() {
var locations = replay.setUpProgram(gl, context, [2, 2], 1);
const locations = replay.setUpProgram(gl, context, [2, 2], 1);
expect(locations).to.be.a(
_ol_render_webgl_circlereplay_defaultshader_Locations_);
_ol_render_webgl_circlereplay_defaultshader_Locations_);
});
it('gets and compiles the shaders', function() {
@@ -125,8 +125,8 @@ describe('ol.render.webgl.CircleReplay', function() {
replay.setUpProgram(gl, context, [2, 2], 1);
expect(context.getProgram.calledWithExactly(
_ol_render_webgl_circlereplay_defaultshader_.fragment,
_ol_render_webgl_circlereplay_defaultshader_.vertex)).to.be(true);
_ol_render_webgl_circlereplay_defaultshader_.fragment,
_ol_render_webgl_circlereplay_defaultshader_.vertex)).to.be(true);
expect(context.useProgram.calledOnce).to.be(true);
});
@@ -138,12 +138,12 @@ describe('ol.render.webgl.CircleReplay', function() {
replay.setUpProgram(gl, context, [2, 2], 1);
expect(gl.vertexAttribPointer.callCount).to.be(gl.getAttribLocation.callCount);
expect(gl.enableVertexAttribArray.callCount).to.be(
gl.getAttribLocation.callCount);
gl.getAttribLocation.callCount);
});
});
describe('#shutDownProgram', function() {
var context, gl;
let context, gl;
beforeEach(function() {
context = {
getProgram: function() {},
@@ -164,22 +164,22 @@ describe('ol.render.webgl.CircleReplay', function() {
sinon.spy(gl, 'getAttribLocation');
sinon.spy(gl, 'disableVertexAttribArray');
var locations = replay.setUpProgram(gl, context, [2, 2], 1);
const locations = replay.setUpProgram(gl, context, [2, 2], 1);
replay.shutDownProgram(gl, locations);
expect(gl.disableVertexAttribArray.callCount).to.be(
gl.getAttribLocation.callCount);
gl.getAttribLocation.callCount);
});
});
describe('#drawReplay', function() {
var gl, context;
var feature1 = new Feature({
let gl, context;
const feature1 = new Feature({
geometry: new Circle([0, 0], 5000)
});
var feature2 = new Feature({
const feature2 = new Feature({
geometry: new Circle([10, 10], 5000)
});
var feature3 = new Feature({
const feature3 = new Feature({
geometry: new Circle([20, 20], 5000)
});
beforeEach(function() {
@@ -231,7 +231,7 @@ describe('ol.render.webgl.CircleReplay', function() {
replay.setFillStrokeStyle(fillStyle, strokeStyle);
replay.drawCircle(feature3.getGeometry(), feature3);
replay.startIndices.push(replay.indices.length);
var skippedFeatHash = {};
const skippedFeatHash = {};
skippedFeatHash[getUid(feature2).toString()] = true;
replay.drawReplay(gl, context, skippedFeatHash, false);
+15 -15
View File
@@ -4,10 +4,10 @@ import _ol_render_webgl_ImageReplay_ from '../../../../../src/ol/render/webgl/Im
import ImageStyle from '../../../../../src/ol/style/Image.js';
describe('ol.render.webgl.ImageReplay', function() {
var replay;
let replay;
var createImageStyle = function(image) {
var imageStyle = new ImageStyle({
const createImageStyle = function(image) {
const imageStyle = new ImageStyle({
opacity: 0.1,
rotateWithView: true,
rotation: 1.5,
@@ -38,14 +38,14 @@ describe('ol.render.webgl.ImageReplay', function() {
};
beforeEach(function() {
var tolerance = 0.1;
var maxExtent = [-10000, -20000, 10000, 20000];
const tolerance = 0.1;
const maxExtent = [-10000, -20000, 10000, 20000];
replay = new _ol_render_webgl_ImageReplay_(tolerance, maxExtent);
});
describe('#setImageStyle', function() {
var imageStyle1, imageStyle2;
let imageStyle1, imageStyle2;
beforeEach(function() {
imageStyle1 = createImageStyle(new Image());
@@ -87,12 +87,12 @@ describe('ol.render.webgl.ImageReplay', function() {
describe('#drawPoint', function() {
beforeEach(function() {
var imageStyle = createImageStyle(new Image());
const imageStyle = createImageStyle(new Image());
replay.setImageStyle(imageStyle);
});
it('sets the buffer data', function() {
var point;
let point;
point = new Point([1000, 2000]);
replay.drawPoint(point, null);
@@ -120,15 +120,15 @@ describe('ol.render.webgl.ImageReplay', function() {
describe('#drawMultiPoint', function() {
beforeEach(function() {
var imageStyle = createImageStyle(new Image());
const imageStyle = createImageStyle(new Image());
replay.setImageStyle(imageStyle);
});
it('sets the buffer data', function() {
var multiPoint;
let multiPoint;
multiPoint = new MultiPoint(
[[1000, 2000], [2000, 3000]]);
[[1000, 2000], [2000, 3000]]);
replay.drawMultiPoint(multiPoint, null);
expect(replay.vertices).to.have.length(64);
expect(replay.indices).to.have.length(12);
@@ -146,7 +146,7 @@ describe('ol.render.webgl.ImageReplay', function() {
expect(replay.indices[11]).to.be(7);
multiPoint = new MultiPoint(
[[3000, 4000], [4000, 5000]]);
[[3000, 4000], [4000, 5000]]);
replay.drawMultiPoint(multiPoint, null);
expect(replay.vertices).to.have.length(128);
expect(replay.indices).to.have.length(24);
@@ -172,7 +172,7 @@ describe('ol.render.webgl.ImageReplay', function() {
});
it('returns the textures', function() {
var textures = replay.getTextures();
const textures = replay.getTextures();
expect(textures).to.have.length(2);
expect(textures[0]).to.be(1);
@@ -180,7 +180,7 @@ describe('ol.render.webgl.ImageReplay', function() {
});
it('can additionally return the hit detection textures', function() {
var textures = replay.getTextures(true);
const textures = replay.getTextures(true);
expect(textures).to.have.length(4);
expect(textures[0]).to.be(1);
@@ -197,7 +197,7 @@ describe('ol.render.webgl.ImageReplay', function() {
});
it('returns the hit detection textures', function() {
var textures = replay.getHitDetectionTextures();
const textures = replay.getHitDetectionTextures();
expect(textures).to.have.length(2);
expect(textures[0]).to.be(3);
+12 -12
View File
@@ -18,7 +18,7 @@ import Stroke from '../../../../../src/ol/style/Stroke.js';
import Style from '../../../../../src/ol/style/Style.js';
describe('ol.render.webgl.Immediate', function() {
var context, style, circle, line, multiLine, point, multiPoint, polygon, multiPolygon;
let context, style, circle, line, multiLine, point, multiPoint, polygon, multiPolygon;
beforeEach(function() {
context = new _ol_render_webgl_Immediate_({}, [0, 0], 0, 0, [0, 0], [-180, -90, 180, 90], 1);
style = new Style({
@@ -45,7 +45,7 @@ describe('ol.render.webgl.Immediate', function() {
});
describe('#drawFeature', function() {
var feat;
let feat;
beforeEach(function() {
feat = new Feature({
geometry: circle
@@ -84,7 +84,7 @@ describe('ol.render.webgl.Immediate', function() {
});
describe('#drawGeometryCollection', function() {
var geomColl;
let geomColl;
beforeEach(function() {
geomColl = new GeometryCollection([circle, point, multiPoint,
line, multiLine, polygon, multiPolygon]);
@@ -101,7 +101,7 @@ describe('ol.render.webgl.Immediate', function() {
describe('geometry functions', function() {
function mock(ctor, geomFunc) {
var tmpObj = {};
const tmpObj = {};
tmpObj.replay = ctor.prototype.replay;
ctor.prototype.replay = sinon.spy();
tmpObj.finish = ctor.prototype.finish;
@@ -124,13 +124,13 @@ describe('ol.render.webgl.Immediate', function() {
}
function restore(ctor, tmpObj) {
for (var i in tmpObj) {
for (const i in tmpObj) {
ctor.prototype[i] = tmpObj[i];
}
}
describe('#drawPoint', function() {
var tmpObj;
let tmpObj;
beforeEach(function() {
tmpObj = mock(_ol_render_webgl_ImageReplay_, 'drawPoint');
});
@@ -150,7 +150,7 @@ describe('ol.render.webgl.Immediate', function() {
});
describe('#drawMultiPoint', function() {
var tmpObj;
let tmpObj;
beforeEach(function() {
tmpObj = mock(_ol_render_webgl_ImageReplay_, 'drawMultiPoint');
});
@@ -170,7 +170,7 @@ describe('ol.render.webgl.Immediate', function() {
});
describe('#drawLineString', function() {
var tmpObj;
let tmpObj;
beforeEach(function() {
tmpObj = mock(_ol_render_webgl_LineStringReplay_, 'drawLineString');
});
@@ -190,7 +190,7 @@ describe('ol.render.webgl.Immediate', function() {
});
describe('#drawMultiLineString', function() {
var tmpObj;
let tmpObj;
beforeEach(function() {
tmpObj = mock(_ol_render_webgl_LineStringReplay_, 'drawMultiLineString');
});
@@ -210,7 +210,7 @@ describe('ol.render.webgl.Immediate', function() {
});
describe('#drawPolygon', function() {
var tmpObj;
let tmpObj;
beforeEach(function() {
tmpObj = mock(_ol_render_webgl_PolygonReplay_, 'drawPolygon');
});
@@ -230,7 +230,7 @@ describe('ol.render.webgl.Immediate', function() {
});
describe('#drawMultiPolygon', function() {
var tmpObj;
let tmpObj;
beforeEach(function() {
tmpObj = mock(_ol_render_webgl_PolygonReplay_, 'drawMultiPolygon');
});
@@ -250,7 +250,7 @@ describe('ol.render.webgl.Immediate', function() {
});
describe('#drawCircle', function() {
var tmpObj;
let tmpObj;
beforeEach(function() {
tmpObj = mock(_ol_render_webgl_CircleReplay_, 'drawCircle');
});
+7 -7
View File
@@ -1,7 +1,7 @@
import _ol_render_webgl_Replay_ from '../../../../../src/ol/render/webgl/Replay.js';
describe('ol.render.Replay', function() {
var replay;
let replay;
beforeEach(function() {
replay = new _ol_render_webgl_Replay_(5, [-180, -90, 180, 90]);
});
@@ -15,8 +15,8 @@ describe('ol.render.Replay', function() {
});
it ('sets up the required matrices', function() {
var mat3 = [1, 0, 0, 1, 0, 0];
var mat4 = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
const mat3 = [1, 0, 0, 1, 0, 0];
const mat4 = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
expect(replay.projectionMatrix_).to.eql(mat3);
expect(replay.offsetRotateMatrix_).to.eql(mat3);
expect(replay.offsetScaleMatrix_).to.eql(mat3);
@@ -25,11 +25,11 @@ describe('ol.render.Replay', function() {
});
describe('#replay', function() {
var gl = {
const gl = {
uniformMatrix4fv: function() {},
uniform1f: function() {}
};
var context = {
const context = {
bindBuffer: function() {},
getGL: function() {
return gl;
@@ -47,9 +47,9 @@ describe('ol.render.Replay', function() {
});
it('calculates the correct matrices', function() {
var sin = Math.sin(Math.PI);
const sin = Math.sin(Math.PI);
replay.replay(context, [0, 0], 10, Math.PI, [10, 10], 1, 0, {}, undefined,
false, undefined);
false, undefined);
expect(replay.projectionMatrix_).to.eql([-0.02, -sin * 0.02, sin * 0.02,
-0.02, 0, 0]);
@@ -8,21 +8,21 @@ import _ol_render_webgl_linestringreplay_defaultshader_Locations_ from '../../..
import Stroke from '../../../../../src/ol/style/Stroke.js';
describe('ol.render.webgl.LineStringReplay', function() {
var replay;
let replay;
var strokeStyle1 = new Stroke({
const strokeStyle1 = new Stroke({
color: [0, 255, 0, 0.4]
});
var strokeStyle2 = new Stroke({
const strokeStyle2 = new Stroke({
color: [255, 0, 0, 1],
lineCap: 'square',
lineJoin: 'miter'
});
beforeEach(function() {
var tolerance = 0.1;
var maxExtent = [-10000, -20000, 10000, 20000];
const tolerance = 0.1;
const maxExtent = [-10000, -20000, 10000, 20000];
replay = new _ol_render_webgl_LineStringReplay_(tolerance, maxExtent);
});
@@ -54,10 +54,10 @@ describe('ol.render.webgl.LineStringReplay', function() {
describe('#drawLineString', function() {
it('sets the buffer data', function() {
var linestring;
let linestring;
linestring = new LineString(
[[1000, 2000], [2000, 3000]]);
[[1000, 2000], [2000, 3000]]);
replay.setFillStrokeStyle(null, strokeStyle1);
replay.drawLineString(linestring, null);
expect(replay.vertices).to.have.length(56);
@@ -67,7 +67,7 @@ describe('ol.render.webgl.LineStringReplay', function() {
expect(replay.startIndicesFeature).to.have.length(1);
linestring = new LineString(
[[1000, 3000], [2000, 4000], [3000, 3000]]);
[[1000, 3000], [2000, 4000], [3000, 3000]]);
replay.drawLineString(linestring, null);
expect(replay.vertices).to.have.length(140);
expect(replay.indices).to.have.length(48);
@@ -80,11 +80,9 @@ describe('ol.render.webgl.LineStringReplay', function() {
describe('#drawMultiLineString', function() {
it('sets the buffer data', function() {
var multilinestring;
multilinestring = new MultiLineString(
[[[1000, 2000], [2000, 3000]],
[[1000, 3000], [2000, 4000], [3000, 3000]]]);
const multilinestring = new MultiLineString(
[[[1000, 2000], [2000, 3000]],
[[1000, 3000], [2000, 4000], [3000, 3000]]]);
replay.setFillStrokeStyle(null, strokeStyle1);
replay.drawMultiLineString(multilinestring, null);
expect(replay.vertices).to.have.length(140);
@@ -98,119 +96,109 @@ describe('ol.render.webgl.LineStringReplay', function() {
describe('#drawCoordinates_', function() {
it('triangulates linestrings', function() {
var linestring;
var stroke = new Stroke({
const stroke = new Stroke({
color: [0, 255, 0, 1],
lineCap: 'butt',
lineJoin: 'bevel'
});
linestring = new LineString(
[[1000, 3000], [2000, 4000], [3000, 3000]]);
var flatCoordinates = linestring.getFlatCoordinates();
const linestring = new LineString(
[[1000, 3000], [2000, 4000], [3000, 3000]]);
const flatCoordinates = linestring.getFlatCoordinates();
replay.setFillStrokeStyle(null, stroke);
replay.drawCoordinates_(flatCoordinates, 0,
flatCoordinates.length, 2);
flatCoordinates.length, 2);
expect(replay.indices).to.eql(
[2, 0, 1, 4, 2, 1,
2, 4, 3,
5, 3, 4, 4, 6, 5]);
[2, 0, 1, 4, 2, 1,
2, 4, 3,
5, 3, 4, 4, 6, 5]);
});
it('optionally creates miters', function() {
var linestring;
var stroke = new Stroke({
const stroke = new Stroke({
color: [0, 255, 0, 1],
lineCap: 'butt'
});
linestring = new LineString(
[[1000, 3000], [2000, 4000], [3000, 3000]]);
var flatCoordinates = linestring.getFlatCoordinates();
const linestring = new LineString(
[[1000, 3000], [2000, 4000], [3000, 3000]]);
const flatCoordinates = linestring.getFlatCoordinates();
replay.setFillStrokeStyle(null, stroke);
replay.drawCoordinates_(flatCoordinates, 0,
flatCoordinates.length, 2);
flatCoordinates.length, 2);
expect(replay.indices).to.eql(
[2, 0, 1, 4, 2, 1,
2, 4, 3, 3, 5, 2,
6, 3, 4, 4, 7, 6]);
[2, 0, 1, 4, 2, 1,
2, 4, 3, 3, 5, 2,
6, 3, 4, 4, 7, 6]);
});
it('optionally creates caps', function() {
var linestring;
var stroke = new Stroke({
const stroke = new Stroke({
color: [0, 255, 0, 1]
});
linestring = new LineString(
[[1000, 3000], [2000, 4000], [3000, 3000]]);
var flatCoordinates = linestring.getFlatCoordinates();
const linestring = new LineString(
[[1000, 3000], [2000, 4000], [3000, 3000]]);
const flatCoordinates = linestring.getFlatCoordinates();
replay.setFillStrokeStyle(null, stroke);
replay.drawCoordinates_(flatCoordinates, 0,
flatCoordinates.length, 2);
flatCoordinates.length, 2);
expect(replay.indices).to.eql(
[2, 0, 1, 1, 3, 2,
4, 2, 3, 6, 4, 3,
4, 6, 5, 5, 7, 4,
8, 5, 6, 6, 9, 8,
10, 8, 9, 9, 11, 10]);
[2, 0, 1, 1, 3, 2,
4, 2, 3, 6, 4, 3,
4, 6, 5, 5, 7, 4,
8, 5, 6, 6, 9, 8,
10, 8, 9, 9, 11, 10]);
});
it('respects segment orientation', function() {
var linestring;
var stroke = new Stroke({
const stroke = new Stroke({
color: [0, 255, 0, 1],
lineCap: 'butt',
lineJoin: 'bevel'
});
linestring = new LineString(
[[1000, 3000], [2000, 2000], [3000, 3000]]);
var flatCoordinates = linestring.getFlatCoordinates();
const linestring = new LineString(
[[1000, 3000], [2000, 2000], [3000, 3000]]);
const flatCoordinates = linestring.getFlatCoordinates();
replay.setFillStrokeStyle(null, stroke);
replay.drawCoordinates_(flatCoordinates, 0,
flatCoordinates.length, 2);
flatCoordinates.length, 2);
expect(replay.indices).to.eql(
[2, 0, 1, 4, 2, 0,
2, 4, 3,
5, 3, 4, 4, 6, 5]);
[2, 0, 1, 4, 2, 0,
2, 4, 3,
5, 3, 4, 4, 6, 5]);
});
it('closes boundaries', function() {
var linestring;
var stroke = new Stroke({
const stroke = new Stroke({
color: [0, 255, 0, 1],
lineCap: 'butt',
lineJoin: 'bevel'
});
linestring = new LineString(
[[1000, 3000], [2000, 4000], [3000, 3000], [1000, 3000]]);
var flatCoordinates = linestring.getFlatCoordinates();
const linestring = new LineString(
[[1000, 3000], [2000, 4000], [3000, 3000], [1000, 3000]]);
const flatCoordinates = linestring.getFlatCoordinates();
replay.setFillStrokeStyle(null, stroke);
replay.drawCoordinates_(flatCoordinates, 0,
flatCoordinates.length, 2);
flatCoordinates.length, 2);
expect(replay.indices).to.eql(
[0, 2, 1, 3, 1, 2,
5, 3, 2,
3, 5, 4, 6, 4, 5,
8, 6, 5,
6, 8, 7, 9, 7, 8,
10, 9, 8]);
[0, 2, 1, 3, 1, 2,
5, 3, 2,
3, 5, 4, 6, 4, 5,
8, 6, 5,
6, 8, 7, 9, 7, 8,
10, 9, 8]);
expect(replay.vertices.slice(0, 7)).to.eql(
replay.vertices.slice(-14, -7));
replay.vertices.slice(-14, -7));
expect(replay.vertices.slice(14, 21)).to.eql(
replay.vertices.slice(-7));
replay.vertices.slice(-7));
});
});
describe('#setUpProgram', function() {
var context, gl;
let context, gl;
beforeEach(function() {
context = {
getProgram: function() {},
@@ -227,9 +215,9 @@ describe('ol.render.webgl.LineStringReplay', function() {
});
it('returns the locations used by the shaders', function() {
var locations = replay.setUpProgram(gl, context, [2, 2], 1);
const locations = replay.setUpProgram(gl, context, [2, 2], 1);
expect(locations).to.be.a(
_ol_render_webgl_linestringreplay_defaultshader_Locations_);
_ol_render_webgl_linestringreplay_defaultshader_Locations_);
});
it('gets and compiles the shaders', function() {
@@ -238,8 +226,8 @@ describe('ol.render.webgl.LineStringReplay', function() {
replay.setUpProgram(gl, context, [2, 2], 1);
expect(context.getProgram.calledWithExactly(
_ol_render_webgl_linestringreplay_defaultshader_.fragment,
_ol_render_webgl_linestringreplay_defaultshader_.vertex)).to.be(true);
_ol_render_webgl_linestringreplay_defaultshader_.fragment,
_ol_render_webgl_linestringreplay_defaultshader_.vertex)).to.be(true);
expect(context.useProgram.calledOnce).to.be(true);
});
@@ -251,12 +239,12 @@ describe('ol.render.webgl.LineStringReplay', function() {
replay.setUpProgram(gl, context, [2, 2], 1);
expect(gl.vertexAttribPointer.callCount).to.be(gl.getAttribLocation.callCount);
expect(gl.enableVertexAttribArray.callCount).to.be(
gl.getAttribLocation.callCount);
gl.getAttribLocation.callCount);
});
});
describe('#shutDownProgram', function() {
var context, gl;
let context, gl;
beforeEach(function() {
context = {
getProgram: function() {},
@@ -277,22 +265,22 @@ describe('ol.render.webgl.LineStringReplay', function() {
sinon.spy(gl, 'getAttribLocation');
sinon.spy(gl, 'disableVertexAttribArray');
var locations = replay.setUpProgram(gl, context, [2, 2], 1);
const locations = replay.setUpProgram(gl, context, [2, 2], 1);
replay.shutDownProgram(gl, locations);
expect(gl.disableVertexAttribArray.callCount).to.be(
gl.getAttribLocation.callCount);
gl.getAttribLocation.callCount);
});
});
describe('#drawReplay', function() {
var gl, context;
var feature1 = new Feature({
let gl, context;
const feature1 = new Feature({
geometry: new LineString([[0, 0], [500, 500]])
});
var feature2 = new Feature({
const feature2 = new Feature({
geometry: new LineString([[0, 0], [500, 500]])
});
var feature3 = new Feature({
const feature3 = new Feature({
geometry: new LineString([[0, 0], [500, 500]])
});
beforeEach(function() {
@@ -350,7 +338,7 @@ describe('ol.render.webgl.LineStringReplay', function() {
replay.setFillStrokeStyle(null, strokeStyle1);
replay.drawLineString(feature3.getGeometry(), feature3);
replay.startIndices.push(replay.indices.length);
var skippedFeatHash = {};
const skippedFeatHash = {};
skippedFeatHash[getUid(feature2).toString()] = true;
replay.drawReplay(gl, context, skippedFeatHash, false);
+61 -61
View File
@@ -11,18 +11,18 @@ import Fill from '../../../../../src/ol/style/Fill.js';
import Stroke from '../../../../../src/ol/style/Stroke.js';
describe('ol.render.webgl.PolygonReplay', function() {
var replay;
let replay;
var fillStyle = new Fill({
const fillStyle = new Fill({
color: [0, 0, 255, 0.5]
});
var strokeStyle = new Stroke({
const strokeStyle = new Stroke({
color: [0, 255, 0, 0.4]
});
beforeEach(function() {
var tolerance = 0.1;
var maxExtent = [-10000, -20000, 10000, 20000];
const tolerance = 0.1;
const maxExtent = [-10000, -20000, 10000, 20000];
replay = new _ol_render_webgl_PolygonReplay_(tolerance, maxExtent);
});
@@ -32,8 +32,8 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
it('sets the buffer data', function() {
var polygon1 = new Polygon(
[[[1000, 2000], [1200, 2000], [1200, 3000]]]
const polygon1 = new Polygon(
[[[1000, 2000], [1200, 2000], [1200, 3000]]]
);
replay.drawPolygon(polygon1, null);
expect(replay.vertices).to.have.length(8);
@@ -43,8 +43,8 @@ describe('ol.render.webgl.PolygonReplay', function() {
1000, 2000, 1200, 3000, 1200, 2000, 1000, 2000]);
expect(replay.indices).to.eql([2, 0, 1]);
var polygon2 = new Polygon(
[[[4000, 2000], [4200, 2000], [4200, 3000]]]
const polygon2 = new Polygon(
[[[4000, 2000], [4200, 2000], [4200, 3000]]]
);
replay.drawPolygon(polygon2, null);
expect(replay.vertices).to.have.length(16);
@@ -64,7 +64,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
it('sets the buffer data', function() {
var multiPolygon = new MultiPolygon([
const multiPolygon = new MultiPolygon([
[[[1000, 2000], [1200, 2000], [1200, 3000]]],
[[[4000, 2000], [4200, 2000], [4200, 3000]]]
]);
@@ -81,7 +81,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
describe('triangulating functions', function() {
var list, rtree;
let list, rtree;
beforeEach(function() {
list = new LinkedList();
rtree = new RBush();
@@ -89,7 +89,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
describe('#createPoint_', function() {
it('creates a WebGL polygon vertex', function() {
var p = replay.createPoint_(1, 1, 1);
const p = replay.createPoint_(1, 1, 1);
expect(p.x).to.be(1);
expect(p.y).to.be(1);
expect(p.i).to.be(1);
@@ -105,20 +105,20 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
describe('#insertItem_', function() {
var p0, p1;
let p0, p1;
beforeEach(function() {
p0 = replay.createPoint_(1, 1, 1);
p1 = replay.createPoint_(2, 2, 2);
});
it('creates a WebGL polygon segment', function() {
var seg = replay.insertItem_(p0, p1, list, rtree);
const seg = replay.insertItem_(p0, p1, list, rtree);
expect(seg.p0).to.be(p0);
expect(seg.p1).to.be(p1);
});
it('inserts the segment into the provided linked list', function() {
var seg = replay.insertItem_(p0, p1, list, rtree);
const seg = replay.insertItem_(p0, p1, list, rtree);
expect(list.head_.data).to.be(seg);
});
@@ -131,13 +131,13 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
describe('#removeItem_', function() {
var s0, s1;
let s0, s1;
beforeEach(function() {
var p = replay.createPoint_(2, 2, 2);
const p = replay.createPoint_(2, 2, 2);
s0 = replay.insertItem_(replay.createPoint_(1, 1, 1),
p, list, rtree);
p, list, rtree);
s1 = replay.insertItem_(p,
replay.createPoint_(5, 2, 3), list, rtree);
replay.createPoint_(5, 2, 3), list, rtree);
});
it('removes the current item', function() {
@@ -147,7 +147,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
it('updates the preceding segment', function() {
var dataExtent = rtree.getExtent();
const dataExtent = rtree.getExtent();
replay.removeItem_(s0, s1, list, rtree);
expect(s0.p1).to.be(s1.p1);
expect(rtree.getExtent()).to.eql(dataExtent);
@@ -155,7 +155,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
describe('#getPointsInTriangle_', function() {
var p0, p1, p2, p3;
let p0, p1, p2, p3;
beforeEach(function() {
p0 = replay.createPoint_(2, 0, 0);
p1 = replay.createPoint_(0, 5, 1);
@@ -169,20 +169,20 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
it('gets every point in a triangle', function() {
var points = replay.getPointsInTriangle_({x: -3, y: 6}, {x: 7, y: 6},
{x: 2, y: 2}, rtree);
const points = replay.getPointsInTriangle_({x: -3, y: 6}, {x: 7, y: 6},
{x: 2, y: 2}, rtree);
expect(points).to.eql([p1, p2, p3]);
});
it('gets only reflex points in a triangle', function() {
var points = replay.getPointsInTriangle_({x: -3, y: 6}, {x: 7, y: 6},
{x: 2, y: 2}, rtree, true);
const points = replay.getPointsInTriangle_({x: -3, y: 6}, {x: 7, y: 6},
{x: 2, y: 2}, rtree, true);
expect(points).to.eql([p2]);
});
});
describe('#getIntersections_', function() {
var p0, p1, p2, p3, s0, s1, s2, s3;
let p0, p1, p2, p3, s0, s1, s2, s3;
beforeEach(function() {
p0 = replay.createPoint_(2, 0, 0);
p1 = replay.createPoint_(0, 5, 1);
@@ -195,39 +195,39 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
it('gets intersecting, but non touching segments', function() {
var segments = replay.getIntersections_({p0: {x: 0, y: 3}, p1: {x: 4, y: 5}},
rtree);
const segments = replay.getIntersections_({p0: {x: 0, y: 3}, p1: {x: 4, y: 5}},
rtree);
expect(segments).to.eql([s0, s1]);
});
it('gets intersecting and touching segments', function() {
var segments = replay.getIntersections_({p0: {x: 0, y: 3}, p1: {x: 4, y: 5}},
rtree, true);
const segments = replay.getIntersections_({p0: {x: 0, y: 3}, p1: {x: 4, y: 5}},
rtree, true);
expect(segments).to.eql([s0, s1, s2, s3]);
});
});
describe('#calculateIntersection_', function() {
var p0 = {x: 0, y: 0};
var p1 = {x: 4, y: 4};
var p2 = {x: 0, y: 4};
var p3 = {x: 4, y: 0};
const p0 = {x: 0, y: 0};
const p1 = {x: 4, y: 4};
const p2 = {x: 0, y: 4};
const p3 = {x: 4, y: 0};
it('calculates the intersection point of two intersecting segments', function() {
var i = replay.calculateIntersection_(p0, p1, p2, p3);
var t = replay.calculateIntersection_(p0, p1, p1, p2);
const i = replay.calculateIntersection_(p0, p1, p2, p3);
const t = replay.calculateIntersection_(p0, p1, p1, p2);
expect(i).to.eql([2, 2]);
expect(t).to.be(undefined);
});
it('calculates the intersection point of two touching segments', function() {
var t = replay.calculateIntersection_(p0, p1, p1, p2, true);
const t = replay.calculateIntersection_(p0, p1, p1, p2, true);
expect(t).to.eql([4, 4]);
});
});
describe('#diagonalIsInside_', function() {
var p0, p1, p2, p3;
let p0, p1, p2, p3;
beforeEach(function() {
p0 = replay.createPoint_(2, 0, 0);
p1 = replay.createPoint_(0, 5, 1);
@@ -241,18 +241,18 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
it('identifies if diagonal is inside the polygon', function() {
var inside = replay.diagonalIsInside_(p1, p2, p3, p0, p1);
const inside = replay.diagonalIsInside_(p1, p2, p3, p0, p1);
expect(inside).to.be(true);
});
it('identifies if diagonal is outside the polygon', function() {
var inside = replay.diagonalIsInside_(p0, p1, p2, p3, p0);
const inside = replay.diagonalIsInside_(p0, p1, p2, p3, p0);
expect(inside).to.be(false);
});
});
describe('#classifyPoints_', function() {
var p0, p1, p2, p3;
let p0, p1, p2, p3;
beforeEach(function() {
p0 = replay.createPoint_(2, 0, 0);
p1 = replay.createPoint_(0, 5, 1);
@@ -289,7 +289,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
describe('#isSimple_', function() {
var p0, p1, p2, p3;
let p0, p1, p2, p3;
beforeEach(function() {
p0 = replay.createPoint_(2, 0, 0);
p1 = replay.createPoint_(0, 5, 1);
@@ -302,24 +302,24 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
it('identifies simple polygons', function() {
var simple = replay.isSimple_(list, rtree);
const simple = replay.isSimple_(list, rtree);
expect(simple).to.be(true);
});
it('identifies self-intersecting polygons', function() {
var p4 = replay.createPoint_(2, 5, 4);
var p5 = replay.createPoint_(4, 2, 5);
const p4 = replay.createPoint_(2, 5, 4);
const p5 = replay.createPoint_(4, 2, 5);
replay.insertItem_(p0, p4, list, rtree);
replay.insertItem_(p4, p5, list, rtree);
replay.insertItem_(p5, p0, list, rtree);
var simple = replay.isSimple_(list, rtree);
const simple = replay.isSimple_(list, rtree);
expect(simple).to.be(false);
});
});
});
describe('#setUpProgram', function() {
var context, gl;
let context, gl;
beforeEach(function() {
context = {
getProgram: function() {},
@@ -336,9 +336,9 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
it('returns the locations used by the shaders', function() {
var locations = replay.setUpProgram(gl, context, [2, 2], 1);
const locations = replay.setUpProgram(gl, context, [2, 2], 1);
expect(locations).to.be.a(
_ol_render_webgl_polygonreplay_defaultshader_Locations_);
_ol_render_webgl_polygonreplay_defaultshader_Locations_);
});
it('gets and compiles the shaders', function() {
@@ -347,8 +347,8 @@ describe('ol.render.webgl.PolygonReplay', function() {
replay.setUpProgram(gl, context, [2, 2], 1);
expect(context.getProgram.calledWithExactly(
_ol_render_webgl_polygonreplay_defaultshader_.fragment,
_ol_render_webgl_polygonreplay_defaultshader_.vertex)).to.be(true);
_ol_render_webgl_polygonreplay_defaultshader_.fragment,
_ol_render_webgl_polygonreplay_defaultshader_.vertex)).to.be(true);
expect(context.useProgram.calledOnce).to.be(true);
});
@@ -360,12 +360,12 @@ describe('ol.render.webgl.PolygonReplay', function() {
replay.setUpProgram(gl, context, [2, 2], 1);
expect(gl.vertexAttribPointer.callCount).to.be(gl.getAttribLocation.callCount);
expect(gl.enableVertexAttribArray.callCount).to.be(
gl.getAttribLocation.callCount);
gl.getAttribLocation.callCount);
});
});
describe('#shutDownProgram', function() {
var context, gl;
let context, gl;
beforeEach(function() {
context = {
getProgram: function() {},
@@ -386,22 +386,22 @@ describe('ol.render.webgl.PolygonReplay', function() {
sinon.spy(gl, 'getAttribLocation');
sinon.spy(gl, 'disableVertexAttribArray');
var locations = replay.setUpProgram(gl, context, [2, 2], 1);
const locations = replay.setUpProgram(gl, context, [2, 2], 1);
replay.shutDownProgram(gl, locations);
expect(gl.disableVertexAttribArray.callCount).to.be(
gl.getAttribLocation.callCount);
gl.getAttribLocation.callCount);
});
});
describe('#drawReplay', function() {
var gl, context;
var feature1 = new Feature({
let gl, context;
const feature1 = new Feature({
geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]])
});
var feature2 = new Feature({
const feature2 = new Feature({
geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]])
});
var feature3 = new Feature({
const feature3 = new Feature({
geometry: new Polygon([[[0, 0], [500, 500], [500, 0], [0, 0]]])
});
beforeEach(function() {
@@ -435,7 +435,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
});
it('draws the elements in batches if there are multiple fill styles', function() {
var fillStyle2 = new Fill({
const fillStyle2 = new Fill({
color: [0, 255, 0, 1]
});
replay.setFillStrokeStyle(fillStyle, strokeStyle);
@@ -459,7 +459,7 @@ describe('ol.render.webgl.PolygonReplay', function() {
replay.setFillStrokeStyle(fillStyle, strokeStyle);
replay.drawPolygon(feature3.getGeometry(), feature3);
replay.startIndices.push(replay.indices.length);
var skippedFeatHash = {};
const skippedFeatHash = {};
skippedFeatHash[getUid(feature2).toString()] = true;
replay.drawReplay(gl, context, skippedFeatHash, false);
+79 -80
View File
@@ -6,10 +6,10 @@ import Stroke from '../../../../../src/ol/style/Stroke.js';
import Text from '../../../../../src/ol/style/Text.js';
describe('ol.render.webgl.TextReplay', function() {
var replay;
let replay;
var createTextStyle = function(fillStyle, strokeStyle, text) {
var textStyle = new Text({
const createTextStyle = function(fillStyle, strokeStyle, text) {
const textStyle = new Text({
rotateWithView: true,
rotation: 1.5,
scale: 2,
@@ -26,50 +26,50 @@ describe('ol.render.webgl.TextReplay', function() {
};
beforeEach(function() {
var tolerance = 0.1;
var maxExtent = [-10000, -20000, 10000, 20000];
const tolerance = 0.1;
const maxExtent = [-10000, -20000, 10000, 20000];
replay = new _ol_render_webgl_TextReplay_(tolerance, maxExtent);
});
describe('#setTextStyle', function() {
var textStyle1, textStyle2, textStyle3, textStyle4;
let textStyle1, textStyle2, textStyle3, textStyle4;
beforeEach(function() {
textStyle1 = createTextStyle(
new Fill({
color: [0, 0, 0, 1]
}),
new Stroke({
width: 1,
color: [0, 0, 0, 1],
lineCap: 'butt',
lineJoin: 'bevel',
lineDash: [5, 5],
lineDashOffset: 15,
miterLimit: 2
}),
'someText');
new Fill({
color: [0, 0, 0, 1]
}),
new Stroke({
width: 1,
color: [0, 0, 0, 1],
lineCap: 'butt',
lineJoin: 'bevel',
lineDash: [5, 5],
lineDashOffset: 15,
miterLimit: 2
}),
'someText');
textStyle2 = createTextStyle(
new Fill({
color: [255, 255, 255, 1]
}),
new Stroke({
width: 1,
color: [255, 255, 255, 1]
}),
'someText'
new Fill({
color: [255, 255, 255, 1]
}),
new Stroke({
width: 1,
color: [255, 255, 255, 1]
}),
'someText'
);
textStyle3 = createTextStyle(null, null, 'someText');
textStyle4 = createTextStyle(
new Fill({
color: [0, 0, 0, 1]
}),
new Stroke({
width: 1,
color: [0, 0, 0, 1]
}),
''
new Fill({
color: [0, 0, 0, 1]
}),
new Stroke({
width: 1,
color: [0, 0, 0, 1]
}),
''
);
});
@@ -114,16 +114,16 @@ describe('ol.render.webgl.TextReplay', function() {
describe('#drawText', function() {
beforeEach(function() {
var textStyle = createTextStyle(
new Fill({
color: [0, 0, 0, 1]
}),
null, 'someText');
const textStyle = createTextStyle(
new Fill({
color: [0, 0, 0, 1]
}),
null, 'someText');
replay.setTextStyle(textStyle);
});
it('sets the buffer data', function() {
var point;
let point;
point = [1000, 2000];
replay.drawText(new Point(point), null);
@@ -137,15 +137,15 @@ describe('ol.render.webgl.TextReplay', function() {
});
it('sets part of its state during drawing', function() {
var point = [1000, 2000];
const point = [1000, 2000];
replay.drawText(new Point(point), null);
var height = replay.currAtlas_.height;
var widths = replay.currAtlas_.width;
var width = widths.t;
var widthX = widths.s + widths.o + widths.m + widths.e + widths.T +
const height = replay.currAtlas_.height;
const widths = replay.currAtlas_.width;
const width = widths.t;
const widthX = widths.s + widths.o + widths.m + widths.e + widths.T +
widths.e + widths.x;
var charInfo = replay.currAtlas_.atlas.getInfo('t');
const charInfo = replay.currAtlas_.atlas.getInfo('t');
expect(replay.height).to.be(height);
expect(replay.width).to.be(width);
@@ -159,9 +159,8 @@ describe('ol.render.webgl.TextReplay', function() {
it('does not draw if text is empty', function() {
replay.text_ = '';
var point;
point = [1000, 2000];
const point = [1000, 2000];
replay.drawText(new Point(point), null);
expect(replay.vertices).to.have.length(0);
expect(replay.indices).to.have.length(0);
@@ -170,17 +169,17 @@ describe('ol.render.webgl.TextReplay', function() {
describe('#addCharToAtlas_', function() {
beforeEach(function() {
var textStyle = createTextStyle(
new Fill({
color: [0, 0, 0, 1]
}),
null, 'someText');
const textStyle = createTextStyle(
new Fill({
color: [0, 0, 0, 1]
}),
null, 'someText');
replay.setTextStyle(textStyle);
});
it('adds a single character to the current atlas', function() {
var glyphAtlas = replay.currAtlas_.atlas;
var info;
const glyphAtlas = replay.currAtlas_.atlas;
let info;
replay.addCharToAtlas_('someText');
info = glyphAtlas.getInfo('someText');
@@ -195,7 +194,7 @@ describe('ol.render.webgl.TextReplay', function() {
});
it('keeps the atlas and the width dictionary synced', function() {
var glyphAtlas = replay.currAtlas_;
const glyphAtlas = replay.currAtlas_;
replay.addCharToAtlas_('e');
replay.addCharToAtlas_('x');
@@ -208,18 +207,18 @@ describe('ol.render.webgl.TextReplay', function() {
describe('#getTextSize_', function() {
beforeEach(function() {
var textStyle = createTextStyle(
new Fill({
color: [0, 0, 0, 1]
}),
null, 'someText');
const textStyle = createTextStyle(
new Fill({
color: [0, 0, 0, 1]
}),
null, 'someText');
textStyle.setScale(1);
replay.setTextStyle(textStyle);
});
it('adds missing characters to the current atlas', function() {
var glyphAtlas = replay.currAtlas_;
var info;
const glyphAtlas = replay.currAtlas_;
let info;
expect(Object.keys(glyphAtlas.width)).to.have.length(0);
replay.getTextSize_(['someText']);
@@ -241,12 +240,12 @@ describe('ol.render.webgl.TextReplay', function() {
});
it('returns the size of the label\'s bounding box in pixels', function() {
var size;
var mCtx = createCanvasContext2D(0, 0);
let size;
const mCtx = createCanvasContext2D(0, 0);
mCtx.font = '12px Arial';
var width = mCtx.measureText('someText').width;
var width2 = mCtx.measureText('anEvenLongerLine').width;
var height = Math.ceil(mCtx.measureText('M').width * 1.5);
const width = mCtx.measureText('someText').width;
const width2 = mCtx.measureText('anEvenLongerLine').width;
const height = Math.ceil(mCtx.measureText('M').width * 1.5);
size = replay.getTextSize_(['someText']);
expect(size[0]).to.be.within(width, width + 8);
@@ -260,17 +259,17 @@ describe('ol.render.webgl.TextReplay', function() {
describe('#getAtlas_', function() {
beforeEach(function() {
var textStyle = createTextStyle(
new Fill({
color: [0, 0, 0, 1]
}),
null, 'someText');
const textStyle = createTextStyle(
new Fill({
color: [0, 0, 0, 1]
}),
null, 'someText');
replay.setTextStyle(textStyle);
});
it('returns the appropriate atlas for the current state', function() {
var atlas = replay.currAtlas_;
var state = replay.state_;
const atlas = replay.currAtlas_;
const state = replay.state_;
expect(Object.keys(replay.atlases_)).to.have.length(1);
expect(replay.getAtlas_(state)).to.be(atlas);
@@ -278,8 +277,8 @@ describe('ol.render.webgl.TextReplay', function() {
});
it('creates a new atlas if it cannot find the one for the current state', function() {
var atlas = replay.currAtlas_;
var state = replay.state_;
const atlas = replay.currAtlas_;
const state = replay.state_;
state.lineWidth = 50;
expect(Object.keys(replay.atlases_)).to.have.length(1);
@@ -294,7 +293,7 @@ describe('ol.render.webgl.TextReplay', function() {
});
it('returns the textures', function() {
var textures = replay.getTextures();
const textures = replay.getTextures();
expect(textures).to.have.length(2);
expect(textures[0]).to.be(1);
@@ -309,7 +308,7 @@ describe('ol.render.webgl.TextReplay', function() {
});
it('returns the textures', function() {
var textures = replay.getHitDetectionTextures();
const textures = replay.getHitDetectionTextures();
expect(textures).to.have.length(2);
expect(textures[0]).to.be(1);
+12 -12
View File
@@ -3,16 +3,16 @@ import _ol_render_webgl_texturereplay_defaultshader_ from '../../../../../src/ol
import _ol_render_webgl_texturereplay_defaultshader_Locations_ from '../../../../../src/ol/render/webgl/texturereplay/defaultshader/Locations.js';
describe('ol.render.webgl.TextureReplay', function() {
var replay;
let replay;
beforeEach(function() {
var tolerance = 0.1;
var maxExtent = [-10000, -20000, 10000, 20000];
const tolerance = 0.1;
const maxExtent = [-10000, -20000, 10000, 20000];
replay = new _ol_render_webgl_TextureReplay_(tolerance, maxExtent);
});
describe('#setUpProgram', function() {
var context, gl;
let context, gl;
beforeEach(function() {
context = {
getProgram: function() {},
@@ -29,9 +29,9 @@ describe('ol.render.webgl.TextureReplay', function() {
});
it('returns the locations used by the shaders', function() {
var locations = replay.setUpProgram(gl, context, [2, 2], 1);
const locations = replay.setUpProgram(gl, context, [2, 2], 1);
expect(locations).to.be.a(
_ol_render_webgl_texturereplay_defaultshader_Locations_);
_ol_render_webgl_texturereplay_defaultshader_Locations_);
});
it('gets and compiles the shaders', function() {
@@ -40,8 +40,8 @@ describe('ol.render.webgl.TextureReplay', function() {
replay.setUpProgram(gl, context, [2, 2], 1);
expect(context.getProgram.calledWithExactly(
_ol_render_webgl_texturereplay_defaultshader_.fragment,
_ol_render_webgl_texturereplay_defaultshader_.vertex)).to.be(true);
_ol_render_webgl_texturereplay_defaultshader_.fragment,
_ol_render_webgl_texturereplay_defaultshader_.vertex)).to.be(true);
expect(context.useProgram.calledOnce).to.be(true);
});
@@ -53,12 +53,12 @@ describe('ol.render.webgl.TextureReplay', function() {
replay.setUpProgram(gl, context, [2, 2], 1);
expect(gl.vertexAttribPointer.callCount).to.be(gl.getAttribLocation.callCount);
expect(gl.enableVertexAttribArray.callCount).to.be(
gl.getAttribLocation.callCount);
gl.getAttribLocation.callCount);
});
});
describe('#shutDownProgram', function() {
var context, gl;
let context, gl;
beforeEach(function() {
context = {
getProgram: function() {},
@@ -79,10 +79,10 @@ describe('ol.render.webgl.TextureReplay', function() {
sinon.spy(gl, 'getAttribLocation');
sinon.spy(gl, 'disableVertexAttribArray');
var locations = replay.setUpProgram(gl, context, [2, 2], 1);
const locations = replay.setUpProgram(gl, context, [2, 2], 1);
replay.shutDownProgram(gl, locations);
expect(gl.disableVertexAttribArray.callCount).to.be(
gl.getAttribLocation.callCount);
gl.getAttribLocation.callCount);
});
});
});