Permalink
Browse files

Added test for CSS comment to skip select images in CSS file

  • Loading branch information...
1 parent 6e502f1 commit cbc12a863399869d00e8dade047061bc441e7456 @RoryH RoryH committed Jul 19, 2011
Showing with 14 additions and 0 deletions.
  1. +14 −0 tests/net/nczonline/web/cssembed/CSSURLEmbedderTest.java
@@ -232,4 +232,18 @@ public void testRegularUrlWithMhtml() throws IOException {
String result = writer.toString();
assertEquals("background: url(folder.txt);", result);
}
+
+ @Test
+ public void testRegularUrlWithSkipComment() throws IOException {
+ String filename = CSSURLEmbedderTest.class.getResource("folder.png").getPath().replace("%20", " ");
+ String code = "background: url(folder.png); /* CssEmbed: SKIP */";
+
+ StringWriter writer = new StringWriter();
+ embedder = new CSSURLEmbedder(new StringReader(code), true);
+ embedder.embedImages(writer, filename.substring(0, filename.lastIndexOf("/")+1));
+
+ String result = writer.toString();
+ //assert that nothing changed
+ assertEquals(code, result);
+ }
}

0 comments on commit cbc12a8

Please sign in to comment.