Simplify usage of `TestCompilerCallbacks` by making it responsible for
the `beforeEach` and `afterEach` incantations itself. There are a couple
of more complex usages of `TestCompilerCallbacks` which have been
excluded from this change on purpose.
Renamed `testCallbacks` to `callbacks` in the one place where it was
different.
Hoist @types/node and @types/mocha because inconsistent versions of
@types/mocha were causing compiler errors with this change.
Also added a cast to `fs.readFileSync` to `Uint8Array` to eliminate
compiler warnings/errors in test files.
Fixes: #15654
Test-bot: skip
The command shortcuts that were used by Web
scripts to create bundles via `esbuild` were not
properly handling the $KEYMAN_ROOT path when it
contained a space. These changes will rectify
this behavior and permit builds for such cases.
Build-bot: skip build:web
Test-bot: skip
This change stubs out `KMXKeyboard.isRTL` and adds a unit test for RTL
with .js and .kmx (currently skipped) keyboards. Also change some code
to use `Keyboard` instead of `JSKeyboard` and stub out additional methods.
The RTL functionality will have to be completed when the necessary
extensions to the Core API are implemented (#15482).
Fixes: #15288
Test-bot: skip
fix(web): fix problem with tests if KEYMAN_ROOT is not set 🎼
When running mocha without starting it through `build.sh`/`test.sh` the tests failed if the `KEYMAN_ROOT` environment variable was not set. Things were almost correct, but the undefined `KEYMAN_ROOT` variable added an extra `undefined` subdirectory. This change fixes this problem by setting `KEYMAN_ROOT` relative to the current file. This gets removed by `pathToFileURL` which also adds the absolute path to the current directory since we pass a relative path as argument.
refactor(web): refactor `ProcessorInitOptions` 📏🎼
This addresses a web-core TODO comment.
This change makes the `options` parameter in the `JSKeyboardProcessor` constructor no longer optional. Also `baseLayout` and `defaultOutputRules` are now required in `ProcessorInitOptions`. For testing purposes we export `DEFAULT_OPTIONS` in a testing endpoint.
The `options` parameter in the `InputProcessor` constructor is no longer optional. Also removes the `DEFAULT_OPTIONS` from
`InputProcessor`.
This change also moves the `ProcessorInitOptions` interface to a separate file and makes `keyboardInterface` a required field.
An alternative approach would have been to get rid of `ProcessorInitOptions` and instead set the `JSKeyboardProcessor` fields after creating the instance. Doing it the implemented way seemed cleaner.
When running mocha without starting it through `build.sh`/`test.sh`
the tests failed if the `KEYMAN_ROOT` environment variable was not set.
Things were almost correct, but the undefined `KEYMAN_ROOT` variable
added an extra `undefined` subdirectory. This change fixes this problem
by setting `KEYMAN_ROOT` to the current directory (`.`). This gets
removed by `pathToFileURL` which also adds the absolute path to the
current directory since we pass a relative path as argument.
Build-bot: skip
Test-bot: skip
refactor(web): rename ruleBehavior variables → processorAction 🎼
The changes in PR #12291 renamed the `RuleBehavior` class to `ProcessorAction`. This change now renames the local variables in `InputProcessor` accordingly.
Follow-up-of: #12291
refactor(web): remove web-utils exports from keyboard 🎼
Types defined in keyman/common/web-utils were re-exported in keyman/engine/keyboard. This change removes the re-export.
Part-of: #15292
Previously the cookies for the baseline tests were set to a fixed time
which might be in the past. This change now calculates the expiration
time and sets them to expire in 60s.
Test-bot: skip
feat(web): add `findStores` functions 🍪
This change adds a static `findStores` function to `VarStoreSerializer` and `VariableStoreCookieSerializer` as well as to the `VariableStoreSerializer` interface.
Also add unit tests for `VariableStoreCookieSerializer`.
Part-of: #13426
This makes the `options` parameter in the `InputProcessor` constructor
no longer optional. Also removes the `DEFAULT_OPTIONS` from
`InputProcessor`.
Test-bot: skip
This makes the `options` parameter in the `JSKeyboardProcessor`
constructor no longer optional.
Also `baseLayout` and `defaultOutputRules` are now required in
`ProcessorInitOptions`.
For testing purposes we export `DEFAULT_OPTIONS` in a testing endpoint.
Test-bot: skip
This changes several `TODO-web-core` to `TODO-embed-osk-in-kmx` because
they are related to OSK and can't be implemented/tested without having
the OSK API available.
Also updated some additional comments.
Build-bot: skip
Test-bot: skip
The changes in PR #12291 renamed the `RuleBehavior` class to
`ProcessorAction`. This change now renames the local variables in
`InputProcessor` accordingly.
Follow-up-of: #12291
Test-bot: skip
chore(web): fix e2e tests 🍪
The Playwright tests occasionally failed complaining about `Page` and `Locator` not being defined. The solution is to import them as types.
The test failures probably happened when running the tests with a node version > 20.16.0.
- move `CoreKeyboardInterface` to separate file
- add variable store to `CoreKeyboardInterface` to manage variable stores
for active keyboard
- Add `VariableStoreSerializer` parameter to `CoreKeyboardProcessor.init()`
- Implement `process_persist_action()` to save options to persistent
storage
- Update keyboard activation to load stored options from serializer
Closes: #13426
Test-bot: skip