Java Code Examples for com.helger.css.ECSSVersion#LATEST
The following examples show how to use
com.helger.css.ECSSVersion#LATEST .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Issue34Test.java From ph-css with Apache License 2.0 | 5 votes |
@Test @Ignore ("TODO") public void testIssue () { final String css = ".pen {background-color:red} {* some incorrect block *} .pen {background-color: blue}"; final CSSReaderSettings aSettings = new CSSReaderSettings ().setCSSVersion (ECSSVersion.LATEST) .setBrowserCompliantMode (true) .setCustomErrorHandler (new LoggingCSSParseErrorHandler ()) .setCustomExceptionHandler (new LoggingCSSParseExceptionCallback ()); final CascadingStyleSheet cascadingStyleSheet = CSSReader.readFromStringStream (css, aSettings); assertNotNull (cascadingStyleSheet); final CSSWriter writer = new CSSWriter (new CSSWriterSettings (ECSSVersion.LATEST, true)); LOGGER.info (writer.getCSSAsString (cascadingStyleSheet)); }
Example 2
Source File: Issue36Test.java From ph-css with Apache License 2.0 | 5 votes |
@Test public void testIssue () { final String css = "@media screen and (min-width: 768px) {.section {.\r\n" + " padding: 40px\r\n" + "}\r\n" + "\r\n" + "}"; final CSSReaderSettings aSettings = new CSSReaderSettings ().setCSSVersion (ECSSVersion.LATEST) .setBrowserCompliantMode (true) .setCustomErrorHandler (new DoNothingCSSParseErrorHandler ()); final CascadingStyleSheet cascadingStyleSheet = CSSReader.readFromStringStream (css, aSettings); final CSSWriter writer = new CSSWriter (new CSSWriterSettings (ECSSVersion.LATEST, true)); assertEquals ("@media screen and (min-width:768px){.section{}}", writer.getCSSAsString (cascadingStyleSheet)); }
Example 3
Source File: Issue33Test.java From ph-css with Apache License 2.0 | 5 votes |
@Test public void testIssue () { // No log message may be issued in this test! final String css = "@media \\0screen\\,screen\\9 {.test {margin-left: 0px}}"; final CSSReaderSettings aSettings = new CSSReaderSettings ().setCSSVersion (ECSSVersion.LATEST) .setBrowserCompliantMode (true) .setInterpretErrorHandler (new DoNothingCSSInterpretErrorHandler ()); final CascadingStyleSheet cascadingStyleSheet = CSSReader.readFromStringStream (css, aSettings); final CSSWriter writer = new CSSWriter (new CSSWriterSettings (ECSSVersion.LATEST, true)); assertEquals ("@media \\0screen\\,screen\\9 {.test{margin-left:0}}", writer.getCSSAsString (cascadingStyleSheet)); }
Example 4
Source File: Issue38Test.java From ph-css with Apache License 2.0 | 5 votes |
@Test public void testIssue () { final String css = "h1:lang(or) { line-height: 1.2em; }"; final CSSReaderSettings aSettings = new CSSReaderSettings ().setCSSVersion (ECSSVersion.LATEST) .setBrowserCompliantMode (true); final CascadingStyleSheet cascadingStyleSheet = CSSReader.readFromStringStream (css, aSettings); final CSSWriter writer = new CSSWriter (new CSSWriterSettings (ECSSVersion.LATEST, true)); assertEquals ("h1:lang(or){line-height:1.2em}", writer.getCSSAsString (cascadingStyleSheet)); }
Example 5
Source File: Issue35Test.java From ph-css with Apache License 2.0 | 5 votes |
@Test public void testIssue () { final String css = StreamHelper.getAllBytesAsString (new FileSystemResource ("src/test/resources/testfiles/css30/good/issue35.css"), StandardCharsets.UTF_8); final CSSReaderSettings aSettings = new CSSReaderSettings ().setCSSVersion (ECSSVersion.LATEST) .setBrowserCompliantMode (false); final CascadingStyleSheet cascadingStyleSheet = CSSReader.readFromStringStream (css, aSettings); assertNotNull (cascadingStyleSheet); final CSSWriter writer = new CSSWriter (new CSSWriterSettings (ECSSVersion.LATEST, true)); assertNotNull (writer.getCSSAsString (cascadingStyleSheet)); }
Example 6
Source File: CSSWriterSettings.java From ph-css with Apache License 2.0 | 4 votes |
/** * Default constructor using the latest CSS version and none-optimized output. */ public CSSWriterSettings () { this (ECSSVersion.LATEST, DEFAULT_OPTIMIZED_OUTPUT); }