diff --git a/apps/automated/package.json b/apps/automated/package.json
index dac032e77..4ac3b0d15 100644
--- a/apps/automated/package.json
+++ b/apps/automated/package.json
@@ -2,10 +2,10 @@
"main": "main.js",
"description": "NativeScript Application",
"license": "MIT",
- "repository": {
- "type": "git",
- "url": "https://github.com/NativeScript/NativeScript.git"
- },
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/NativeScript/NativeScript.git"
+ },
"scripts": {
"clean": "npx rimraf hooks node_modules platforms package-lock.json && npm i"
},
diff --git a/apps/automated/src/ui/repeater/repeater-tests.ts b/apps/automated/src/ui/repeater/repeater-tests.ts
index ae6a8a1da..33b47c00e 100644
--- a/apps/automated/src/ui/repeater/repeater-tests.ts
+++ b/apps/automated/src/ui/repeater/repeater-tests.ts
@@ -1,6 +1,6 @@
import * as TKUnit from '../../tk-unit';
import * as helper from '../../ui-helper';
-import { Application, Label, Page, StackLayout, WrapLayout, LayoutBase, View, GestureTypes, Repeater, ObservableArray } from '@nativescript/core';
+import { Application, Label, Page, StackLayout, WrapLayout, LayoutBase, View, KeyedTemplate, GestureTypes, Repeater, ObservableArray } from '@nativescript/core';
var FEW_ITEMS = [0, 1, 2];
var MANY_ITEMS = [];
@@ -8,6 +8,18 @@ for (var i = 0; i < 100; i++) {
MANY_ITEMS[i] = i;
}
+const ITEM_TEMPLATES_STRING = `
+
+
+
+
+
+
+
+
+
+ `;
+
export function test_recycling() {
const setters = new Map();
setters.set('itemsLayout', new StackLayout());
@@ -309,6 +321,117 @@ export function test_ItemTemplateFactoryFunction() {
helper.buildUIAndRunTest(repeater, testAction);
}
+// Multiple item templates tests
+export function test_ItemTemplateSelector_WhenWrongTemplateKeyIsSpecified_TheDefaultTemplateIsUsed() {
+ var repeater = new Repeater();
+
+ function testAction(views: Array) {
+ repeater.itemTemplate = "";
+ repeater.itemTemplates = ITEM_TEMPLATES_STRING;
+ repeater.itemTemplateSelector = "age == 20 ? 'wrong' : 'green'";
+ repeater.items = [{ age: 20 }, { age: 25 }];
+
+ TKUnit.waitUntilReady(() => repeater.isLayoutValid);
+
+ const firstElement = getChildAt(repeater, 0);
+ TKUnit.assertEqual((