|
25 | 25 | import org.junit.jupiter.api.BeforeEach; |
26 | 26 | import org.junit.jupiter.api.Order; |
27 | 27 | import org.junit.jupiter.api.Test; |
| 28 | +import org.openqa.selenium.WebElement; |
28 | 29 | import org.xwiki.administration.test.po.TemplateProviderInlinePage; |
29 | 30 | import org.xwiki.administration.test.po.TemplatesAdministrationSectionPage; |
30 | 31 | import org.xwiki.model.reference.DocumentReference; |
@@ -358,6 +359,29 @@ void createPageFromForbiddenTemplate(TestUtils setup, TestReference testReferenc |
358 | 359 | assertEquals("Some content in that page", viewPage.getContent()); |
359 | 360 | } |
360 | 361 |
|
| 362 | + /** |
| 363 | + * The goal of this test is to check that the template provider's title is correctly escaped. |
| 364 | + */ |
| 365 | + @Test |
| 366 | + @Order(5) |
| 367 | + void templateProviderTitleEscaping(TestUtils setup, TestReference testReference) throws Exception |
| 368 | + { |
| 369 | + cleanUp(setup, testReference); |
| 370 | + |
| 371 | + // Create a template |
| 372 | + String templateContent = "Templates are fun"; |
| 373 | + String providerName = "{{html}}<span>HTML</span>{{/html}}"; |
| 374 | + LocalDocumentReference templateProviderReference = new LocalDocumentReference(providerName, |
| 375 | + testReference.getLocalDocumentReference().getParent()); |
| 376 | + createTemplateAndTemplateProvider(setup, templateProviderReference, templateContent, |
| 377 | + "Funny templates", true); |
| 378 | + |
| 379 | + TemplatesAdministrationSectionPage adminPage = TemplatesAdministrationSectionPage.gotoPage(); |
| 380 | + List<WebElement> links = adminPage.getExistingTemplatesLinks(); |
| 381 | + assertFalse(links.stream().anyMatch(element -> element.getText().equals("HTML"))); |
| 382 | + assertTrue(links.stream().anyMatch(element -> providerName.equals(element.getText()))); |
| 383 | + } |
| 384 | + |
361 | 385 | /** |
362 | 386 | * Helper function to Create both a Template and a Template Provider for the tests in this class. |
363 | 387 | */ |
|
0 commit comments