Make code prettier
This updates ESLint and our shared eslint-config-openlayers to use Prettier. Most formatting changes were automatically applied with this:
npm run lint -- --fix
A few manual changes were required:
* In `examples/offscreen-canvas.js`, the `//eslint-disable-line` comment needed to be moved to the appropriate line to disable the error about the `'worker-loader!./offscreen-canvas.worker.js'` import.
* In `examples/webpack/exapmle-builder.js`, spaces could not be added after a couple `function`s for some reason. While editing this, I reworked `ExampleBuilder` to be a class.
* In `src/ol/format/WMSGetFeatureInfo.js`, the `// @ts-ignore` comment needed to be moved down one line so it applied to the `parsersNS` argument.
This commit is contained in:
@@ -2,14 +2,13 @@ import Map from '../../../src/ol/Map.js';
|
||||
import Overlay from '../../../src/ol/Overlay.js';
|
||||
import View from '../../../src/ol/View.js';
|
||||
|
||||
|
||||
describe('ol.Overlay', function() {
|
||||
describe('ol.Overlay', function () {
|
||||
let target, map;
|
||||
|
||||
const width = 360;
|
||||
const height = 180;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
target = document.createElement('div');
|
||||
|
||||
const style = target.style;
|
||||
@@ -25,45 +24,43 @@ describe('ol.Overlay', function() {
|
||||
view: new View({
|
||||
projection: 'EPSG:4326',
|
||||
center: [0, 0],
|
||||
resolution: 1
|
||||
})
|
||||
resolution: 1,
|
||||
}),
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
map.dispose();
|
||||
document.body.removeChild(target);
|
||||
});
|
||||
|
||||
describe('constructor', function() {
|
||||
|
||||
it('can be constructed with minimal arguments', function() {
|
||||
describe('constructor', function () {
|
||||
it('can be constructed with minimal arguments', function () {
|
||||
const instance = new Overlay({});
|
||||
expect(instance).to.be.an(Overlay);
|
||||
});
|
||||
|
||||
it('can be constructed with className', function() {
|
||||
it('can be constructed with className', function () {
|
||||
const instance = new Overlay({className: 'my-class'});
|
||||
expect(instance).to.be.an(Overlay);
|
||||
expect(instance.element.className).to.be('my-class');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#getId()', function() {
|
||||
describe('#getId()', function () {
|
||||
let overlay, target;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
target = document.createElement('div');
|
||||
});
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
map.removeOverlay(overlay);
|
||||
});
|
||||
|
||||
it('returns the overlay identifier', function() {
|
||||
it('returns the overlay identifier', function () {
|
||||
overlay = new Overlay({
|
||||
element: target,
|
||||
position: [0, 0]
|
||||
position: [0, 0],
|
||||
});
|
||||
map.addOverlay(overlay);
|
||||
expect(overlay.getId()).to.be(undefined);
|
||||
@@ -71,28 +68,27 @@ describe('ol.Overlay', function() {
|
||||
overlay = new Overlay({
|
||||
id: 'foo',
|
||||
element: target,
|
||||
position: [0, 0]
|
||||
position: [0, 0],
|
||||
});
|
||||
map.addOverlay(overlay);
|
||||
expect(overlay.getId()).to.be('foo');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#setVisible()', function() {
|
||||
describe('#setVisible()', function () {
|
||||
let overlay, target;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
target = document.createElement('div');
|
||||
});
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
map.removeOverlay(overlay);
|
||||
});
|
||||
|
||||
it('changes the CSS display value', function() {
|
||||
it('changes the CSS display value', function () {
|
||||
overlay = new Overlay({
|
||||
element: target,
|
||||
position: [0, 0]
|
||||
position: [0, 0],
|
||||
});
|
||||
map.addOverlay(overlay);
|
||||
map.renderSync();
|
||||
@@ -100,7 +96,5 @@ describe('ol.Overlay', function() {
|
||||
overlay.setVisible(false);
|
||||
expect(overlay.element.style.display).to.be('none');
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user