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:
+42
-38
@@ -1,48 +1,54 @@
|
||||
import {getFontParameters} from '../../../src/ol/css.js';
|
||||
|
||||
describe('ol.css', function() {
|
||||
describe('ol.css', function () {
|
||||
describe('getFontParameters()', function () {
|
||||
const cases = [
|
||||
{
|
||||
font: '2em "Open Sans"',
|
||||
style: 'normal',
|
||||
weight: 'normal',
|
||||
families: ['"Open Sans"'],
|
||||
},
|
||||
{
|
||||
font: "2em 'Open Sans'",
|
||||
style: 'normal',
|
||||
weight: 'normal',
|
||||
families: ['"Open Sans"'],
|
||||
},
|
||||
{
|
||||
font: '2em "Open Sans", sans-serif',
|
||||
style: 'normal',
|
||||
weight: 'normal',
|
||||
families: ['"Open Sans"', 'sans-serif'],
|
||||
},
|
||||
{
|
||||
font: 'italic small-caps bolder 16px/3 cursive',
|
||||
style: 'italic',
|
||||
weight: 'bolder',
|
||||
families: ['cursive'],
|
||||
},
|
||||
{
|
||||
font: 'garbage 2px input',
|
||||
families: null,
|
||||
},
|
||||
{
|
||||
font: '100% fantasy',
|
||||
style: 'normal',
|
||||
weight: 'normal',
|
||||
families: ['fantasy'],
|
||||
},
|
||||
];
|
||||
|
||||
describe('getFontParameters()', function() {
|
||||
const cases = [{
|
||||
font: '2em "Open Sans"',
|
||||
style: 'normal',
|
||||
weight: 'normal',
|
||||
families: ['"Open Sans"']
|
||||
}, {
|
||||
font: '2em \'Open Sans\'',
|
||||
style: 'normal',
|
||||
weight: 'normal',
|
||||
families: ['"Open Sans"']
|
||||
}, {
|
||||
font: '2em "Open Sans", sans-serif',
|
||||
style: 'normal',
|
||||
weight: 'normal',
|
||||
families: ['"Open Sans"', 'sans-serif']
|
||||
}, {
|
||||
font: 'italic small-caps bolder 16px/3 cursive',
|
||||
style: 'italic',
|
||||
weight: 'bolder',
|
||||
families: ['cursive']
|
||||
}, {
|
||||
font: 'garbage 2px input',
|
||||
families: null
|
||||
}, {
|
||||
font: '100% fantasy',
|
||||
style: 'normal',
|
||||
weight: 'normal',
|
||||
families: ['fantasy']
|
||||
}];
|
||||
|
||||
cases.forEach(function(c, i) {
|
||||
it('works for ' + c.font, function() {
|
||||
cases.forEach(function (c, i) {
|
||||
it('works for ' + c.font, function () {
|
||||
const font = getFontParameters(c.font);
|
||||
if (c.families === null) {
|
||||
expect(font).to.be(null);
|
||||
return;
|
||||
}
|
||||
font.families.forEach(function(family, j) {
|
||||
font.families.forEach(function (family, j) {
|
||||
// Safari uses single quotes for font families, so we have to do extra work
|
||||
if (family.charAt(0) === '\'') {
|
||||
if (family.charAt(0) === "'") {
|
||||
// we wouldn't want to do this in the lib since it doesn't properly escape quotes
|
||||
// but we know that our test cases don't include quotes in font names
|
||||
font.families[j] = '"' + family.slice(1, -1) + '"';
|
||||
@@ -53,7 +59,5 @@ describe('ol.css', function() {
|
||||
expect(font.families).to.eql(c.families);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user