semmet-angular 0.24.0 → 0.25.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 +2 -3
- package/package.json +1 -1
- package/src/accordion/files/__name@dasherize__/__name@dasherize__.html.template +1 -1
- package/src/accordion/files/__name@dasherize__/__name@dasherize__.spec.ts.template +3 -3
- package/src/accordion/files/__name@dasherize__/__name@dasherize__.ts.template +7 -2
package/README.md
CHANGED
|
@@ -15,12 +15,11 @@ Read the broader product direction in [PRODUCT_VISION.md](./PRODUCT_VISION.md).
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
17
17
|
```
|
|
18
|
-
npm install -D semmet-angular
|
|
19
18
|
ng add semmet-angular
|
|
20
19
|
ng generate semmet-angular:accordion my-faq
|
|
21
20
|
```
|
|
22
21
|
|
|
23
|
-
`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.
|
|
22
|
+
`ng add semmet-angular` installs the package and 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.
|
|
24
23
|
|
|
25
24
|
## Generated tests
|
|
26
25
|
|
|
@@ -34,7 +33,7 @@ my-faq.spec.ts
|
|
|
34
33
|
my-faq.e2e-spec.ts
|
|
35
34
|
```
|
|
36
35
|
|
|
37
|
-
The unit test uses Angular's `TestBed` to verify
|
|
36
|
+
The unit test uses Angular's `TestBed` to verify the component through its public selector. Interactive components also generate behavior-focused tests for their ARIA state, keyboard flow, value changes, focus management, and open/close behavior. 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.
|
|
38
37
|
|
|
39
38
|
After running `ng add semmet-angular`, use:
|
|
40
39
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "semmet-angular",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
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",
|
|
@@ -25,7 +25,7 @@ Set [preserveContent]="false" on <<%= selector %>> to destroy panel content when
|
|
|
25
25
|
[attr.aria-controls]="instanceId + '-panel-' + item.id()"
|
|
26
26
|
[id]="instanceId + '-header-' + item.id()"
|
|
27
27
|
(click)="toggle(item)"
|
|
28
|
-
(keydown)="navigateHeaders($event
|
|
28
|
+
(keydown)="navigateHeaders($event)"
|
|
29
29
|
>
|
|
30
30
|
{{ item.title() }}
|
|
31
31
|
</button>
|
|
@@ -106,7 +106,7 @@ describe('<%= classify(name) %>', () => {
|
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
it('moves focus between headers with arrow, Home, and End keys', () => {
|
|
109
|
-
const [profileButton, settingsButton
|
|
109
|
+
const [profileButton, settingsButton] = buttons();
|
|
110
110
|
|
|
111
111
|
profileButton.focus();
|
|
112
112
|
profileButton.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowDown', bubbles: true }));
|
|
@@ -115,9 +115,9 @@ describe('<%= classify(name) %>', () => {
|
|
|
115
115
|
|
|
116
116
|
settingsButton.dispatchEvent(new KeyboardEvent('keydown', { key: 'End', bubbles: true }));
|
|
117
117
|
fixture.detectChanges();
|
|
118
|
-
expect(document.activeElement).toBe(
|
|
118
|
+
expect(document.activeElement).toBe(settingsButton);
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
settingsButton.dispatchEvent(new KeyboardEvent('keydown', { key: 'Home', bubbles: true }));
|
|
121
121
|
fixture.detectChanges();
|
|
122
122
|
expect(document.activeElement).toBe(profileButton);
|
|
123
123
|
});
|
|
@@ -94,12 +94,17 @@ export class <%= classify(name) %> {
|
|
|
94
94
|
}
|
|
95
95
|
|
|
96
96
|
// Up/Down/Home/End move focus between headers — optional but APG-recommended keyboard support.
|
|
97
|
-
protected navigateHeaders(event: KeyboardEvent
|
|
98
|
-
const buttons = this.headerButtons();
|
|
97
|
+
protected navigateHeaders(event: KeyboardEvent): void {
|
|
98
|
+
const buttons = this.headerButtons().filter((button) => !button.nativeElement.disabled);
|
|
99
99
|
if (buttons.length === 0) {
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
|
|
103
|
+
const index = buttons.findIndex((button) => button.nativeElement === event.currentTarget);
|
|
104
|
+
if (index === -1) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
|
|
103
108
|
let nextIndex: number;
|
|
104
109
|
switch (event.key) {
|
|
105
110
|
case 'ArrowDown':
|