-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathJellyCompletionContributorTest.java
More file actions
101 lines (89 loc) · 2.99 KB
/
JellyCompletionContributorTest.java
File metadata and controls
101 lines (89 loc) · 2.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
package org.kohsuke.stapler.idea;
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
public class JellyCompletionContributorTest extends BasePlatformTestCase {
@Override
protected String getTestDataPath() {
return "src/test/testData";
}
public void testDefaultTagLibrary() {
assertDefaultTagLibrary(
"""
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
<l:b<caret>
</j:jelly>
""",
"""
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<l:basic />
</j:jelly>
""");
}
public void testRequiredAttributes() {
assertDefaultTagLibrary(
"""
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
<l:req<caret>
</j:jelly>
""",
"""
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<l:required title="" />
</j:jelly>
""");
}
public void testInvokeBody() {
assertDefaultTagLibrary(
"""
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core">
<l:child<caret>
</j:jelly>
""",
"""
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<l:children>
\s
</l:children>
</j:jelly>
""");
}
public void testCustomTagLibrary() {
myFixture.copyDirectoryToProject("testlib", "testlib");
myFixture.configureByText(
"basic.jelly",
"""
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:t="/testlib">
<t:t<caret>
</j:jelly>
""");
myFixture.completeBasic();
myFixture.checkResult(
"""
<?xml version="1.0" encoding="UTF-8"?>
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:t="/testlib">
<t:test />
</j:jelly>
""");
}
private void assertDefaultTagLibrary(String body, String expected) {
// Simulate the default tag libraries in core
myFixture.copyDirectoryToProject("lib", "lib");
myFixture.configureByText("basic.jelly", body);
myFixture.completeBasic();
myFixture.checkResult(expected);
}
}