You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2014/01/29 00:48:51 UTC
[2/2] git commit: updated refs/heads/master to 3ac181e
List view: tests for field pre-filter
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/ebcf6a1d
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/ebcf6a1d
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/ebcf6a1d
Branch: refs/heads/master
Commit: ebcf6a1da88c4d750f9342df45fc409be80c9759
Parents: 16a9171
Author: Brian Federle <br...@citrix.com>
Authored: Tue Jan 28 14:54:30 2014 -0800
Committer: Brian Federle <br...@citrix.com>
Committed: Tue Jan 28 15:48:44 2014 -0800
----------------------------------------------------------------------
ui/tests/test.widget.listView.js | 38 ++++++++++++++++++++++++++++++-----
1 file changed, 33 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ebcf6a1d/ui/tests/test.widget.listView.js
----------------------------------------------------------------------
diff --git a/ui/tests/test.widget.listView.js b/ui/tests/test.widget.listView.js
index 3640a5a..84f914b 100644
--- a/ui/tests/test.widget.listView.js
+++ b/ui/tests/test.widget.listView.js
@@ -104,7 +104,7 @@
},
dataProvider: function(args) {
args.response.success({ data: [] });
-
+
ok(true, 'Data provider called');
start();
}
@@ -128,7 +128,7 @@
{ fieldA: 'FieldDataA', fieldB: 'FieldDataB' }
]
});
-
+
start();
}
}
@@ -146,7 +146,7 @@
{ fieldA: 'FieldDataA2', fieldB: 'FieldDataB2' },
{ fieldA: 'FieldDataA3', fieldB: 'FieldDataB3' }
];
-
+
var $listView = listView({
listView: {
fields: {
@@ -157,7 +157,7 @@
args.response.success({
data: testData
});
-
+
start();
}
}
@@ -169,9 +169,37 @@
var $tr = $listView.find('table.body tbody tr').filter(function() {
return $(this).index() === index;
});
-
+
equal($tr.find('td.fieldA > span').html(), 'FieldDataA' + (index + 1), 'FieldDataA' + (index + 1) + ' present');
equal($tr.find('td.fieldB > span').html(), 'FieldDataB' + (index + 1), 'FieldDataB' + (index + 1) + ' present');
});
});
+
+ test('Field pre-filter', function() {
+ var $listView = listView({
+ listView: {
+ fields: {
+ fieldA: { label: 'TestFieldA' },
+ fieldB: { label: 'TestFieldB' },
+ fieldHidden: { label: 'TestFieldHidden' }
+ },
+ preFilter: function(args) {
+ return ['fieldHidden'];
+ },
+ dataProvider: function(args) {
+ args.response.success({
+ data: [
+ { fieldA: 'FieldDataA', fieldB: 'FieldDataB', fieldHidden: 'FieldDataHidden' }
+ ]
+ });
+
+ start();
+ }
+ }
+ });
+
+ equal($listView.find('table tr th').size(), 2, 'Correct number of header columns present');
+ equal($listView.find('table.body tbody tr td').size(), 2, 'Correct number of data body columns present');
+ ok(!$listView.find('table.body tbody td.fieldHidden').size(), 'Hidden field not present');
+ });
}());