From 1f540ed47fd6d1a5ad9e4684c6cc20c6fd3f7511 Mon Sep 17 00:00:00 2001 From: Dave Woodward Date: Wed, 11 Feb 2015 08:38:19 -0500 Subject: [PATCH] Fixes #1075. Adds unit tests to both list callbacks to verify the shape of the rowData object now. --- js/repeater-list.js | 2 +- test/repeater-list-test.js | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/js/repeater-list.js b/js/repeater-list.js index 1a62678cb..0674fdb9a 100755 --- a/js/repeater-list.js +++ b/js/repeater-list.js @@ -379,7 +379,7 @@ this.viewOptions.list_rowRendered({ container: $tbody, item: $row, - rowData: data + rowData: data.items[index] }, function () {}); } } diff --git a/test/repeater-list-test.js b/test/repeater-list-test.js index 0ec7a5a16..1f22c6aaa 100644 --- a/test/repeater-list-test.js +++ b/test/repeater-list-test.js @@ -129,6 +129,8 @@ define(function(require){ if(!hasCalled.column){ ok(1===1, 'columnRendered callback called upon rendering column'); equal((helpers.container.length>0 && helpers.item.length>0), true, 'columnRendered helpers object contains appropriate attributes'); + equal((helpers.rowData instanceof Array), false, 'rowRendered rowData is an object'); + equal((typeof helpers.rowData.appearance), 'string', 'rowRendered rowData is an item from the dataSource'); hasCalled.column = true; } num.cols++; @@ -137,6 +139,8 @@ define(function(require){ list_rowRendered: function(helpers, callback){ if(!hasCalled.row){ ok(1===1, 'rowRendered callback called upon rendering column'); + equal((helpers.rowData instanceof Array), false, 'rowRendered rowData is an object'); + equal((typeof helpers.rowData.appearance), 'string', 'rowRendered rowData is an item from the dataSource'); equal((helpers.container.length>0 && helpers.item.length>0), true, 'rowRendered helpers object contains appropriate attributes'); hasCalled.row = true; }