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:
@@ -1,35 +1,35 @@
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
import Control from '../../../../src/ol/control/Control.js';
|
||||
import Map from '../../../../src/ol/Map.js';
|
||||
|
||||
describe('ol.control.Control', function() {
|
||||
describe('ol.control.Control', function () {
|
||||
let map, control;
|
||||
|
||||
beforeEach(function() {
|
||||
beforeEach(function () {
|
||||
map = new Map({
|
||||
target: document.createElement('div')
|
||||
target: document.createElement('div'),
|
||||
});
|
||||
const element = document.createElement('div');
|
||||
control = new Control({element: element});
|
||||
control.setMap(map);
|
||||
});
|
||||
|
||||
afterEach(function() {
|
||||
afterEach(function () {
|
||||
disposeMap(map);
|
||||
map = null;
|
||||
control = null;
|
||||
});
|
||||
|
||||
describe('dispose', function() {
|
||||
it('removes the control element from its parent', function() {
|
||||
describe('dispose', function () {
|
||||
it('removes the control element from its parent', function () {
|
||||
control.dispose();
|
||||
expect(control.element.parentNode).to.be(null);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('ol.control.Control\'s target', function() {
|
||||
describe('target as string or element', function() {
|
||||
it('transforms target from string to element', function() {
|
||||
describe("ol.control.Control's target", function () {
|
||||
describe('target as string or element', function () {
|
||||
it('transforms target from string to element', function () {
|
||||
const target = document.createElement('div');
|
||||
target.id = 'mycontrol';
|
||||
document.body.appendChild(target);
|
||||
@@ -38,7 +38,7 @@ describe('ol.control.Control\'s target', function() {
|
||||
ctrl.dispose();
|
||||
target.parentNode.removeChild(target);
|
||||
});
|
||||
it('accepts element for target', function() {
|
||||
it('accepts element for target', function () {
|
||||
const target = document.createElement('div');
|
||||
target.id = 'mycontrol';
|
||||
document.body.appendChild(target);
|
||||
@@ -47,7 +47,7 @@ describe('ol.control.Control\'s target', function() {
|
||||
ctrl.dispose();
|
||||
target.parentNode.removeChild(target);
|
||||
});
|
||||
it('ignores non-existing target id', function() {
|
||||
it('ignores non-existing target id', function () {
|
||||
const ctrl = new Control({target: 'doesnotexist'});
|
||||
expect(ctrl.target_).to.equal(null);
|
||||
ctrl.dispose();
|
||||
@@ -55,22 +55,22 @@ describe('ol.control.Control\'s target', function() {
|
||||
});
|
||||
});
|
||||
|
||||
describe('ol.control.Control\'s event target', function() {
|
||||
it('is the Control when the Control uses the default target', function(done) {
|
||||
describe("ol.control.Control's event target", function () {
|
||||
it('is the Control when the Control uses the default target', function (done) {
|
||||
const ctrl = new Control({element: document.createElement('div')});
|
||||
ctrl.on('test-event', function(e) {
|
||||
ctrl.on('test-event', function (e) {
|
||||
expect(e.target).to.be(ctrl);
|
||||
done();
|
||||
});
|
||||
ctrl.dispatchEvent('test-event');
|
||||
ctrl.dispose();
|
||||
});
|
||||
it('is the Control when the Control has a custom target', function(done) {
|
||||
it('is the Control when the Control has a custom target', function (done) {
|
||||
const ctrl = new Control({
|
||||
element: document.createElement('div'),
|
||||
target: document.createElement('div')
|
||||
target: document.createElement('div'),
|
||||
});
|
||||
ctrl.on('test-event', function(e) {
|
||||
ctrl.on('test-event', function (e) {
|
||||
expect(e.target).to.be(ctrl);
|
||||
done();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user