@abgov/nx-adsp 13.17.0 → 13.17.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
CHANGED
|
@@ -64,14 +64,15 @@ from `@abgov/react-components` over those components:
|
|
|
64
64
|
import { GoabButton, GoabAppHeader, GoabButtonGroup } from '@abgov/react-components';
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
-
**Events**: GoA React components use `
|
|
68
|
-
|
|
67
|
+
**Events**: GoA React components use plain `onClick`/`onChange` handlers, not the
|
|
68
|
+
`onGoab*`/`e.detail` pattern some other GoA framework wrappers use. `onChange` receives its
|
|
69
|
+
detail object directly as the callback's sole argument — never wrapped in a synthetic event:
|
|
69
70
|
|
|
70
71
|
```tsx
|
|
71
|
-
<GoabButton
|
|
72
|
-
<GoabInput
|
|
73
|
-
<GoabDropdown
|
|
74
|
-
<GoabCheckbox
|
|
72
|
+
<GoabButton onClick={handleSave}>Save</GoabButton>
|
|
73
|
+
<GoabInput onChange={(detail) => setValue(detail.value)} />
|
|
74
|
+
<GoabDropdown onChange={(detail) => setSelected(detail.value)} />
|
|
75
|
+
<GoabCheckbox onChange={(detail) => setChecked(detail.checked)} />
|
|
75
76
|
```
|
|
76
77
|
|
|
77
78
|
Event `detail` shapes vary by component — check the component's gallery page or the
|
|
@@ -99,6 +99,20 @@ describe('React App Generator', () => {
|
|
|
99
99
|
expect(agents).not.toContain('ui-components.alberta.ca');
|
|
100
100
|
}, 30000);
|
|
101
101
|
|
|
102
|
+
it('AGENTS.md documents the real onClick/onChange event pattern, not the never-real onGoab*/e.detail one', async () => {
|
|
103
|
+
// @abgov/react-components has never exposed onGoab*-prefixed handlers or wrapped a
|
|
104
|
+
// callback's payload in e.detail -- onChange receives its detail object directly. Regression
|
|
105
|
+
// guard: this doc text drifted from the real API without the generated app code ever being
|
|
106
|
+
// affected (app.tsx has always used plain onClick), so nothing else would have caught it.
|
|
107
|
+
const host = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
108
|
+
await generator(host, options);
|
|
109
|
+
const agents = host.read('apps/test/AGENTS.md').toString();
|
|
110
|
+
expect(agents).not.toContain('onGoabClick');
|
|
111
|
+
expect(agents).not.toContain('onGoabChange');
|
|
112
|
+
expect(agents).not.toMatch(/e\.detail\.(value|checked)/);
|
|
113
|
+
expect(agents).toContain('onChange={(detail) => setValue(detail.value)}');
|
|
114
|
+
}, 30000);
|
|
115
|
+
|
|
102
116
|
it('can add nginx proxy', async () => {
|
|
103
117
|
const host = createTreeWithEmptyWorkspace({ layout: 'apps-libs' });
|
|
104
118
|
await generator(host, {
|