npm run format

This commit is contained in:
Abdón Rodríguez Davila
2020-04-07 11:43:16 +02:00
committed by Justin Fagnani
parent fae1b82b91
commit 4b231be37d
6 changed files with 39 additions and 31 deletions

View File

@@ -1,15 +1,15 @@
const syntaxHighlight = require("@11ty/eleventy-plugin-syntaxhighlight");
const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
module.exports = function (eleventyConfig) {
eleventyConfig.addPlugin(syntaxHighlight);
return {
dir: {
input: "docs-src",
output: "docs"
input: 'docs-src',
output: 'docs',
},
templateExtensionAliases: {
"11ty.cjs": "11ty.js",
"11tydata.cjs": "11tydata.js"
}
'11ty.cjs': '11ty.js',
'11tydata.cjs': '11tydata.js',
},
};
};

View File

@@ -9,17 +9,18 @@
"ecmaVersion": 2020,
"sourceType": "module"
},
"plugins": [
"@typescript-eslint"
],
"plugins": ["@typescript-eslint"],
"rules": {
"no-unexpected-multiline": "off",
"@typescript-eslint/indent": "off",
"@typescript-eslint/explicit-function-return-type": "off",
"@typescript-eslint/no-non-null-assertion": "off",
"@typescript-eslint/no-use-before-define": "off",
"@typescript-eslint/no-unused-vars": ["warn", {
"@typescript-eslint/no-unused-vars": [
"warn",
{
"argsIgnorePattern": "^_"
}]
}
]
}
}

View File

@@ -1,24 +1,24 @@
const {createDefaultConfig} = require('@open-wc/testing-karma');
const merge = require('deepmerge');
module.exports = config => {
module.exports = (config) => {
config.set(
merge(createDefaultConfig(config), {
frameworks: ['mocha', 'chai'],
client: {
mocha: {ui: 'tdd'}
mocha: {ui: 'tdd'},
},
files: [
{
pattern: config.grep ? config.grep : 'test/**/*_test.js',
type: 'module'
type: 'module',
},
],
// See the karma-esm docs for all options
esm: {
nodeResolve: true,
},
}),
})
);
return config;
};

View File

@@ -42,6 +42,6 @@ export default {
}),
filesize({
showBrotliSize: true,
})
]
}
}),
],
};

View File

@@ -4,7 +4,6 @@ import {fixture, html} from '@open-wc/testing';
const assert = chai.assert;
suite('my-element', () => {
test('is defined', () => {
const el = document.createElement('my-element');
assert.instanceOf(el, MyElement);
@@ -12,32 +11,40 @@ suite('my-element', () => {
test('renders with default values', async () => {
const el = await fixture(html`<my-element></my-element>`);
assert.shadowDom.equal(el, `
assert.shadowDom.equal(
el,
`
<h1>Hello, World!</h1>
<button part="button">Click Count: 0</button>
<slot></slot>
`);
`
);
});
test('renders with a set name', async () => {
const el = await fixture(html`<my-element name="Test"></my-element>`);
assert.shadowDom.equal(el, `
assert.shadowDom.equal(
el,
`
<h1>Hello, Test!</h1>
<button part="button">Click Count: 0</button>
<slot></slot>
`);
`
);
});
test('handles a click', async () => {
const el = await fixture(html`<my-element></my-element>`) as MyElement;
const el = (await fixture(html`<my-element></my-element>`)) as MyElement;
const button = el.shadowRoot!.querySelector('button')!;
button.click();
await el.updateComplete;
assert.shadowDom.equal(el, `
assert.shadowDom.equal(
el,
`
<h1>Hello, World!</h1>
<button part="button">Click Count: 1</button>
<slot></slot>
`);
`
);
});
});

View File

@@ -20,7 +20,7 @@
"plugins": [
{
"name": "ts-lit-plugin",
"strict": true,
"strict": true
}
]
},