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 package info.magnolia.templating.freemarker;
35
36 import static org.junit.Assert.assertThat;
37 import static org.junit.matchers.JUnitMatchers.containsString;
38 import info.magnolia.rendering.template.configured.ConfiguredTemplateDefinition;
39
40 import org.junit.Before;
41 import org.junit.Test;
42
43
44
45
46 public class InitDirectiveTest extends AbstractDirectiveTestCase {
47
48 private ConfiguredTemplateDefinition renderableDef;
49
50 @Override
51 @Before
52 public void setUp() throws Exception {
53 super.setUp();
54 renderableDef = new ConfiguredTemplateDefinition();
55 }
56
57
58 @Test
59 public void testRenderSimpleBar() throws Exception {
60
61
62
63 final String result = renderForTest("[@cms.init /]", renderableDef);
64
65
66 assertThat(result, containsString("<meta name=\"gwt:property\" content=\"locale=en_US\"/>"));
67
68
69 }
70
71 @Test
72 public void testRenderWithContent() throws Exception {
73
74
75
76 final String result = renderForTest("[@cms.init /]", renderableDef);
77
78
79 assertThat(result, containsString("<!-- cms:page content=\"testWorkspace:/foo/bar/paragraphs/1\" preview=\"false\" -->\n<!-- /cms:page -->"));
80
81 }
82
83
84 @Test
85 public void testRenderWithContentAndDialog() throws Exception {
86
87
88
89 final String result = renderForTest("[@cms.init dialog='newTagDefinedDialog' /]", renderableDef);
90
91
92 assertThat(result, containsString("<!-- cms:page content=\"testWorkspace:/foo/bar/paragraphs/1\" dialog=\"newTagDefinedDialog\" preview=\"false\" -->\n<!-- /cms:page -->"));
93 }
94 }