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 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 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.
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.24.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, i)"
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, billingButton] = buttons();
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(billingButton);
118
+ expect(document.activeElement).toBe(settingsButton);
119
119
 
120
- billingButton.dispatchEvent(new KeyboardEvent('keydown', { key: 'Home', bubbles: true }));
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, index: number): void {
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':