cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 3ac181e
Date Tue, 28 Jan 2014 23:48:50 GMT
Updated Branches:
  refs/heads/master 16a9171f5 -> 3ac181e39


List view: tests for filter dropdown


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/3ac181e3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/3ac181e3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/3ac181e3

Branch: refs/heads/master
Commit: 3ac181e396c2564df66947184048565d4b199716
Parents: ebcf6a1
Author: Brian Federle <brian.federle@citrix.com>
Authored: Tue Jan 28 15:48:33 2014 -0800
Committer: Brian Federle <brian.federle@citrix.com>
Committed: Tue Jan 28 15:48:44 2014 -0800

----------------------------------------------------------------------
 ui/tests/test.widget.listView.js | 40 +++++++++++++++++++++++++++++++++++
 1 file changed, 40 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/3ac181e3/ui/tests/test.widget.listView.js
----------------------------------------------------------------------
diff --git a/ui/tests/test.widget.listView.js b/ui/tests/test.widget.listView.js
index 84f914b..43c42f9 100644
--- a/ui/tests/test.widget.listView.js
+++ b/ui/tests/test.widget.listView.js
@@ -202,4 +202,44 @@
         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');
     });
+
+    test('Filter dropdown', function() {
+        var $listView = listView({
+            listView: {
+                fields: {
+                    state: { label: 'State' }
+                },
+                filters: {
+                    on: { label: 'FilterOnLabel' },
+                    off: { label: 'FilterOffLabel' }
+                },
+                dataProvider: function(args) {
+                    var filterBy = args.filterBy.kind;
+                    var data = filterBy === 'on' ? [{ state: 'on' }] : [{ state: 'off' }];
+
+                    args.response.success({
+                        data: data
+                    });
+
+                    start();
+                }
+            }
+        });
+        
+        var $filters = $listView.find('.filters select');
+
+        var testFilterDropdownContent = function() {
+            equal($filters.find('option').size(), 2, 'Correct # of filters present');
+            equal($filters.find('option:first').html(), 'FilterOnLabel', 'Filter on label
present');
+            equal($filters.find('option:last').html(), 'FilterOffLabel', 'Filter off label
present');
+        };
+
+        testFilterDropdownContent();
+        equal($filters.find('option').val(), 'on', 'Correct default filter active');
+        equal($listView.find('tbody td.state span').html(), 'on', '"on" data item visible');
+        ok($filters.val('off').trigger('change'), 'Change filter to "off"');
+        equal($listView.find('tbody td.state span').html(), 'off', '"off" data item visible');
+        equal($filters.val(), 'off', 'Correct filter active');
+        testFilterDropdownContent();
+    });
 }());


Mime
View raw message