Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
2663d1a
wip: Started refactoring fs/path/os usage
pimotte Oct 11, 2024
dc91747
Fixes
pimotte Oct 15, 2024
0fa6972
Proof of concept list of tactics
DikieDick Nov 21, 2024
578b1fc
Merge remote-tracking branch 'origin/main' into feat/webextension
pimotte Feb 7, 2025
d36892b
Hacky stuff to try to enable web extension
pimotte Feb 7, 2025
7ea476a
work in progress
pimotte Feb 7, 2025
e4f34a8
Wip
pimotte Feb 21, 2025
d686309
Merge remote-tracking branch 'origin/main' into feat/webextension
pimotte Mar 17, 2025
4249edc
Semi-proper fixes for web
pimotte Mar 17, 2025
a8ccf58
Undo debug stuff
pimotte Mar 17, 2025
dd2b13c
Minor cleanup
pimotte Mar 17, 2025
b640f78
Cleanup
pimotte Mar 17, 2025
534dcff
Lint fixes
pimotte Mar 17, 2025
a20c1b4
add warning for trimming whitespace setting, and modified skeleton co…
raulTUe Apr 7, 2025
8ea44ae
Small fixes
pimotte Apr 8, 2025
b7d240a
Documentation
pimotte Apr 8, 2025
8c33354
Correct default name
pimotte Apr 8, 2025
7ef7395
Merge remote-tracking branch 'origin/main' into feat/webextension
pimotte Apr 8, 2025
ea6ef32
Fixed button transparency when reopening side panel
Alisakondratyev Apr 21, 2025
14faf82
Update error message
pimotte Apr 22, 2025
bbe0dd3
Merge remote-tracking branch 'origin/main' into feat/webextension
pimotte Apr 22, 2025
27a803c
fixing merge conflicts
Alisakondratyev Apr 22, 2025
fcbca80
Add show terminal
pimotte Apr 23, 2025
a90a369
Fix race conditions
pimotte Apr 23, 2025
fd9aa1f
Merge remote-tracking branch 'origin/main' into trimmingWhitespace-fix
raulTUe Apr 29, 2025
65982d0
modified code for updateDocument. however, it remains commented out f…
raulTUe Apr 29, 2025
87dccb1
cleaning code up
raulTUe Apr 30, 2025
e26c6b4
final changes
raulTUe Apr 30, 2025
db44d47
temporary changes
Alisakondratyev May 7, 2025
2415b7e
fixing multiple goals panel issue
Alisakondratyev May 19, 2025
f6d349e
fixing multiple goals panel issue
Alisakondratyev May 19, 2025
d8426f4
added documentation and first implementation of updating cursor
raulTUe Jun 16, 2025
b2482c1
Completion fixes
pimotte Jun 24, 2025
7282fb2
Remove references to mac installer
pimotte Jun 24, 2025
d4ee4db
Disable windows and mac unit tests
pimotte Jun 24, 2025
cab2dc0
Patched goals panel to show hypotheses
pimotte Jun 26, 2025
b3bd1fd
Sync: commit all local changes
Alisakondratyev Jun 27, 2025
f19bf84
Merge pull request #176 from impermeable/chore/disable-win-mac-ci
pimotte Jul 2, 2025
be41735
Add option to disable launch checks
DikieDick Jul 2, 2025
455d728
Merge branch 'main' into version-check-option
DikieDick Jul 2, 2025
977f9a1
Merge pull request #181 from impermeable/version-check-option
pimotte Jul 2, 2025
b9de6c1
Add error boxes to code cells
DikieDick Jul 2, 2025
08feddf
Merge branch 'main' into error-boxes-v2
DikieDick Jul 2, 2025
1ec9e4b
Disable showing menu buttons by default
DikieDick Jul 2, 2025
3c826fd
Merge remote-tracking branch 'origin/main' into feat/webextension
pimotte Jul 2, 2025
77f0043
Skip launch checks for webversion
pimotte Jul 2, 2025
34625b9
Revert to child_process based workflow
pimotte Jul 2, 2025
fe93833
quick add
raulTUe Jul 3, 2025
ee26eb9
Add tutorial
pimotte Jul 6, 2025
6058ba3
Merge remote-tracking branch 'origin/main' into update/lconstr-as
pimotte Jul 6, 2025
6c6b865
Work-in-progress
pimotte Jul 6, 2025
6ca615a
Work in progress
pimotte Jul 7, 2025
a7bcae6
Revert back to using inline code for input area
DikieDick Jul 7, 2025
f478e2c
Remove input area from line numbers test
DikieDick Jul 7, 2025
93a921f
Add cypress test for error box
DikieDick Jul 7, 2025
767fa44
Update tactic templates with placeholder at end of line.
DikieDick Jul 7, 2025
3d70c04
Merge pull request #187 from impermeable/feature/tab-completions-end-…
pimotte Jul 7, 2025
b3cbb9d
Merge remote-tracking branch 'origin/main' into feat/webextension
pimotte Jul 7, 2025
1435426
Merge remote-tracking branch 'origin/main' into update/lconstr-as
pimotte Jul 7, 2025
30e2bae
Fix typo, switch to Hyp element from debug
pimotte Jul 9, 2025
2b17021
Fix debug panel
pimotte Jul 9, 2025
305447d
Merge branch 'main' into error-boxes-v2
DikieDick Jul 9, 2025
cd7f1da
update editorview state
raulTUe Jul 9, 2025
995aeeb
Update to use inInputArea variable
DikieDick Jul 10, 2025
85e4e35
Merge branch 'main' into feat/webextension
pimotte Jul 14, 2025
c5732d2
Merge pull request #183 from impermeable/error-boxes-v2
pimotte Jul 14, 2025
7395468
Remove logbook
pimotte Jul 14, 2025
88ae36a
Fix build config
pimotte Jul 14, 2025
c27b179
Merge branch 'feat/webextension' of github.com:impermeable/waterproof…
pimotte Jul 15, 2025
5bc68af
Fix creating documents
pimotte Jul 15, 2025
4954d7c
Merge remote-tracking branch 'origin/main' into feat/webextension
pimotte Jul 15, 2025
9e42815
Hypotheses as separate box, remove count
pimotte Jul 15, 2025
5d1e4d7
Rename and move documentation to enumDescriptions
pimotte Jul 16, 2025
9819187
Switch quotes
pimotte Jul 16, 2025
fb78014
Update src/helpers/file.ts
pimotte Jul 16, 2025
42e5648
Debug logging
pimotte Jul 16, 2025
77a4aaf
Add options to toggle the menu bar items
DikieDick Jul 18, 2025
1b33ab4
Merge branch 'main' into disable-menu-buttons
DikieDick Jul 18, 2025
eb263ab
Fix typechecking error
DikieDick Jul 18, 2025
d38c463
destroy previous progress bars
raulTUe Jul 19, 2025
301b1ad
Merge branch 'main' into feature/show-hypotheses
pimotte Jul 19, 2025
9f6e6c6
Merge pull request #188 from impermeable/feature/show-hypotheses
pimotte Jul 19, 2025
0b687d6
Merge branch 'main' into feat/webextension
pimotte Jul 19, 2025
26fc194
Merge branch 'feat/webextension' of github.com:impermeable/waterproof…
pimotte Jul 19, 2025
9639823
Merge pull request #158 from impermeable/feat/webextension
pimotte Jul 19, 2025
24d4f27
Merge branch 'main' into disable-menu-buttons
pimotte Jul 19, 2025
dbc24f2
Merge pull request #191 from impermeable/disable-menu-buttons
pimotte Jul 19, 2025
7494e17
Merge remote-tracking branch 'origin/main' into update/lconstr-as
pimotte Jul 21, 2025
3de6c4e
checkpoint for new flashing button
Alisakondratyev Jul 22, 2025
051b73e
Merge branch 'main' into generate-pdf
DikieDick Jul 23, 2025
2e658c1
Add pdf version of tactics sheet and add getting started to readme
DikieDick Jul 23, 2025
51fdd4f
Update eslint: ignore scripts folder
DikieDick Jul 23, 2025
bfe5d22
Remove pdf
DikieDick Jul 23, 2025
a17e03c
Merge pull request #122 from impermeable/generate-pdf
pimotte Jul 23, 2025
d537baf
Refactor Editor 2 (#168)
DikieDick Jul 23, 2025
de427dc
adding flashing side panel buttons and cleaning up old button functio…
Alisakondratyev Jul 29, 2025
b98dd4f
Merge remote-tracking branch 'origin/main' into side-panel-flash-clean
pimotte Jul 30, 2025
52ed9f5
Fix merge
pimotte Jul 30, 2025
160f63e
Move dynamic auto completion logic into WaterproofEditor (#196)
DikieDick Aug 4, 2025
6c2cd1f
Fix lezer-generator command
DikieDick Aug 5, 2025
d72c3e2
Set tactic completions when initializing editor. (#195)
DikieDick Aug 5, 2025
43f17d7
Merge branch 'main' into lezer-generator
DikieDick Aug 5, 2025
f306db9
Merge pull request #197 from impermeable/lezer-generator
pimotte Aug 6, 2025
a96d260
Special-casing snippet communication
pimotte Aug 6, 2025
94b8e65
Remove definition panel
pimotte Aug 6, 2025
f1c5e4d
Fix build
pimotte Aug 6, 2025
8cf7a6a
Merge remote-tracking branch 'origin/main' into feature/better-feedback
pimotte Aug 6, 2025
7ab4224
Tiny fix
pimotte Aug 12, 2025
5956f01
Add more symbols needed for infinite descent exercises
pimotte Aug 14, 2025
e864432
Adding inverse/preimage symbol
pimotte Aug 14, 2025
c96dba8
Documentation
pimotte Aug 18, 2025
72dda0d
Update shared/completions/symbols.json
pimotte Aug 18, 2025
43d3974
Merge pull request #200 from impermeable/feature/more-symbols
pimotte Aug 18, 2025
e11d818
fixed small changes
Alisakondratyev Aug 20, 2025
1a1694b
checking
Alisakondratyev Aug 20, 2025
dc695e2
Adopt suggestion buttons
pimotte Aug 21, 2025
c2f8dc4
Merge remote-tracking branch 'origin/main' into feature/better-feedback
pimotte Aug 21, 2025
e8ed8e9
Merge branch 'main' into side-panel-flash-clean
pimotte Aug 21, 2025
76d759c
Merge pull request #192 from impermeable/side-panel-flash-clean
pimotte Aug 21, 2025
9fd34a1
Spelling error
pimotte Aug 21, 2025
80d2a85
Remove copy word from button
pimotte Aug 21, 2025
98bc545
Flex tooltips as column
pimotte Aug 21, 2025
12bbcff
Merge branch 'main' into feature/better-feedback
pimotte Aug 21, 2025
d214425
Remove log statements
pimotte Aug 21, 2025
873b7b3
Merge branch 'feature/better-feedback' of github.com:impermeable/wate…
pimotte Aug 21, 2025
e466018
Update version checks, because this is backwards incompatible
pimotte Aug 27, 2025
9a690cb
Merge remote-tracking branch 'origin/main' into update/lconstr-as
pimotte Aug 27, 2025
2320294
Merge pull request #184 from impermeable/update/lconstr-as
jim-portegies Aug 27, 2025
1ca6e0d
Merge branch 'main' into feature/better-feedback
jim-portegies Aug 27, 2025
5d172f8
Merge pull request #199 from impermeable/feature/better-feedback
jim-portegies Aug 27, 2025
37639bb
Merge branch 'main' into chore/readme-fix
jim-portegies Aug 27, 2025
adaec9d
Merge pull request #173 from impermeable/chore/readme-fix
jim-portegies Aug 27, 2025
a42d6fd
add warning for trimming whitespace setting, and modified skeleton co…
raulTUe Apr 7, 2025
6bab3b5
modified code for updateDocument. however, it remains commented out f…
raulTUe Apr 29, 2025
8ae12d3
cleaning code up
raulTUe Apr 30, 2025
badc9f4
final changes
raulTUe Apr 30, 2025
f4f8550
added documentation and first implementation of updating cursor
raulTUe Jun 16, 2025
a4897db
quick add
raulTUe Jul 3, 2025
c2dfae9
update editorview state
raulTUe Jul 9, 2025
faa9f9b
destroy previous progress bars
raulTUe Jul 19, 2025
aa5dffb
Merge branch 'trimmingWhitespace-fix' of https://github.com/impermeab…
raulTUe Aug 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:

strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [ubuntu-latest]
node-version: [16.x]

steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@ node_modules/
editor_output
.DS_store
.vscode-test
.vscode-test-web
test_out/
.ui-test/
__tests_output__/
**/*.cache
ExampleFiles/
/cypress/screenshots/
14 changes: 13 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
{
"js/ts.implicitProjectConfig.target": "ESNext"
"js/ts.implicitProjectConfig.target": "ESNext",
"files.exclude": {
"**/*.vo": true,
"**/*.vok": true,
"**/*.vos": true,
"**/*.aux": true,
"**/*.glob": true,
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/.DS_Store": true,
"**/Thumbs.db": true
}
}
4 changes: 3 additions & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,6 @@ tsconfig-base.json
tsconfig.json
.github/
ExampleFiles/
developer-resources/
developer-resources/
scripts/
docs/
19 changes: 16 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

The Waterproof vscode extension helps students learn how to write mathematical proofs.

1. [Automatic Installation](#quick-install-instructions-for-windows)
2. [Manual Installation](#more-extensive-installation-instructions)
3. [Getting Started](#getting-started)

# Quick install instructions for Windows

Install this extension and follow the installation instructions that pop up.
Expand Down Expand Up @@ -104,9 +108,7 @@ If vscode cannot detect the installation, set the coq-lsp path to the output of
using ctrl+shift+p and selecting "Waterproof: Change Waterproof path".
Alternatively, make sure that the `PATH` available to vscode contains the coq-lsp binary.

## Manual Installation on Mac

If the above method did not work for Mac, it is possible to instead install the dependencies manually using opam.
## Installation on Mac

### Step 1: Install this [Waterproof vscode extension](https://marketplace.visualstudio.com/items?itemName=waterproof-tue.waterproof)

Expand All @@ -132,3 +134,14 @@ eval $(opam env)
opam install coq-lsp.0.2.2+8.17
opam install coq-waterproof
```

# Getting Started

### Tutorial
To get started with Waterproof, we recommend going through the tutorial. The tutorial can be accessed in VS Code by pressing `Ctrl-Shift-P` (this opens the command palette), typing `open tutorial` until you find the option `Waterproof: Open Tutorial`.

### Tactics
Waterproof makes use of 'tactics', information on the available tactics, together with explanations and examples can be accessed via the extension or through the repository:

* From the Waterproof extension: Navigate to the Waterproof sidebar (accessible via the droplet icon on the left) and click on the `Tactics` button. The panel that now opens shows all available tactics.
* From the repository: The repository contains a [Markdown](/docs/tactics-sheet.md) version of the tactics sheet.
20 changes: 10 additions & 10 deletions __tests__/editor-content-construction.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { checkPrePost, fixLessThanBug } from "../editor/src/kroqed-editor/file-utils";
import { checkPrePost, fixLessThanBug } from "../editor/src/waterproof-editor/file-utils";
import { Message, MessageType } from "../shared";

class PostManager {
Expand Down Expand Up @@ -38,10 +38,10 @@ test("TEMP: Add space between '<' and characters following it #4", () => {
const pm = new PostManager();
expect(fixLessThanBug("```coq\n10<10\n```", (msg) => pm.post(msg))).toBe("```coq\n10< 10\n```");
expect(pm.storage).toStrictEqual<Array<Message>>([{
type: MessageType.docChange,
type: MessageType.docChange,
body: {
startInFile: 10,
endInFile: 10,
endInFile: 10,
finalText: " "
}
}]);
Expand All @@ -51,10 +51,10 @@ test("TEMP: Add space between '<' and characters following it #5", () => {
const pm = new PostManager();
expect(fixLessThanBug("<input-area>\n10<z\n</input-area>", (msg) => pm.post(msg))).toBe("<input-area>\n10< z\n</input-area>");
expect(pm.storage).toStrictEqual<Array<Message>>([{
type: MessageType.docChange,
type: MessageType.docChange,
body: {
startInFile: 16,
endInFile: 16,
startInFile: 16,
endInFile: 16,
finalText: " "
}
}]);
Expand Down Expand Up @@ -84,8 +84,8 @@ test("TEMP: Leave <br> in markdown untouched #2", () => {
expect(pm.storage).toStrictEqual<Array<Message>>([{
type: MessageType.docChange,
body: {
startInFile: 19,
endInFile: 19,
startInFile: 19,
endInFile: 19,
finalText: " "
}
}]);
Expand All @@ -103,8 +103,8 @@ test("TEMP: Leave <hr> in markdown untouched #2", () => {
expect(pm.storage).toStrictEqual<Array<Message>>([{
type: MessageType.docChange,
body: {
startInFile: 19,
endInFile: 19,
startInFile: 19,
endInFile: 19,
finalText: " "
}
}]);
Expand Down
2 changes: 1 addition & 1 deletion __tests__/mathinline.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { toMathInline } from "../editor/src/kroqed-editor/translation/toProsemirror/parser"
import { toMathInline } from "../editor/src/waterproof-editor/translation/toProsemirror/parser"


test("Replace $ inside of markdown", () => {
Expand Down
6 changes: 3 additions & 3 deletions __tests__/mv-mapping.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable @typescript-eslint/ban-ts-comment */
// Disable because the @ts-expect-error clashes with the tests
import { TextDocMappingMV as TextDocMapping } from "../editor/src/kroqed-editor/mappingModel/mvFile";
import { TextDocMappingMV as TextDocMapping } from "../editor/src/mapping/mvFile";
import { ReplaceStep } from "prosemirror-transform";
import { WaterproofSchema } from "../editor/src/kroqed-editor/schema";
import { translateMvToProsemirror } from "../editor/src/kroqed-editor/translation/toProsemirror";
import { WaterproofSchema } from "../editor/src/waterproof-editor/schema";
import { translateMvToProsemirror } from "../editor/src/waterproof-editor/translation/toProsemirror";
import { expect } from "@jest/globals";

test("Normal coqdown", () => {
Expand Down
6 changes: 3 additions & 3 deletions __tests__/mvFileToProsemirror.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-useless-escape */
// Disable due to test data including latex code
import { translateMvToProsemirror } from "../editor/src/kroqed-editor/translation/toProsemirror/mvFileToProsemirror";
import { translateMvToProsemirror } from "../editor/src/waterproof-editor/translation/toProsemirror/mvFileToProsemirror";
import { expect } from "@jest/globals";

test("Expect empty input to return empty output", () => {
Expand Down Expand Up @@ -72,7 +72,7 @@ test("entire document", () => {
})

test("entire document2", () => {
const docString = `# This is a header.
const docString = `# This is a header.

This is a paragraph. Paragraphs support inline LaTeX like $5+3=22$. Underneath you'll find a math display block.
$$
Expand Down Expand Up @@ -102,7 +102,7 @@ Proof.
- simpl. rewrite IHl. simpl. reflexivity.
Qed.
\`\`\``
const predict = `<markdown># This is a header.
const predict = `<markdown># This is a header.

This is a paragraph. Paragraphs support inline LaTeX like $5+3=22$. Underneath you'll find a math display block.
</markdown><math-display>
Expand Down
6 changes: 3 additions & 3 deletions __tests__/parser.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { translateCoqDoc } from "../editor/src/kroqed-editor/translation/toProsemirror/parser";
import { translateCoqDoc } from "../editor/src/waterproof-editor/translation/toProsemirror/parser";


/*
Expand Down Expand Up @@ -82,12 +82,12 @@ test("Preserves whitespace inside coq code cell.", () => {


test("From indented list in Coqdoc comments, make markdown list", () => {

expect(translateCoqDoc("- First item\n- Second item\n - Indented item\n - Second indented item\n- Third item"))
.toBe(`- First item\n- Second item\n - Indented item\n - Second indented item\n- Third item`);
});

/* TEMPLATE
/* TEMPLATE
test("name", () => {
expect(translateCoqDoc("input")).toBe("expected output");
});
Expand Down
4 changes: 2 additions & 2 deletions __tests__/prosedoc-construction/block-extractions.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { extractCoqBlocks, extractCoqDoc, extractHintBlocks, extractInputBlocks, extractMathDisplayBlocks, extractMathDisplayBlocksCoqDoc } from "../../editor/src/kroqed-editor/prosedoc-construction/block-extraction";
import { isCoqBlock, isCoqDocBlock, isHintBlock, isInputAreaBlock, isMathDisplayBlock } from "../../editor/src/kroqed-editor/prosedoc-construction/blocks/typeguards";
import { extractCoqBlocks, extractCoqDoc, extractHintBlocks, extractInputBlocks, extractMathDisplayBlocks, extractMathDisplayBlocksCoqDoc } from "../../editor/src/document-construction/block-extraction";
import { isCoqBlock, isCoqDocBlock, isHintBlock, isInputAreaBlock, isMathDisplayBlock } from "../../editor/src/waterproof-editor/document/blocks/typeguards";

test("Identify input blocks", () => {
const document = "# Example\n<input-area>\n# Test input area\n</input-area>\n";
Expand Down
10 changes: 5 additions & 5 deletions __tests__/prosedoc-construction/inner-blocks.test.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createCoqDocInnerBlocks, createCoqInnerBlocks, createInputAndHintInnerBlocks } from "../../editor/src/kroqed-editor/prosedoc-construction/blocks/inner-blocks";
import { isCoqCodeBlock, isCoqDocBlock, isCoqMarkdownBlock, isMathDisplayBlock } from "../../editor/src/kroqed-editor/prosedoc-construction/blocks/typeguards";
import { createCoqDocInnerBlocks, createCoqInnerBlocks, createInputAndHintInnerBlocks } from "../../editor/src/document-construction/inner-blocks";
import { isCoqCodeBlock, isCoqDocBlock, isCoqMarkdownBlock, isMathDisplayBlock } from "../../editor/src/waterproof-editor/document/blocks/typeguards";
import { expect } from "@jest/globals";

test("Inner input area (and hint) blocks", () => {
const inputAreaContent = "$$1028 + 23 = ?$$\n```coq\nCompute 1028 + 23.\n```";

const blocks = createInputAndHintInnerBlocks(inputAreaContent);

expect(blocks.length).toBe(2);
Expand All @@ -28,7 +28,7 @@ test("Inner coq blocks", () => {
// One block for the coq content and one block for the comment.
expect(blocks.length).toBe(2);
expect(isCoqCodeBlock(blocks[0])).toBe(true);

expect(blocks[0].stringContent).toBe("Compute 1 + 1.");
expect(blocks[0].range.from).toBe(0);
expect(blocks[0].range.to).toBe(14);
Expand All @@ -37,7 +37,7 @@ test("Inner coq blocks", () => {
expect(blocks[1].stringContent).toBe("* Header ");
expect(blocks[1].range.from).toBe(14);
expect(blocks[1].range.to).toBe(coqContent.length);

expect(blocks[1].innerBlocks?.length).toBe(1);
expect(isCoqMarkdownBlock(blocks[1].innerBlocks![0])).toBe(true);
});
Expand Down
20 changes: 10 additions & 10 deletions __tests__/prosedoc-construction/top-level-construction.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* eslint-disable no-useless-escape */
// Disable due to latex code in sample data
import { topLevelBlocksMV, topLevelBlocksV } from "../../editor/src/kroqed-editor/prosedoc-construction";
import { blocksFromMV, blocksFromV } from "../../editor/src/document-construction/construct-document";
import { expect } from '@jest/globals';
import { MarkdownBlock } from "../../editor/src/kroqed-editor/prosedoc-construction/blocks/blocktypes";
import { isHintBlock, isInputAreaBlock, isMarkdownBlock, isMathDisplayBlock, isCoqBlock } from "../../editor/src/kroqed-editor/prosedoc-construction/blocks/typeguards";
import { MarkdownBlock } from "../../editor/src/waterproof-editor/document/blocks";
import { isHintBlock, isInputAreaBlock, isMarkdownBlock, isMathDisplayBlock, isCoqBlock } from "../../editor/src/waterproof-editor/document/blocks/typeguards";

const inputDocumentMV = `# Example document
<hint title="example hint (like for imports)">
Expand Down Expand Up @@ -31,27 +31,27 @@ Random Markdown list:

// FIXME: Add checks for prewhite and postwhite here.
test("Parse top level blocks (MV)", () => {
const blocks = topLevelBlocksMV(inputDocumentMV);
const blocks = blocksFromMV(inputDocumentMV);
expect(blocks.length).toBe(8);

expect(isMarkdownBlock(blocks[0])).toBe(true);
expect(blocks[0].stringContent).toBe("# Example document\n");

expect(isHintBlock(blocks[1])).toBe(true);
expect(blocks[1].stringContent).toBe("\n```coq\nRequire Import ZArith.\n```\n");

expect(isMarkdownBlock(blocks[2])).toBe(true);
expect((blocks[2] as MarkdownBlock).isNewLineOnly).toBe(true);

expect(isInputAreaBlock(blocks[3])).toBe(true);
expect(blocks[3].stringContent).toBe("\n$$1028 + 23 = ?$$\n```coq\nCompute 1028 + 23.\n```\n");

expect(isMarkdownBlock(blocks[4])).toBe(true);
expect(blocks[4].stringContent).toBe("\n#### Markdown content\n");

expect(isMathDisplayBlock(blocks[5])).toBe(true);
expect(blocks[5].stringContent).toBe(" \int_0^2 x dx ");

expect(isCoqBlock(blocks[6])).toBe(true);
expect(blocks[6].stringContent).toBe("Compute 1 + 1.");

Expand All @@ -74,7 +74,7 @@ Qed.
`;

test("Parse top level blocks (V)", () => {
const blocks = topLevelBlocksV(inputDocumentV);
const blocks = blocksFromV(inputDocumentV);
// coqblock, hint, input, coqblock

expect(blocks.length).toBe(4);
Expand Down
12 changes: 6 additions & 6 deletions __tests__/prosedoc-construction/utils.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Block } from "../../editor/src/kroqed-editor/prosedoc-construction/blocks";
import { text } from "../../editor/src/kroqed-editor/prosedoc-construction/blocks/schema";
import { extractInterBlockRanges, iteratePairs, maskInputAndHints, sortBlocks } from "../../editor/src/kroqed-editor/prosedoc-construction/utils";
import { Block } from "../../editor/src/waterproof-editor/document/blocks";
import { text } from "../../editor/src/waterproof-editor/document/blocks/schema";
import { extractInterBlockRanges, iteratePairs, maskInputAndHints, sortBlocks } from "../../editor/src/waterproof-editor/document/utils";

const toProseMirror = () => text("null");
const debugPrint = () => null;
Expand All @@ -9,7 +9,7 @@ test("Sort blocks #1", () => {
const stringContent = "";

const testBlocks = [
{type: "second", range: {from: 1, to: 2}, stringContent, toProseMirror, debugPrint},
{type: "second", range: {from: 1, to: 2}, stringContent, toProseMirror, debugPrint},
{type: "first", range: {from: 0, to: 1}, stringContent, toProseMirror, debugPrint}
];

Expand All @@ -23,7 +23,7 @@ test("Sort blocks #2", () => {
const stringContent = "";

const testBlocks = [
{type: "second", range: {from: 1, to: 2}, stringContent, toProseMirror, debugPrint},
{type: "second", range: {from: 1, to: 2}, stringContent, toProseMirror, debugPrint},
{type: "first", range: {from: 0, to: 1}, stringContent, toProseMirror, debugPrint},
{type: "third", range: {from: 2, to: 3}, stringContent, toProseMirror, debugPrint}
];
Expand All @@ -40,7 +40,7 @@ test("Sort blocks #2", () => {
// const stringContent = "";
// const toProseMirror = () => null;
// const testBlocks = [
// {type: "second", range: {from: 0, to: 1}, stringContent, toProseMirror},
// {type: "second", range: {from: 0, to: 1}, stringContent, toProseMirror},
// {type: "first", range: {from: 0, to: 1}, stringContent, toProseMirror}
// ];

Expand Down
10 changes: 6 additions & 4 deletions cypress/e2e/basic.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ describe('Basic tests', () => {
it('Editor opens, contains all parts and displays file', () => {
// Editor is visible
cy.get("#editor").should("be.visible");
// Menubar is visible
cy.get(".menubar").should("be.visible");
// Menubar is not visible by default
cy.get(".menubar").should("not.be.visible");

// Progress bar is visible
// TODO: Progress bar only appears after clicking in the editor?
Expand All @@ -32,7 +32,9 @@ describe('Basic tests', () => {

// TODO: This also immediately opens the markdown editor for the H1
cy.window().then((win) => { win.postMessage({type: MessageType.teacher, body: true}) });
cy.get('coqblock > .cm-editor > .cm-scroller > .cm-content').click(); // to reset h1
// now that we are in teacher mode the menubar should be visible
cy.get(".menubar").should("be.visible");
cy.get("coqblock > .cm-editor > .cm-scroller > .cm-content").click(); // to reset h1
cy.get("#editor h1").should("be.visible");
cy.get("#editor h1").click();
cy.get(".markdown-view").should("be.visible");
Expand All @@ -42,7 +44,7 @@ describe('Basic tests', () => {
cy.window().then((win) => { win.postMessage({type: MessageType.teacher, body: true}) });
cy.get(".markdown-view").type("\n## Hello World");
cy.get(".markdown-view").should("contain.text", "Hello World");
cy.nthCoqCode(0).click(); // to reset h1
cy.nthCode(0).click(); // to reset h1
cy.get("H2").should("exist");

// We record edits in the 'edits' global variable
Expand Down
7 changes: 5 additions & 2 deletions cypress/e2e/line-numbers.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { MessageType } from "../../shared";
import { setupTest } from "./util";

const edits = [];
const initialDocument = "# Title\n<input-area>\n```coq\nDefinition foo := 42.\n```\n</input-area>\n";
const initialDocument = "# Title\n```coq\nDefinition foo := 42.\n```\n";

const callbacks = {
[MessageType.lineNumbers]: (data: { linenumbers: number[]; }) => {
Expand All @@ -29,7 +29,9 @@ describe('Line numbers', () => {
beforeEach(() => { setupTest(initialDocument, edits, callbacks); });

it("Toggle display of line numbers", () => {
// CodeMirror Editor should exist
cy.get('.cm-content').should("exist");
// The line number gutter should not exist
cy.get('.cm-gutter').should("not.exist");
cy.window().then((win) => {
win.postMessage({
Expand All @@ -39,7 +41,8 @@ describe('Line numbers', () => {
});
cy.wait(1);
cy.get('.cm-gutter').should("exist");
cy.get('.cm-gutter').should("contain", "4");
// Third line contains the coq code
cy.get('.cm-gutter').should("contain", "3");
cy.window().then((win) => {
win.postMessage({
type: MessageType.setShowLineNumbers,
Expand Down
Loading
Loading