use of com.squarespace.template.Arguments in project template-compiler by Squarespace.
the class CoreFormattersTest method testMod.
@Test
public void testMod() throws CodeException {
CodeMaker mk = maker();
Arguments args = mk.args(" 3");
assertFormatter(MOD, args, "4", "1");
assertFormatter(MOD, args, "5", "2");
assertFormatter(MOD, args, "6", "0");
// Bad modulus defaults to 2
args = mk.args(" abc");
assertFormatter(MOD, args, "5", "1");
// Bad value defaults to 0
assertFormatter(MOD, args, "\"abc\"", "0");
}
use of com.squarespace.template.Arguments in project template-compiler by Squarespace.
the class CoreFormattersTest method testRound.
@Test
public void testRound() throws CodeException {
CodeMaker mk = maker();
Arguments args = mk.args("");
assertFormatter(ROUND, args, "1.44", "1");
assertFormatter(ROUND, args, "1.6", "2");
}
use of com.squarespace.template.Arguments in project template-compiler by Squarespace.
the class CoreFormattersTest method testOutput.
@Test
public void testOutput() throws CodeException {
CodeMaker mk = maker();
Arguments args = mk.args(":1:2:3");
assertFormatter(OUTPUT, args, "{}", "1 2 3");
}
use of com.squarespace.template.Arguments in project template-compiler by Squarespace.
the class ContentFormattersTest method testSquarespaceThumbnail.
@Test
public void testSquarespaceThumbnail() throws CodeException {
CodeMaker mk = maker();
Arguments args = mk.args(" 50");
String json = "\"100x200\"";
assertFormatter(SQSP_THUMB_FOR_WIDTH, args, json, "100w");
assertFormatter(SQSP_THUMB_FOR_HEIGHT, args, json, "100w");
args = mk.args(" 600");
json = "\"1200x2400\"";
assertFormatter(SQSP_THUMB_FOR_WIDTH, args, json, "750w");
assertFormatter(SQSP_THUMB_FOR_HEIGHT, args, json, "300w");
}
Aggregations