@blockquote/create-wc 2.5.1 → 2.6.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blockquote/create-wc",
3
- "version": "2.5.1",
3
+ "version": "2.6.0",
4
4
  "description": "Web component with Lit scaffolding - Extending Open Web Component",
5
5
  "keywords": [
6
6
  "Lit",
@@ -81,7 +81,7 @@
81
81
  "typescript-eslint": "^8.46.2",
82
82
  "globals": "^16.4.0",
83
83
  "husky": "^9.1.7",
84
- "lint-staged": "^16.2.5",
84
+ "lint-staged": "^16.2.6",
85
85
  "prettier": "^3.6.2",
86
86
  "stylelint": "^16.25.0",
87
87
  "stylelint-config-standard-scss": "^16.0.0"
@@ -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": "^3.2.4",
47
- "@vitest/coverage-istanbul": "^3.2.4",
48
- "@vitest/coverage-v8": "^3.2.4",
49
- "@vitest/ui": "^3.2.4",
50
- "vitest": "^3.2.4",
51
- "vite": "^7.1.11"
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: 'playwright',
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
  },
@@ -1,25 +1,14 @@
1
- import {
2
- suite,
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
- suite('<%= className %>', () => {
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
- suite('Semantic Dom and a11y', () => {
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
- test('has a default heading "Hey there" and counter 5', () => {
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
- assert.isOk(button);
45
- assert.isOk(heading);
33
+ expect(button).toBeTruthy();
34
+ expect(heading).toBeTruthy();
46
35
  });
47
36
 
48
- test('SHADOW DOM - Structure test', () => {
37
+ it('SHADOW DOM - Structure test', () => {
49
38
  expect(getDiffableHTML(elShadowRoot)).toMatchSnapshot('SHADOW DOM');
50
39
  });
51
40
 
52
- test('LIGHT DOM - Structure test', () => {
41
+ it('LIGHT DOM - Structure test', () => {
53
42
  expect(getDiffableHTML(el, {ignoreAttributes: ['id']})).toMatchSnapshot('LIGHT DOM');
54
43
  });
55
44
 
56
- test('a11y', async () => {
57
- await assert.isAccessible(el);
45
+ it('a11y', async () => {
46
+ await expect(el).accessible();
58
47
  });
59
48
  });
60
49
 
61
- suite('Events ', () => {
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
- test('should increment value on click', async () => {
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
- assert.include(elButton.textContent, 'Counter: 7');
65
+ expect(elButton.textContent).toContain('Counter: 7');
77
66
  });
78
67
 
79
- test('counterchange event is dispatched', async () => {
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
- await el.updateComplete;
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
- suite('Override ', () => {
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
- test('can override the heading via attribute', () => {
100
- assert.equal(el.heading, 'attribute heading');
86
+ it('can override the heading via attribute', () => {
87
+ expect(el.heading).toBe('attribute heading');
101
88
  });
102
89
  });
103
90
  });
@@ -1,102 +1,88 @@
1
- import {
2
- suite,
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
- suite('<%= className %>', () => {
12
+ describe('<%= className %>', () => {
25
13
  let el: <%= className %>;
26
14
  let elShadowRoot: string;
27
15
  let elLocator: LocatorSelectors;
28
16
 
29
- suite('Semantic Dom and a11y', () => {
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
- test('has a default heading "Hey there" and counter 5', () => {
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
- assert.isOk(button);
44
- assert.isOk(heading);
31
+ expect(button).toBeTruthy();
32
+ expect(heading).toBeTruthy();
45
33
  });
46
34
 
47
- test('SHADOW DOM - Structure test', () => {
35
+ it('SHADOW DOM - Structure test', () => {
48
36
  expect(getDiffableHTML(elShadowRoot)).toMatchSnapshot('SHADOW DOM');
49
37
  });
50
38
 
51
- test('LIGHT DOM - Structure test', () => {
39
+ it('LIGHT DOM - Structure test', () => {
52
40
  expect(getDiffableHTML(el, {ignoreAttributes: ['id']})).toMatchSnapshot('LIGHT DOM');
53
41
  });
54
42
 
55
- test('a11y', async () => {
56
- await assert.isAccessible(el);
43
+ it('a11y', async () => {
44
+ await expect(el).accessible();
57
45
  });
58
46
  });
59
47
 
60
- suite('Events ', () => {
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
- test('should increment value on click', async () => {
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
- assert.include(elButton.textContent, 'Counter: 7');
63
+ expect(elButton.textContent).toContain('Counter: 7');
76
64
  });
77
65
 
78
- test('counterchange event is dispatched', async () => {
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
- await el.updateComplete;
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
- suite('Override ', () => {
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
- test('can override the heading via attribute', () => {
99
- assert.equal(el.heading, 'attribute heading');
84
+ it('can override the heading via attribute', () => {
85
+ expect(el.heading).toBe('attribute heading');
100
86
  });
101
87
  });
102
88
  });