semmet-angular 0.20.0 → 0.22.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/README.md
CHANGED
|
@@ -1,21 +1,44 @@
|
|
|
1
1
|
# semmet-angular
|
|
2
2
|
|
|
3
|
-
**
|
|
3
|
+
**Accessible UI Delivery Kit for Angular.**
|
|
4
4
|
|
|
5
|
-
`
|
|
5
|
+
`semmet-angular` is a delivery-focused schematic collection for Angular teams that want to ship accessible UI faster: components with real ARIA behavior, a consistent visual identity, and generated test files from the first command.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[Semmet](https://github.com/daniloagostinho/semmet) is a VS Code extension that autocompletes the same W3C ARIA vocabulary as plain HTML — no CSS, no JS, framework-agnostic by design. semmet-angular draws from that same vocabulary as its source of truth, but takes the opposite approach on purpose: an Angular component isn't usable with markup alone, so everything generated here — state, event handlers, styling — is fully working from the start, not just structure.
|
|
7
|
+
`ng generate semmet-angular:accordion my-faq` scaffolds a standalone, signals-based Angular component — `.ts`/`.html`/`.css` — plus `.spec.ts` and `.e2e-spec.ts` smoke tests. The generated component implements a W3C ARIA Authoring Practices Guide pattern for real: correct roles and `aria-*` wiring, the keyboard/focus behavior the pattern requires (arrow-key navigation, focus traps, focus restoration...), and a consistent visual identity out of the box.
|
|
10
8
|
|
|
11
9
|
## Usage
|
|
12
10
|
|
|
13
11
|
```
|
|
14
12
|
npm install -D semmet-angular
|
|
13
|
+
ng add semmet-angular
|
|
15
14
|
ng generate semmet-angular:accordion my-faq
|
|
16
15
|
```
|
|
17
16
|
|
|
18
|
-
Each generated component is dropped into your project exactly like `ng generate component` would (respecting your `angular.json` project, source root, and selector prefix), and has **zero runtime dependency** on this package — `semmet-angular` is only needed at generation time.
|
|
17
|
+
`ng add semmet-angular` configures the delivery workflow once for the target application, including Playwright e2e support and npm scripts. Each generated component is dropped into your project exactly like `ng generate component` would (respecting your `angular.json` project, source root, and selector prefix), and has **zero runtime dependency** on this package — `semmet-angular` is only needed at generation time.
|
|
18
|
+
|
|
19
|
+
## Generated tests
|
|
20
|
+
|
|
21
|
+
Every component schematic generates test files next to the component:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
my-faq.ts
|
|
25
|
+
my-faq.html
|
|
26
|
+
my-faq.css
|
|
27
|
+
my-faq.spec.ts
|
|
28
|
+
my-faq.e2e-spec.ts
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The unit test uses Angular's `TestBed` to verify that the standalone component can be created. The e2e test uses Playwright and becomes active as soon as the component is mounted in a route or host component. If the component has not been added to any rendered page yet, the generated e2e smoke test is skipped with a clear message instead of failing the whole suite.
|
|
32
|
+
|
|
33
|
+
After running `ng add semmet-angular`, use:
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
npm test
|
|
37
|
+
npm run e2e
|
|
38
|
+
npm run e2e:ui
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
`npm run e2e` runs Playwright against the Angular dev server configured by `playwright.config.ts`; `npm run e2e:ui` opens Playwright's interactive UI.
|
|
19
42
|
|
|
20
43
|
## Projected content containers
|
|
21
44
|
|
|
@@ -195,6 +218,7 @@ The smaller structural schematics keep their simple input APIs and add safe slot
|
|
|
195
218
|
- Templates use the built-in control flow (`@for`, `@if`), not `*ngFor`/`*ngIf`.
|
|
196
219
|
- No `.component` suffix on file names or class names (`accordion.ts`, `export class Accordion`), matching the current `ng generate component` convention.
|
|
197
220
|
- A unique per-instance id (`<name>-0`, `<name>-1`, ...) so multiple instances of the same generated component never collide on `id`/`aria-controls`/`aria-labelledby`.
|
|
221
|
+
- A generated unit test (`.spec.ts`) and Playwright e2e smoke test (`.e2e-spec.ts`) so the component starts life with a test surface.
|
|
198
222
|
|
|
199
223
|
## Visual identity
|
|
200
224
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semmet-angular",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Angular schematics that generate
|
|
3
|
+
"version": "0.22.0",
|
|
4
|
+
"description": "Accessible UI Delivery Kit for Angular: schematics that generate ARIA-conformant standalone components with styling, keyboard behavior, unit tests, and Playwright e2e smoke tests.",
|
|
5
5
|
"publisher": "danilodevsilva",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"keywords": [
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
"aria",
|
|
12
12
|
"accessibility",
|
|
13
13
|
"a11y",
|
|
14
|
+
"e2e",
|
|
15
|
+
"playwright",
|
|
14
16
|
"standalone",
|
|
15
17
|
"signals"
|
|
16
18
|
],
|
package/src/utils/component-test-files/__name@dasherize__/__name@dasherize__.e2e-spec.ts.template
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { expect, test } from '@playwright/test';
|
|
2
2
|
|
|
3
3
|
test.describe('<%= classify(name) %>', () => {
|
|
4
|
-
test('is
|
|
4
|
+
test('is visible when mounted in the application', async ({ page }) => {
|
|
5
5
|
await page.goto('/');
|
|
6
6
|
|
|
7
7
|
const component = page.locator('<%= selector %>').first();
|
|
8
|
+
test.skip(
|
|
9
|
+
(await component.count()) === 0,
|
|
10
|
+
'Mount <<%= selector %> /> in a route or host component to enable this generated e2e smoke test.'
|
|
11
|
+
);
|
|
12
|
+
|
|
8
13
|
await expect(component).toBeVisible();
|
|
9
14
|
});
|
|
10
15
|
});
|