@octanejs/testing-library 0.1.3 → 0.1.7
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 +12 -1
- package/package.json +3 -3
- package/src/fire-event.ts +5 -0
package/README.md
CHANGED
|
@@ -67,6 +67,17 @@ React-specific remappings:
|
|
|
67
67
|
commit and after discrete events, exactly like React — only the synthetic
|
|
68
68
|
`onChange` normalization is absent, so a controlled text input updates its
|
|
69
69
|
state from `onInput`.
|
|
70
|
+
- **Text commit behavior is separate and intentional.** `user.type(input, text)`
|
|
71
|
+
emits native `input` events; a text `onChange` does not run until the edit is
|
|
72
|
+
committed, such as when `await user.tab()` blurs the field. A commit-only host
|
|
73
|
+
should use `defaultValue`, native `onChange`, and
|
|
74
|
+
`suppressNativeChangeWarning`. The hint only acknowledges intent; it does not
|
|
75
|
+
remap or dispatch an event.
|
|
76
|
+
- **Checkables need click activation when activation is under test.**
|
|
77
|
+
`await user.click(checkbox)` produces the native `click` → `input` → `change`
|
|
78
|
+
sequence and automatic checked-state transition. `fireEvent.change(checkbox)`
|
|
79
|
+
is only an explicit change dispatch; it does not model the click, activation,
|
|
80
|
+
cancellation/rollback, or full event ordering.
|
|
70
81
|
- **No enter/leave/focus double-dispatch.** RTL's `fireEvent.mouseEnter` also
|
|
71
82
|
fires `mouseover` (and `focus` fires `focusin`, `select` fires `keyup`, …)
|
|
72
83
|
purely to feed React's plugin system, which listens to different native
|
|
@@ -125,7 +136,7 @@ dispatches **real native events**, which is exactly octane's event model (a
|
|
|
125
136
|
better fit than React, where it relies on the synthetic layer picking natives
|
|
126
137
|
up). Install it alongside this package and use it unchanged; the pairing is
|
|
127
138
|
pinned by `tests/user-event.test.ts` (click, `type()` per-keystroke `onInput`,
|
|
128
|
-
`keyboard()`).
|
|
139
|
+
text commit on `tab()`, checkbox click ordering, `keyboard()`).
|
|
129
140
|
|
|
130
141
|
## Status
|
|
131
142
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@octanejs/testing-library",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.7",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"@testing-library/dom": "^10.4.1"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"octane": "0.1.
|
|
44
|
+
"octane": "0.1.10"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@testing-library/user-event": "^14.6.1",
|
|
48
48
|
"vitest": "^4.1.9",
|
|
49
|
-
"octane": "0.1.
|
|
49
|
+
"octane": "0.1.10"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
52
|
"test": "vitest run"
|
package/src/fire-event.ts
CHANGED
|
@@ -14,4 +14,9 @@
|
|
|
14
14
|
// input-as-change); no remapping is wanted. The commit wiring (flushSync +
|
|
15
15
|
// effect drain around every dispatch) rides on dom-testing-library's
|
|
16
16
|
// `eventWrapper` config hook — see pure.ts.
|
|
17
|
+
//
|
|
18
|
+
// In particular, `fireEvent.change(textbox)` means “dispatch an explicit native
|
|
19
|
+
// commit event”; it does not simulate typing or blur. Likewise, change on a
|
|
20
|
+
// checkbox does not reproduce click activation/toggling or click → input →
|
|
21
|
+
// change ordering. Use user-event's type/tab/click flows for those sequences.
|
|
17
22
|
export { fireEvent } from '@testing-library/dom';
|