@blockquote/create-wc 1.40.0 → 1.50.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/common-repo/templates/package.json +3 -2
- package/src/common-testing-wtr/templates/static/web-test-runner.config.mjs +4 -0
- package/src/testing/templates/my-el.test.js +10 -8
- package/src/testing-ts/templates/my-el.test.ts +3 -5
- package/src/wc-lit-element/templates/MyEl.js +2 -2
- package/src/wc-lit-element/templates/tsconfig.json +30 -0
- package/src/wc-lit-element-ts/templates/tsconfig.json +12 -2
package/package.json
CHANGED
|
@@ -34,8 +34,9 @@
|
|
|
34
34
|
"@web/rollup-plugin-html": "^2.0.1",
|
|
35
35
|
"concurrently": "^8.2.1",
|
|
36
36
|
"rollup-plugin-copy": "^3.5.0",
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"sort-package-json": "^2.6.0",
|
|
38
|
+
"ts-lit-plugin": "^2.0.0-pre.1",
|
|
39
|
+
"vite": "^4.4.9"
|
|
39
40
|
},
|
|
40
41
|
"publishConfig": {
|
|
41
42
|
"access": "public"
|
|
@@ -29,9 +29,12 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
|
29
29
|
concurrency: 1,
|
|
30
30
|
|
|
31
31
|
reporters: [summaryReporter(), defaultReporter(), coverageTableReporter()],
|
|
32
|
+
|
|
33
|
+
preserveSymlinks: true,
|
|
32
34
|
|
|
33
35
|
coverage: true,
|
|
34
36
|
coverageConfig: {
|
|
37
|
+
// https://github.com/istanbuljs/v8-to-istanbul#ignoring-uncovered-lines
|
|
35
38
|
reportDir: `${outDir}/test/coverage`,
|
|
36
39
|
reporters: ['lcov', 'lcovonly', 'json'],
|
|
37
40
|
threshold: {
|
|
@@ -44,6 +47,7 @@ export default /** @type {import("@web/test-runner").TestRunnerConfig} */ ({
|
|
|
44
47
|
},
|
|
45
48
|
|
|
46
49
|
testFramework: {
|
|
50
|
+
// https://mochajs.org/api/mocha
|
|
47
51
|
config: {
|
|
48
52
|
ui: 'tdd',
|
|
49
53
|
timeout: 4000
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { html, fixture, assert, fixtureCleanup } from '@open-wc/testing';
|
|
2
|
-
|
|
1
|
+
import { html, fixture, assert, expect, fixtureCleanup } from '@open-wc/testing';
|
|
3
2
|
import '../define/<%= tagName %>.js';
|
|
4
3
|
|
|
5
4
|
suite('<%= className %>', () => {
|
|
5
|
+
/**
|
|
6
|
+
* @type {import('../index').<%= className %>}
|
|
7
|
+
*/
|
|
6
8
|
let el;
|
|
7
9
|
|
|
8
10
|
teardown(() => fixtureCleanup());
|
|
9
11
|
|
|
10
12
|
suite('Default', () => {
|
|
11
13
|
setup(async () => {
|
|
12
|
-
el = await fixture(html
|
|
14
|
+
el = await fixture(html`<<%= tagName %>>light-dom</<%= tagName %>>`);
|
|
13
15
|
await el.updateComplete;
|
|
14
16
|
});
|
|
15
17
|
|
|
@@ -20,11 +22,11 @@ suite('<%= className %>', () => {
|
|
|
20
22
|
|
|
21
23
|
suite('Semantic Dom and a11y', () => {
|
|
22
24
|
test('SHADOW DOM - Structure test', async () => {
|
|
23
|
-
await
|
|
25
|
+
await expect(el).shadowDom.to.equalSnapshot();
|
|
24
26
|
});
|
|
25
27
|
|
|
26
28
|
test('LIGHT DOM - Structure test', async () => {
|
|
27
|
-
await
|
|
29
|
+
await expect(el).lightDom.to.equalSnapshot();
|
|
28
30
|
});
|
|
29
31
|
test('a11y', async () => {
|
|
30
32
|
await assert.isAccessible(el);
|
|
@@ -34,19 +36,19 @@ suite('<%= className %>', () => {
|
|
|
34
36
|
|
|
35
37
|
suite('Events ', () => {
|
|
36
38
|
setup(async () => {
|
|
37
|
-
el = await fixture(html
|
|
39
|
+
el = await fixture(html`<<%= tagName %>></<%= tagName %>>`);
|
|
38
40
|
await el.updateComplete;
|
|
39
41
|
});
|
|
40
42
|
|
|
41
43
|
test('increases the counter on button click', () => {
|
|
42
|
-
el.shadowRoot
|
|
44
|
+
el.shadowRoot?.querySelector('button')?.click();
|
|
43
45
|
assert.equal(el.counter, 6);
|
|
44
46
|
});
|
|
45
47
|
});
|
|
46
48
|
|
|
47
49
|
suite('Override ', () => {
|
|
48
50
|
setup(async () => {
|
|
49
|
-
el = await fixture(html
|
|
51
|
+
el = await fixture(html`<<%= tagName %> heading="attribute heading"></<%= tagName %>>`);
|
|
50
52
|
await el.updateComplete;
|
|
51
53
|
});
|
|
52
54
|
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { html, fixture, assert, fixtureCleanup } from '@open-wc/testing';
|
|
2
|
-
|
|
3
2
|
import { <%= className %> } from '../src/<%= className %>.js';
|
|
4
|
-
|
|
5
3
|
import '../define/<%= tagName %>.js';
|
|
6
4
|
|
|
7
5
|
suite('<%= className %>', () => {
|
|
@@ -11,7 +9,7 @@ suite('<%= className %>', () => {
|
|
|
11
9
|
|
|
12
10
|
suite('Default', () => {
|
|
13
11
|
setup(async () => {
|
|
14
|
-
el = (await fixture(html
|
|
12
|
+
el = (await fixture(html`<<%= tagName %>>light-dom</<%= tagName %>>`));
|
|
15
13
|
await el.updateComplete;
|
|
16
14
|
});
|
|
17
15
|
|
|
@@ -36,7 +34,7 @@ suite('<%= className %>', () => {
|
|
|
36
34
|
|
|
37
35
|
suite('Events ', () => {
|
|
38
36
|
setup(async () => {
|
|
39
|
-
el = (await fixture(html
|
|
37
|
+
el = (await fixture(html`<<%= tagName %>></<%= tagName %>>`));
|
|
40
38
|
await el.updateComplete;
|
|
41
39
|
});
|
|
42
40
|
|
|
@@ -50,7 +48,7 @@ suite('<%= className %>', () => {
|
|
|
50
48
|
suite('Override ', () => {
|
|
51
49
|
setup(async () => {
|
|
52
50
|
el = (await fixture(
|
|
53
|
-
html
|
|
51
|
+
html`<<%= tagName %> heading="attribute heading"></<%= tagName %>>`));
|
|
54
52
|
await el.updateComplete;
|
|
55
53
|
});
|
|
56
54
|
|
|
@@ -7,6 +7,8 @@ import { styles } from './styles/<%= tagName %>-styles.css.js';
|
|
|
7
7
|
* ## `<<%= tagName %>>`
|
|
8
8
|
* An example element.
|
|
9
9
|
*
|
|
10
|
+
* @attr heading
|
|
11
|
+
* @attr counter
|
|
10
12
|
* @fires counterchange - Indicates when the count changes
|
|
11
13
|
* @slot - This element has a slot
|
|
12
14
|
*/
|
|
@@ -16,13 +18,11 @@ export class <%= className %> extends LitElement {
|
|
|
16
18
|
static properties = {
|
|
17
19
|
/**
|
|
18
20
|
* The heading to say "Hello" to.
|
|
19
|
-
* @type {string}
|
|
20
21
|
*/
|
|
21
22
|
heading: { type: String },
|
|
22
23
|
|
|
23
24
|
/**
|
|
24
25
|
* The number of times the button has been clicked.
|
|
25
|
-
* @type {number}
|
|
26
26
|
*/
|
|
27
27
|
counter: { type: Number },
|
|
28
28
|
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "es2021",
|
|
4
|
+
"lib": ["es2021", "DOM", "DOM.Iterable"],
|
|
5
|
+
"module": "es2020",
|
|
6
|
+
"moduleResolution": "node",
|
|
7
|
+
"allowJs": true,
|
|
8
|
+
"declaration": true,
|
|
9
|
+
"emitDeclarationOnly": true,
|
|
10
|
+
"noEmit": false,
|
|
11
|
+
"checkJs": true,
|
|
12
|
+
"strict": false,
|
|
13
|
+
"noImplicitThis": true,
|
|
14
|
+
"alwaysStrict": true,
|
|
15
|
+
"outDir": "./types",
|
|
16
|
+
"allowSyntheticDefaultImports": true,
|
|
17
|
+
"plugins": [
|
|
18
|
+
{
|
|
19
|
+
"name": "ts-lit-plugin",
|
|
20
|
+
"rules": {
|
|
21
|
+
"no-unknown-slot": "warning",
|
|
22
|
+
"no-unknown-attribute": "warning",
|
|
23
|
+
"no-unknown-property": "warning",
|
|
24
|
+
"no-unknown-event": "warning"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"include": ["src/**/*.js"]
|
|
30
|
+
}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"lib": ["es2021", "DOM", "DOM.Iterable"],
|
|
5
5
|
"experimentalDecorators": true,
|
|
6
6
|
"module": "es2020",
|
|
7
|
-
"moduleResolution": "
|
|
7
|
+
"moduleResolution": "node",
|
|
8
8
|
"rootDirs": ["./src", "./define", ".test/"],
|
|
9
9
|
"resolveJsonModule": true,
|
|
10
10
|
"declaration": true,
|
|
@@ -23,7 +23,17 @@
|
|
|
23
23
|
"noImplicitReturns": true,
|
|
24
24
|
"noFallthroughCasesInSwitch": true,
|
|
25
25
|
"noImplicitOverride": true,
|
|
26
|
-
"
|
|
26
|
+
"plugins": [
|
|
27
|
+
{
|
|
28
|
+
"name": "ts-lit-plugin",
|
|
29
|
+
"rules": {
|
|
30
|
+
"no-unknown-slot": "warning",
|
|
31
|
+
"no-unknown-attribute": "warning",
|
|
32
|
+
"no-unknown-property": "warning",
|
|
33
|
+
"no-unknown-event": "warning"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
]
|
|
27
37
|
},
|
|
28
38
|
"include": ["src/**/*.ts", "define/**/*.ts", "test/**/*.ts", "./index.ts", "types/**/*.d.ts"]
|
|
29
39
|
}
|