keymanapp / keymanapp/keyman

feat(web): anti-TWo-caps unit testing 🐵

Open
#9,834 0 comments 0 reactions 0 assignees View on GitHub
epic-gestures feat web/
Dominant language
Pascal
Stars
534
Forks
143
Avg merge
2d 10h
Merged PRs (30d)
113

Description

Unfortunately, I have to defer implementation of this due to triage, but I have the rough concept for a unit test for #9802 in mind.

Ideal TWo-caps prevention test:

Within gesture-recognizer's headless-testing section...

**Setup**
- configuration's `itemIdentifier` function:
- if state token `'default'`, output lowercase
- if state token `'shift'`, output uppercase
- first touch's coordinates => 'a' / 'A', depending on state token (as above)
- second touch's coordinates => 'b' / 'B', depending on state token
- the gesture-recognizer instance should start with the state token set as `'default'`

**Test**
- emulate LITERALLY simultaneous touches
- two contact points; ensure both last around 40 ms and then release.
- The coordinates should match those expected by `itemIdentifier` as mentioned above.
- The `InputSequenceSimulator` unit test resource should already be well-positioned for simulating this in a unit test.
- listen for sequences (`recognizedGesture` event)
- first one:
- verify expected output (lowercase) (either 'a' or 'b')
- have handler for first sequence's 'stage' event set the recognizer's state token to `'shift'`
- second one:
- verify expected output (uppercase) (either 'A' or 'B')

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.