Skip to content

codemirror blob view: First pass on porting blob tests

Administrator requested to merge fkling/blob-tests into main

Created by: fkling

This commit ports the non-skipped tests from blob-viewer.test.ts to test them against the CodeMirror implementation. Note: Most of it is just copied. I only had to make some minor adjustments to make it work with CodeMirror's DOM structure. I also copied the skiped tests with the intention to reactivate them.

The most significant change is probably how "selections" work. Instead of simply clicking on a line (which did not work) I extended the existing editor API to allow us to specify the position of the text cursor. That only works because currently the view is configured to show/have a cursor. If we are not keeping this functionality we have to find another approach.

A couple of features, especially extensions-related ones, don't seem to be tested in the existing integration test. I plan to add more tests for CodeMirror specifically in future PRs.

Test plan

Run test locally:

INTEGRATION_TESTS=1 sg start web-standalone

and

yarn test-integration:debug client/web/src/integration/codemirror-blob-viewer.test.ts

CI passes for new test.

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading