Skip to content

Commit

Permalink
finished first integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
turingtestfail committed Jun 7, 2024
1 parent 269e4db commit f8dc398
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1760,6 +1760,7 @@ public String getMapMLHTMLDocument() {
.append("mapml-viewer:not(:defined) > :not(layer-) { display: initial; }\n")
.append("</style>\n")
.append("</noscript>\n")
.append(String.join("\n", headerContentTemplates))
.append("</head>\n")
.append("<body>\n")
.append("<mapml-viewer projection=\"")
Expand Down Expand Up @@ -1806,7 +1807,7 @@ private List<String> getTemplates(String templateName) {
featureType = (SimpleFeatureType) mapLayerInfo.getFeature().getFeatureType();
if (!featureTemplate.isTemplateEmpty(
featureType, templateName, FeatureTemplate.class, "0\n")) {
// no feature is passed in so none is needed for this template
// no feature is passed in so use an empty one
SimpleFeature feature = DataUtilities.template(featureType);
templates.add(
featureTemplate.template(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1590,6 +1590,15 @@ public void testPreviewHeadTemplate() throws Exception {
File parent = getDataDirectory().get(resource).dir();
template = new File(parent, MAPML_PREVIEW_HEAD_FTL);
FileUtils.write(template, "<link rel=\"stylesheet\" href=\"mystyle.css\">", "UTF-8");
FileUtils.write(
template,
"<style>\n"
+ " body {\n"
+ " background-color: linen;\n"
+ " }\n"
+ "</style>",
"UTF-8",
true);

String path =
"cite/wms?LAYERS=Lakes"
Expand All @@ -1605,10 +1614,13 @@ public void testPreviewHeadTemplate() throws Exception {
+ MapMLConstants.MAPML_WMS_MIME_TYPE_OPTION
+ ":image/png";
Document doc = getAsJSoup(path);
Element layer = doc.select("mapml-viewer > layer-").first();
String layerSrc = layer.attr("src");
assertThat(layerSrc, startsWith("http://localhost:8080/geoserver/cite/wms?"));
assertThat(layerSrc, containsString("LAYERS=Lakes"));
Element link = doc.select("link").first();
String linkRel = link.attr("rel");
String linkSrc = link.attr("href");
assertThat(linkRel, containsString("stylesheet"));
assertThat(linkSrc, containsString("mystyle.css"));
Element style = doc.select("style").get(2);
assertEquals("body {\n" + " background-color: linen;\n" + " }", style.html());
} finally {
if (template != null) {
template.delete();
Expand Down

0 comments on commit f8dc398

Please sign in to comment.