fix(web): add unit tests for DeadkeyTracker and fix a few bugs#15113
fix(web): add unit tests for DeadkeyTracker and fix a few bugs#15113ermshiperete merged 5 commits intomasterfrom
Conversation
- initialize `Deadkey.matched` in c'tor - fix `Deadkey.equal` method - verify deadkey exists before removing it in `DeadkeyTracker.remove` - add unit tests for DeadkeyTracker Test-bot: skip
User Test ResultsTest specification and instructions User tests are not required Test Artifacts
|
| // REVIEW: this behavior seems odd | ||
| assert.isFalse(tracker.isMatch(0, 3, 1)); |
There was a problem hiding this comment.
The first parameter of isMatch is the current cursor position, the second parameter the expected offset of the deadkey from the cursor. So if I have a deadkey at position 3 and the current caret at position 0, I'd expect isMatch(0, 3,...) to return true.
There was a problem hiding this comment.
...unless the second parameter is the offset we have to add to the deadkey position to get to the cursor position!?
| const otherDks = other.dks; | ||
| const matchedDks: Deadkey[] = []; | ||
|
|
||
| for(const dk of this.dks) { |
There was a problem hiding this comment.
With this, will it fail if we have something two trackers looking like this?
this == [ (0,0,0), (0,0,0), (1,2,3) ]
other == [ (0,0,0), (1,2,3), (4,5,6) ]
There was a problem hiding this comment.
yep. Added additional tests.
| // REVIEW: this behavior seems odd | ||
| assert.isTrue(tracker.isMatch(0, -3, 1)); |
Co-authored-by: Marc Durdin <marc@durdin.net>
|
Changes in this pull request will be available for download in Keyman version 19.0.158-alpha |
fix(web): add unit tests for DeadkeyTracker and fix a few bugs - initialize `Deadkey.matched` in c'tor - fix `Deadkey.equal` method - verify deadkey exists before removing it in `DeadkeyTracker.remove` - add unit tests for DeadkeyTracker Cherry-pick-of: #15113
While working on the connection between web's TextStore (OutputTarget) and core's context I tried to understand what the
DeadkeyandDeadkeyTrackerclasses are doing. This lead me to add some unit tests and that showed that there were a few bugs in those classes. This PR fixes these:Deadkey.matchedin c'torDeadkey.equalmethodDeadkeyTracker.removeTest-bot: skip