Tests for some first/last stuff.

From @spacether.
This commit is contained in:
Michael Bayne
2021-02-04 13:20:00 -08:00
parent 460ea475a7
commit ca08cdb1a4
@@ -473,6 +473,26 @@ public abstract class SharedTests extends GWTTestCase
context("things", Arrays.asList("foo")));
}
@Test public void testFirstLastCombo () {
test("FIRST_and_LAST", "{{#things}}{{#-first}}FIRST{{/-first}}{{this}}{{#-last}}LAST{{/-last}}{{/things}}",
context("things", Arrays.asList("_and_")));
}
@Test public void testInverseFirstLastCombo () {
test("_and_", "{{#things}}{{^-first}}NOT-FIRST{{/-first}}{{this}}{{^-last}}NOT-LAST{{/-last}}{{/things}}",
context("things", Arrays.asList("_and_")));
}
@Test public void testNotFirst () {
test("1,2,3", "{{#things}}{{^-first}},{{/-first}}{{this}}{{/things}}",
context("things", Arrays.asList("1", "2", "3")));
}
@Test public void testNotLast () {
test("1,2,3", "{{#things}}{{this}}{{^-last}},{{/-last}}{{/things}}",
context("things", Arrays.asList("1", "2", "3")));
}
@Test public void testIndex () {
test("123", "{{#things}}{{-index}}{{/things}}",
context("things", Arrays.asList("foo", "bar", "baz")));