Skip to content

Commit

Permalink
counters() type parsing fix
Browse files Browse the repository at this point in the history
  • Loading branch information
radkovo committed Jun 12, 2018
1 parent 0eace02 commit f4c645b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/cz/vutbr/web/csskit/fn/CounterImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class CounterImpl extends TermFunctionImpl implements TermFunction.Counte
allowedStyles = new HashMap<>(ListStyleType.values().length - 4);
for (ListStyleType item : ListStyleType.values()) {
if (item != ListStyleType.INHERIT && item != ListStyleType.INITIAL
&& item != ListStyleType.UNSET && item != ListStyleType.NONE) {
&& item != ListStyleType.UNSET) {
allowedStyles.put(item.toString(), item);
}
}
Expand Down
9 changes: 9 additions & 0 deletions src/test/java/test/FunctionsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import cz.vutbr.web.css.TermLengthOrPercent;
import cz.vutbr.web.css.TermNumeric.Unit;
import cz.vutbr.web.css.TermRect;
import cz.vutbr.web.css.TermString;
import cz.vutbr.web.csskit.CalcArgs;
import cz.vutbr.web.csskit.fn.AttrImpl;
import cz.vutbr.web.csskit.fn.BlurImpl;
Expand Down Expand Up @@ -207,6 +208,7 @@ public class FunctionsTest {
"p:before { content: counter(chapter_counter, lower-alpha); }",
"p:before { content: counters(chapter_counter, '..'); }",
"p:before { content: counters(chapter_counter, '::', lower-roman); }",
"p:before { content: counter(c, none) \"z\"; }"
};

/* invalid content functions */
Expand Down Expand Up @@ -768,6 +770,13 @@ public void contentValid() throws IOException, CSSException
assertEquals("Separator is correct", "::", ((CountersImpl) fn).getSeparator());
assertEquals("Style is correct", CSSProperty.ListStyleType.LOWER_ROMAN, ((CountersImpl) fn).getStyle());
break;
case 5:
assertEquals(CounterImpl.class, fn.getClass());
assertEquals("Name is correct", "c", ((CounterImpl) fn).getName());
assertEquals("Style is correct", CSSProperty.ListStyleType.NONE, ((CounterImpl) fn).getStyle());
TermString str = (TermString) d.get(1);
assertEquals("String is parsed", "z", str.getValue());
break;
}
}
}
Expand Down

0 comments on commit f4c645b

Please sign in to comment.