@blockquote/create-wc 2.5.1 → 2.6.1
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 +5 -5
- package/src/app/index.js +0 -2
- package/src/common-linting/templates/package.json +2 -1
- package/src/common-repo/templates/eslint.config.js +1 -1
- package/src/common-repo/templates/package.json +6 -6
- package/src/common-repo/templates/static/vite.config.js +7 -9
- package/src/create.js +0 -2
- package/src/testing/index.js +0 -1
- package/src/testing/templates/my-el.test.js +24 -37
- package/src/testing-ts/index.js +0 -1
- package/src/testing-ts/templates/my-el.test.ts +24 -38
- package/src/wc-lit-element/index.js +0 -2
- package/src/wc-lit-element-ts/index.js +0 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockquote/create-wc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.6.1",
|
|
4
4
|
"description": "Web component with Lit scaffolding - Extending Open Web Component",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Lit",
|
|
@@ -53,15 +53,15 @@
|
|
|
53
53
|
"semver": "^7.7.3"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@eslint/
|
|
57
|
-
"eslint-plugin-html": "^8.1.3",
|
|
56
|
+
"@eslint/js": "^9.38.0",
|
|
58
57
|
"@open-wc/eslint-config": "^13.0.0",
|
|
59
58
|
"eslint": "^9.38.0",
|
|
60
59
|
"eslint-config-prettier": "^10.1.8",
|
|
61
|
-
"prettier": "^3.6.2"
|
|
60
|
+
"prettier": "^3.6.2",
|
|
61
|
+
"globals": "^16.4.0"
|
|
62
62
|
},
|
|
63
63
|
"engines": {
|
|
64
|
-
"node": ">=
|
|
64
|
+
"node": ">=18.20.3"
|
|
65
65
|
},
|
|
66
66
|
"publishConfig": {
|
|
67
67
|
"access": "public"
|
package/src/app/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
1
|
import prompts from 'prompts';
|
|
3
2
|
// import commandLineArgs from 'command-line-args';
|
|
4
3
|
import {executeMixinGenerator} from '@open-wc/create/dist/core.js';
|
|
@@ -8,7 +7,6 @@ import {gatherMixins} from './gatherMixins.js';
|
|
|
8
7
|
import Generator from '../Generator.js';
|
|
9
8
|
|
|
10
9
|
export const AppMixin = (subclass) =>
|
|
11
|
-
// eslint-disable-next-line no-shadow
|
|
12
10
|
class AppMixin extends subclass {
|
|
13
11
|
constructor() {
|
|
14
12
|
super();
|
|
@@ -68,6 +68,7 @@
|
|
|
68
68
|
]
|
|
69
69
|
},
|
|
70
70
|
"devDependencies": {
|
|
71
|
+
"@eslint/js": "^9.38.0",
|
|
71
72
|
"@html-eslint/eslint-plugin": "^0.47.0",
|
|
72
73
|
"@html-eslint/parser": "^0.47.0",
|
|
73
74
|
"eslint": "^9.38.0",
|
|
@@ -81,7 +82,7 @@
|
|
|
81
82
|
"typescript-eslint": "^8.46.2",
|
|
82
83
|
"globals": "^16.4.0",
|
|
83
84
|
"husky": "^9.1.7",
|
|
84
|
-
"lint-staged": "^16.2.
|
|
85
|
+
"lint-staged": "^16.2.6",
|
|
85
86
|
"prettier": "^3.6.2",
|
|
86
87
|
"stylelint": "^16.25.0",
|
|
87
88
|
"stylelint-config-standard-scss": "^16.0.0"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import js from '@eslint/js';
|
|
2
2
|
import {configs as wc} from 'eslint-plugin-wc';
|
|
3
3
|
import {configs as lit} from 'eslint-plugin-lit';
|
|
4
|
-
import litA11y from 'eslint-plugin-lit-a11y';
|
|
4
|
+
import {default as litA11y} from 'eslint-plugin-lit-a11y';
|
|
5
5
|
import {flatConfigs as importPlugin} from 'eslint-plugin-import';
|
|
6
6
|
import tseslint from 'typescript-eslint';
|
|
7
7
|
import tsParser from '@typescript-eslint/parser';
|
|
@@ -43,12 +43,12 @@
|
|
|
43
43
|
"chai-a11y-axe": "^1.5.0",
|
|
44
44
|
"concurrently": "^9.2.1",
|
|
45
45
|
"sort-package-json": "^3.4.0",
|
|
46
|
-
"@vitest/browser": "^
|
|
47
|
-
"@vitest/coverage-istanbul": "^
|
|
48
|
-
"@vitest/coverage-v8": "^
|
|
49
|
-
"@vitest/ui": "^
|
|
50
|
-
"vitest": "^
|
|
51
|
-
"vite": "^7.1.
|
|
46
|
+
"@vitest/browser-playwright": "^4.0.3",
|
|
47
|
+
"@vitest/coverage-istanbul": "^4.0.3",
|
|
48
|
+
"@vitest/coverage-v8": "^4.0.3",
|
|
49
|
+
"@vitest/ui": "^4.0.3",
|
|
50
|
+
"vitest": "^4.0.3",
|
|
51
|
+
"vite": "^7.1.12"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public"
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {defineConfig} from 'vite';
|
|
2
|
+
import {playwright} from '@vitest/browser-playwright';
|
|
2
3
|
import {globSync} from 'tinyglobby';
|
|
3
4
|
import copy from 'rollup-plugin-copy';
|
|
4
5
|
import totalBundlesize from '@blockquote/rollup-plugin-total-bundlesize';
|
|
@@ -39,22 +40,19 @@ export default defineConfig({
|
|
|
39
40
|
browser: {
|
|
40
41
|
enabled: true,
|
|
41
42
|
headless: false,
|
|
42
|
-
provider:
|
|
43
|
+
provider: playwright({
|
|
44
|
+
launchOptions: {
|
|
45
|
+
devtools: true,
|
|
46
|
+
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-gpu'],
|
|
47
|
+
},
|
|
48
|
+
}),
|
|
43
49
|
screenshotFailures: false,
|
|
44
|
-
viewport: {width: 1920, height: 1080},
|
|
45
50
|
instances: [
|
|
46
51
|
{
|
|
47
52
|
browser: 'chromium',
|
|
48
|
-
launch: {
|
|
49
|
-
devtools: true,
|
|
50
|
-
args: ['--no-sandbox', '--disable-setuid-sandbox', '--disable-gpu'],
|
|
51
|
-
},
|
|
52
|
-
context: {},
|
|
53
53
|
},
|
|
54
54
|
{
|
|
55
55
|
browser: 'webkit',
|
|
56
|
-
launch: {},
|
|
57
|
-
context: {},
|
|
58
56
|
},
|
|
59
57
|
],
|
|
60
58
|
},
|
package/src/create.js
CHANGED
package/src/testing/index.js
CHANGED
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
test,
|
|
4
|
-
assert,
|
|
5
|
-
expect,
|
|
6
|
-
beforeAll,
|
|
7
|
-
afterAll,
|
|
8
|
-
beforeEach,
|
|
9
|
-
afterEach,
|
|
10
|
-
vi,
|
|
11
|
-
chai,
|
|
12
|
-
} from 'vitest';
|
|
13
|
-
import {getElementLocatorSelectors} from '@vitest/browser/utils';
|
|
14
|
-
import {html} from 'lit';
|
|
15
|
-
import {chaiA11yAxe} from 'chai-a11y-axe';
|
|
1
|
+
import {describe, it, expect, beforeAll, afterAll, beforeEach, afterEach, vi, chai} from 'vitest';
|
|
2
|
+
import {utils} from 'vitest/browser';
|
|
16
3
|
import {fixture, fixtureCleanup} from '@open-wc/testing-helpers';
|
|
4
|
+
import {chaiA11yAxe} from 'chai-a11y-axe';
|
|
17
5
|
import {getDiffableHTML} from '@open-wc/semantic-dom-diff/get-diffable-html.js';
|
|
6
|
+
import {html} from 'lit';
|
|
18
7
|
import '../src/define/<%= tagName %>.js';
|
|
19
8
|
|
|
20
9
|
chai.use(chaiA11yAxe);
|
|
21
10
|
|
|
22
|
-
|
|
11
|
+
describe('<%= className %>', () => {
|
|
23
12
|
/**
|
|
24
13
|
* @type {import('../src/index').<%= className %>}
|
|
25
14
|
*/
|
|
@@ -27,77 +16,75 @@ suite('<%= className %>', () => {
|
|
|
27
16
|
let elShadowRoot;
|
|
28
17
|
let elLocator;
|
|
29
18
|
|
|
30
|
-
|
|
19
|
+
describe('Semantic Dom and a11y', () => {
|
|
31
20
|
beforeAll(async () => {
|
|
32
21
|
el = await fixture(html`<<%= tagName %>>light-dom</<%= tagName %>>`);
|
|
33
22
|
elShadowRoot = el?.shadowRoot?.innerHTML;
|
|
34
|
-
elLocator = getElementLocatorSelectors(el);
|
|
23
|
+
elLocator = utils.getElementLocatorSelectors(el);
|
|
35
24
|
});
|
|
36
25
|
|
|
37
26
|
afterAll(() => {
|
|
38
27
|
fixtureCleanup();
|
|
39
28
|
});
|
|
40
29
|
|
|
41
|
-
|
|
30
|
+
it('has a default heading "Hey there" and counter 5', () => {
|
|
42
31
|
const button = elLocator.getByText('Counter: 5').query();
|
|
43
32
|
const heading = elLocator.getByText('Hey there').query();
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
expect(button).toBeTruthy();
|
|
34
|
+
expect(heading).toBeTruthy();
|
|
46
35
|
});
|
|
47
36
|
|
|
48
|
-
|
|
37
|
+
it('SHADOW DOM - Structure test', () => {
|
|
49
38
|
expect(getDiffableHTML(elShadowRoot)).toMatchSnapshot('SHADOW DOM');
|
|
50
39
|
});
|
|
51
40
|
|
|
52
|
-
|
|
41
|
+
it('LIGHT DOM - Structure test', () => {
|
|
53
42
|
expect(getDiffableHTML(el, {ignoreAttributes: ['id']})).toMatchSnapshot('LIGHT DOM');
|
|
54
43
|
});
|
|
55
44
|
|
|
56
|
-
|
|
57
|
-
await
|
|
45
|
+
it('a11y', async () => {
|
|
46
|
+
await expect(el).accessible();
|
|
58
47
|
});
|
|
59
48
|
});
|
|
60
49
|
|
|
61
|
-
|
|
50
|
+
describe('Events ', () => {
|
|
62
51
|
beforeEach(async () => {
|
|
63
52
|
el = await fixture(html`<<%= tagName %>></<%= tagName %>>`);
|
|
64
|
-
elLocator = getElementLocatorSelectors(el);
|
|
53
|
+
elLocator = utils.getElementLocatorSelectors(el);
|
|
65
54
|
});
|
|
66
55
|
|
|
67
56
|
afterEach(() => {
|
|
68
57
|
fixtureCleanup();
|
|
69
58
|
});
|
|
70
59
|
|
|
71
|
-
|
|
60
|
+
it('should increment value on click', async () => {
|
|
72
61
|
const button = elLocator.getByText('Counter: 5');
|
|
73
62
|
const elButton = button.query();
|
|
74
63
|
await button.dblClick();
|
|
75
64
|
await el.updateComplete;
|
|
76
|
-
|
|
65
|
+
expect(elButton.textContent).toContain('Counter: 7');
|
|
77
66
|
});
|
|
78
67
|
|
|
79
|
-
|
|
68
|
+
it('counterchange event is dispatched - vi', async () => {
|
|
80
69
|
const spyEvent = vi.spyOn(el, 'dispatchEvent');
|
|
81
70
|
const button = elLocator.getByText('Counter: 5');
|
|
82
71
|
await button.click();
|
|
83
|
-
|
|
84
|
-
const calledWithCounterChange = spyEvent.mock.lastCall?.[0].type === 'counterchange';
|
|
85
|
-
assert.isTrue(calledWithCounterChange);
|
|
72
|
+
expect(spyEvent).toHaveBeenCalledWith(expect.objectContaining({type: 'counterchange'}));
|
|
86
73
|
});
|
|
87
74
|
});
|
|
88
75
|
|
|
89
|
-
|
|
76
|
+
describe('Override ', () => {
|
|
90
77
|
beforeAll(async () => {
|
|
91
78
|
el = await fixture(html`<<%= tagName %> heading="attribute heading"></<%= tagName %>>`);
|
|
92
|
-
elLocator = getElementLocatorSelectors(el);
|
|
79
|
+
elLocator = utils.getElementLocatorSelectors(el);
|
|
93
80
|
|
|
94
81
|
return () => {
|
|
95
82
|
fixtureCleanup();
|
|
96
83
|
};
|
|
97
84
|
});
|
|
98
85
|
|
|
99
|
-
|
|
100
|
-
|
|
86
|
+
it('can override the heading via attribute', () => {
|
|
87
|
+
expect(el.heading).toBe('attribute heading');
|
|
101
88
|
});
|
|
102
89
|
});
|
|
103
90
|
});
|
package/src/testing-ts/index.js
CHANGED
|
@@ -1,102 +1,88 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
test,
|
|
4
|
-
assert,
|
|
5
|
-
expect,
|
|
6
|
-
beforeAll,
|
|
7
|
-
afterAll,
|
|
8
|
-
beforeEach,
|
|
9
|
-
afterEach,
|
|
10
|
-
vi,
|
|
11
|
-
chai,
|
|
12
|
-
} from 'vitest';
|
|
13
|
-
import {type LocatorSelectors} from '@vitest/browser/context';
|
|
14
|
-
import {getElementLocatorSelectors} from '@vitest/browser/utils';
|
|
15
|
-
import {html} from 'lit';
|
|
16
|
-
import {chaiA11yAxe} from 'chai-a11y-axe';
|
|
1
|
+
import {describe, it, expect, beforeAll, afterAll, beforeEach, afterEach, vi, chai} from 'vitest';
|
|
2
|
+
import {type LocatorSelectors, utils} from 'vitest/browser';
|
|
17
3
|
import {fixture, fixtureCleanup} from '@open-wc/testing-helpers';
|
|
4
|
+
import {chaiA11yAxe} from 'chai-a11y-axe';
|
|
18
5
|
import {getDiffableHTML} from '@open-wc/semantic-dom-diff/get-diffable-html.js';
|
|
6
|
+
import {html} from 'lit';
|
|
19
7
|
import {<%= className %>} from '../src/<%= className %>.js';
|
|
20
8
|
import '../src/define/<%= tagName %>.js';
|
|
21
9
|
|
|
22
10
|
chai.use(chaiA11yAxe);
|
|
23
11
|
|
|
24
|
-
|
|
12
|
+
describe('<%= className %>', () => {
|
|
25
13
|
let el: <%= className %>;
|
|
26
14
|
let elShadowRoot: string;
|
|
27
15
|
let elLocator: LocatorSelectors;
|
|
28
16
|
|
|
29
|
-
|
|
17
|
+
describe('Semantic Dom and a11y', () => {
|
|
30
18
|
beforeAll(async () => {
|
|
31
19
|
el = await fixture(html`<<%= tagName %>>light-dom</<%= tagName %>>`);
|
|
32
20
|
elShadowRoot = el?.shadowRoot!.innerHTML;
|
|
33
|
-
elLocator = getElementLocatorSelectors(el);
|
|
21
|
+
elLocator = utils.getElementLocatorSelectors(el);
|
|
34
22
|
});
|
|
35
23
|
|
|
36
24
|
afterAll(() => {
|
|
37
25
|
fixtureCleanup();
|
|
38
26
|
});
|
|
39
27
|
|
|
40
|
-
|
|
28
|
+
it('has a default heading "Hey there" and counter 5', () => {
|
|
41
29
|
const button = elLocator.getByText('Counter: 5').query();
|
|
42
30
|
const heading = elLocator.getByText('Hey there').query();
|
|
43
|
-
|
|
44
|
-
|
|
31
|
+
expect(button).toBeTruthy();
|
|
32
|
+
expect(heading).toBeTruthy();
|
|
45
33
|
});
|
|
46
34
|
|
|
47
|
-
|
|
35
|
+
it('SHADOW DOM - Structure test', () => {
|
|
48
36
|
expect(getDiffableHTML(elShadowRoot)).toMatchSnapshot('SHADOW DOM');
|
|
49
37
|
});
|
|
50
38
|
|
|
51
|
-
|
|
39
|
+
it('LIGHT DOM - Structure test', () => {
|
|
52
40
|
expect(getDiffableHTML(el, {ignoreAttributes: ['id']})).toMatchSnapshot('LIGHT DOM');
|
|
53
41
|
});
|
|
54
42
|
|
|
55
|
-
|
|
56
|
-
await
|
|
43
|
+
it('a11y', async () => {
|
|
44
|
+
await expect(el).accessible();
|
|
57
45
|
});
|
|
58
46
|
});
|
|
59
47
|
|
|
60
|
-
|
|
48
|
+
describe('Events ', () => {
|
|
61
49
|
beforeEach(async () => {
|
|
62
50
|
el = await fixture(html`<<%= tagName %>></<%= tagName %>>`);
|
|
63
|
-
elLocator = getElementLocatorSelectors(el);
|
|
51
|
+
elLocator = utils.getElementLocatorSelectors(el);
|
|
64
52
|
});
|
|
65
53
|
|
|
66
54
|
afterEach(() => {
|
|
67
55
|
fixtureCleanup();
|
|
68
56
|
});
|
|
69
57
|
|
|
70
|
-
|
|
58
|
+
it('should increment value on click', async () => {
|
|
71
59
|
const button = elLocator.getByText('Counter: 5');
|
|
72
60
|
const elButton = button.query()!;
|
|
73
61
|
await button.dblClick();
|
|
74
62
|
await el.updateComplete;
|
|
75
|
-
|
|
63
|
+
expect(elButton.textContent).toContain('Counter: 7');
|
|
76
64
|
});
|
|
77
65
|
|
|
78
|
-
|
|
66
|
+
it('counterchange event is dispatched - vi', async () => {
|
|
79
67
|
const spyEvent = vi.spyOn(el, 'dispatchEvent');
|
|
80
68
|
const button = elLocator.getByText('Counter: 5');
|
|
81
69
|
await button.click();
|
|
82
|
-
|
|
83
|
-
const calledWithCounterChange = spyEvent.mock.lastCall?.[0].type === 'counterchange';
|
|
84
|
-
assert.isTrue(calledWithCounterChange);
|
|
70
|
+
expect(spyEvent).toHaveBeenCalledWith(expect.objectContaining({type: 'counterchange'}));
|
|
85
71
|
});
|
|
86
72
|
});
|
|
87
73
|
|
|
88
|
-
|
|
74
|
+
describe('Override ', () => {
|
|
89
75
|
beforeAll(async () => {
|
|
90
76
|
el = await fixture(html`<<%= tagName %> heading="attribute heading"></<%= tagName %>>`);
|
|
91
|
-
elLocator = getElementLocatorSelectors(el);
|
|
77
|
+
elLocator = utils.getElementLocatorSelectors(el);
|
|
92
78
|
|
|
93
79
|
return () => {
|
|
94
80
|
fixtureCleanup();
|
|
95
81
|
};
|
|
96
82
|
});
|
|
97
83
|
|
|
98
|
-
|
|
99
|
-
|
|
84
|
+
it('can override the heading via attribute', () => {
|
|
85
|
+
expect(el.heading).toBe('attribute heading');
|
|
100
86
|
});
|
|
101
87
|
});
|
|
102
88
|
});
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable max-classes-per-file */
|
|
2
1
|
import {fileURLToPath} from 'url';
|
|
3
2
|
import {join, dirname} from 'path';
|
|
4
3
|
import {processTemplate, readFileFromPath} from '@open-wc/create/dist/core.js';
|
|
@@ -28,7 +27,6 @@ function featureReadme(acc, feature, i, a) {
|
|
|
28
27
|
|
|
29
28
|
const safeFeatureReadme = safeReduce(featureReadme, '');
|
|
30
29
|
|
|
31
|
-
/* eslint-disable no-console */
|
|
32
30
|
export const WcLitElementMixin = (subclass) =>
|
|
33
31
|
class extends subclass {
|
|
34
32
|
async execute() {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable max-classes-per-file */
|
|
2
1
|
import {fileURLToPath} from 'url';
|
|
3
2
|
import {join, dirname} from 'path';
|
|
4
3
|
import {processTemplate, readFileFromPath} from '@open-wc/create/dist/core.js';
|
|
@@ -28,7 +27,6 @@ function featureReadme(acc, feature, i, a) {
|
|
|
28
27
|
|
|
29
28
|
const safeFeatureReadme = safeReduce(featureReadme, '');
|
|
30
29
|
|
|
31
|
-
/* eslint-disable no-console */
|
|
32
30
|
export const TsWcLitElementMixin = (subclass) =>
|
|
33
31
|
class extends subclass {
|
|
34
32
|
async execute() {
|