Skip to content

Commit cfeb7f5

Browse files
author
Zaydek Michels-Gualtieri
committed
Added applyFormat test suite
1 parent 3fd6a3c commit cfeb7f5

File tree

1 file changed

+117
-0
lines changed

1 file changed

+117
-0
lines changed
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
import applyFormat from "./applyFormat"
2+
import keyCodeFor from "lib/Client/keyCodeFor"
3+
4+
import { // Unsorted
5+
mockNonMacOS,
6+
mockMacOS,
7+
} from "lib/Client/mockUserAgent"
8+
9+
/*
10+
* em
11+
*/
12+
test("em(...); non-macOS", () => {
13+
mockNonMacOS()
14+
expect(applyFormat.em({
15+
shiftKey: false,
16+
ctrlKey: true,
17+
metaKey: false,
18+
keyCode: keyCodeFor("I"),
19+
})).toBeTruthy()
20+
})
21+
test("em(...); macOS", () => {
22+
mockMacOS()
23+
expect(applyFormat.em({
24+
shiftKey: false,
25+
ctrlKey: false,
26+
metaKey: true,
27+
keyCode: keyCodeFor("I"),
28+
})).toBeTruthy()
29+
})
30+
31+
/*
32+
* strong
33+
*/
34+
test("strong(...); non-macOS", () => {
35+
mockNonMacOS()
36+
expect(applyFormat.strong({
37+
shiftKey: false,
38+
ctrlKey: true,
39+
metaKey: false,
40+
keyCode: keyCodeFor("B"),
41+
})).toBeTruthy()
42+
})
43+
test("strong(...); macOS", () => {
44+
mockMacOS()
45+
expect(applyFormat.strong({
46+
shiftKey: false,
47+
ctrlKey: false,
48+
metaKey: true,
49+
keyCode: keyCodeFor("B"),
50+
})).toBeTruthy()
51+
})
52+
53+
/*
54+
* code
55+
*/
56+
test("code(...); non-macOS", () => {
57+
mockNonMacOS()
58+
expect(applyFormat.code({
59+
shiftKey: true,
60+
ctrlKey: true,
61+
metaKey: false,
62+
keyCode: keyCodeFor("C"),
63+
})).toBeTruthy()
64+
})
65+
test("code(...); macOS", () => {
66+
mockMacOS()
67+
expect(applyFormat.code({
68+
shiftKey: true,
69+
ctrlKey: false,
70+
metaKey: true,
71+
keyCode: keyCodeFor("C"),
72+
})).toBeTruthy()
73+
})
74+
75+
/*
76+
* strike
77+
*/
78+
test("strike(...); non-macOS", () => {
79+
mockNonMacOS()
80+
expect(applyFormat.strike({
81+
shiftKey: true,
82+
ctrlKey: true,
83+
metaKey: false,
84+
keyCode: keyCodeFor("X"),
85+
})).toBeTruthy()
86+
})
87+
test("strike(...); macOS", () => {
88+
mockMacOS()
89+
expect(applyFormat.strike({
90+
shiftKey: true,
91+
ctrlKey: false,
92+
metaKey: true,
93+
keyCode: keyCodeFor("X"),
94+
})).toBeTruthy()
95+
})
96+
97+
/*
98+
* a
99+
*/
100+
test("a(...); non-macOS", () => {
101+
mockNonMacOS()
102+
expect(applyFormat.a({
103+
shiftKey: false,
104+
ctrlKey: true,
105+
metaKey: false,
106+
keyCode: keyCodeFor("K"),
107+
})).toBeTruthy()
108+
})
109+
test("a(...); macOS", () => {
110+
mockMacOS()
111+
expect(applyFormat.a({
112+
shiftKey: false,
113+
ctrlKey: false,
114+
metaKey: true,
115+
keyCode: keyCodeFor("K"),
116+
})).toBeTruthy()
117+
})

0 commit comments

Comments
 (0)