Skip to content

Commit 1cc0e9e

Browse files
author
Zaydek Michels-Gualtieri
committed
Added deleteRTL test suite
1 parent cfeb7f5 commit 1cc0e9e

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import deleteRTL from "./deleteRTL"
2+
import keyCodeFor from "lib/Client/keyCodeFor"
3+
4+
import { // Unsorted
5+
mockNonMacOS,
6+
mockMacOS,
7+
} from "lib/Client/mockUserAgent"
8+
9+
/*
10+
* rune
11+
*/
12+
test("rune(...)", () => {
13+
expect(deleteRTL.rune({
14+
shiftKey: false,
15+
ctrlKey: false,
16+
metaKey: false,
17+
keyCode: keyCodeFor("Backspace"),
18+
})).toBeTruthy()
19+
})
20+
21+
/*
22+
* word
23+
*/
24+
test("word(...); non-macOS", () => {
25+
mockNonMacOS()
26+
expect(deleteRTL.word({
27+
shiftKey: false,
28+
ctrlKey: true,
29+
altKey: false, // TODO
30+
metaKey: false,
31+
keyCode: keyCodeFor("Backspace"),
32+
})).toBeTruthy()
33+
})
34+
test("word(...); macOS", () => {
35+
mockMacOS()
36+
expect(deleteRTL.word({
37+
shiftKey: false,
38+
ctrlKey: false,
39+
altKey: true, // TODO
40+
metaKey: false,
41+
keyCode: keyCodeFor("Backspace"),
42+
})).toBeTruthy()
43+
})
44+
45+
/*
46+
* line
47+
*/
48+
test("line(...)", () => {
49+
expect(deleteRTL.line({
50+
shiftKey: false,
51+
ctrlKey: false,
52+
altKey: false, // TODO
53+
metaKey: true,
54+
keyCode: keyCodeFor("Backspace"),
55+
})).toBeTruthy()
56+
})

src/RichTextEditor/utils/keyDownTypeFor/history.test.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import { // Unsorted
66
mockMacOS,
77
} from "lib/Client/mockUserAgent"
88

9+
/*
10+
* undo
11+
*/
912
test("undo(...); non-macOS", () => {
1013
mockNonMacOS()
1114
expect(history.undo({
@@ -21,7 +24,6 @@ test("undo(...); non-macOS", () => {
2124
keyCode: keyCodeFor("Z"),
2225
})).toBeTruthy()
2326
})
24-
2527
test("undo(...); macOS", () => {
2628
mockMacOS()
2729
expect(history.undo({
@@ -38,6 +40,9 @@ test("undo(...); macOS", () => {
3840
})).toBeTruthy()
3941
})
4042

43+
/*
44+
* redo
45+
*/
4146
test("redo(...); non-macOS", () => {
4247
mockNonMacOS()
4348
expect(history.redo({
@@ -53,7 +58,6 @@ test("redo(...); non-macOS", () => {
5358
keyCode: keyCodeFor("Y"),
5459
})).toBeTruthy()
5560
})
56-
5761
test("redo(...); macOS", () => {
5862
mockMacOS()
5963
expect(history.redo({

0 commit comments

Comments
 (0)