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,41 +2,36 @@ import Fill from '../../../../src/ol/style/Fill.js';
|
||||
import Stroke from '../../../../src/ol/style/Stroke.js';
|
||||
import Text from '../../../../src/ol/style/Text.js';
|
||||
|
||||
|
||||
describe('ol.style.Text', function() {
|
||||
|
||||
describe('#constructor', function() {
|
||||
|
||||
it('uses a default fill style if none passed', function() {
|
||||
describe('ol.style.Text', function () {
|
||||
describe('#constructor', function () {
|
||||
it('uses a default fill style if none passed', function () {
|
||||
const style = new Text();
|
||||
expect(style.getFill().getColor()).to.be('#333');
|
||||
});
|
||||
|
||||
it('uses a provided fill style if one passed', function() {
|
||||
it('uses a provided fill style if one passed', function () {
|
||||
const style = new Text({
|
||||
fill: new Fill({color: '#123456'})
|
||||
fill: new Fill({color: '#123456'}),
|
||||
});
|
||||
expect(style.getFill().getColor()).to.be('#123456');
|
||||
});
|
||||
|
||||
it('can always be resetted to no color', function() {
|
||||
it('can always be resetted to no color', function () {
|
||||
const style = new Text();
|
||||
style.getFill().setColor();
|
||||
expect(style.getFill().getColor()).to.be(undefined);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#clone', function() {
|
||||
|
||||
it('creates a new ol.style.Text', function() {
|
||||
describe('#clone', function () {
|
||||
it('creates a new ol.style.Text', function () {
|
||||
const original = new Text();
|
||||
const clone = original.clone();
|
||||
expect(clone).to.be.an(Text);
|
||||
expect(clone).to.not.be(original);
|
||||
});
|
||||
|
||||
it('copies all values', function() {
|
||||
it('copies all values', function () {
|
||||
const original = new Text({
|
||||
font: '12px serif',
|
||||
offsetX: 4,
|
||||
@@ -48,18 +43,18 @@ describe('ol.style.Text', function() {
|
||||
textAlign: 'center',
|
||||
textBaseline: 'top',
|
||||
fill: new Fill({
|
||||
color: '#319FD3'
|
||||
color: '#319FD3',
|
||||
}),
|
||||
stroke: new Stroke({
|
||||
color: '#319FD3'
|
||||
color: '#319FD3',
|
||||
}),
|
||||
backgroundFill: new Fill({
|
||||
color: 'white'
|
||||
color: 'white',
|
||||
}),
|
||||
backgroundStroke: new Stroke({
|
||||
color: 'black'
|
||||
color: 'black',
|
||||
}),
|
||||
padding: [10, 11, 12, 13]
|
||||
padding: [10, 11, 12, 13],
|
||||
});
|
||||
const clone = original.clone();
|
||||
expect(original.getFont()).to.eql(clone.getFont());
|
||||
@@ -71,21 +66,27 @@ describe('ol.style.Text', function() {
|
||||
expect(original.getText()).to.eql(clone.getText());
|
||||
expect(original.getTextAlign()).to.eql(clone.getTextAlign());
|
||||
expect(original.getTextBaseline()).to.eql(clone.getTextBaseline());
|
||||
expect(original.getStroke().getColor()).to.eql(clone.getStroke().getColor());
|
||||
expect(original.getStroke().getColor()).to.eql(
|
||||
clone.getStroke().getColor()
|
||||
);
|
||||
expect(original.getFill().getColor()).to.eql(clone.getFill().getColor());
|
||||
expect(original.getBackgroundStroke().getColor()).to.eql(clone.getBackgroundStroke().getColor());
|
||||
expect(original.getBackgroundFill().getColor()).to.eql(clone.getBackgroundFill().getColor());
|
||||
expect(original.getBackgroundStroke().getColor()).to.eql(
|
||||
clone.getBackgroundStroke().getColor()
|
||||
);
|
||||
expect(original.getBackgroundFill().getColor()).to.eql(
|
||||
clone.getBackgroundFill().getColor()
|
||||
);
|
||||
expect(original.getPadding()).to.eql(clone.getPadding());
|
||||
});
|
||||
|
||||
it('the clone does not reference the same objects as the original', function() {
|
||||
it('the clone does not reference the same objects as the original', function () {
|
||||
const original = new Text({
|
||||
fill: new Fill({
|
||||
color: '#319FD3'
|
||||
color: '#319FD3',
|
||||
}),
|
||||
stroke: new Stroke({
|
||||
color: '#319FD3'
|
||||
})
|
||||
color: '#319FD3',
|
||||
}),
|
||||
});
|
||||
const clone = original.clone();
|
||||
expect(original.getFill()).to.not.be(clone.getFill());
|
||||
@@ -93,19 +94,21 @@ describe('ol.style.Text', function() {
|
||||
|
||||
clone.getFill().setColor('#012345');
|
||||
clone.getStroke().setColor('#012345');
|
||||
expect(original.getFill().getColor()).to.not.eql(clone.getFill().getColor());
|
||||
expect(original.getStroke().getColor()).to.not.eql(clone.getStroke().getColor());
|
||||
expect(original.getFill().getColor()).to.not.eql(
|
||||
clone.getFill().getColor()
|
||||
);
|
||||
expect(original.getStroke().getColor()).to.not.eql(
|
||||
clone.getStroke().getColor()
|
||||
);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('#setRotateWithView', function() {
|
||||
it('sets the rotateWithView property', function() {
|
||||
describe('#setRotateWithView', function () {
|
||||
it('sets the rotateWithView property', function () {
|
||||
const textStyle = new Text();
|
||||
expect(textStyle.getRotateWithView()).to.eql(undefined);
|
||||
textStyle.setRotateWithView(true);
|
||||
expect(textStyle.getRotateWithView()).to.eql(true);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user