mirror of https://github.com/apache/cloudstack.git
Add list view tests
This commit is contained in:
parent
c0c80432a8
commit
e1a3a6f2d9
|
|
@ -78,5 +78,6 @@
|
|||
<script src="test.core.js" type="text/javascript"></script>
|
||||
<script src="test.cloudBrowser.js" type="text/javascript"></script>
|
||||
<script src="test.notifications.js" type="text/javascript"></script>
|
||||
<script src="test.listView.js" type="text/javascript"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,40 @@
|
|||
(function($) {
|
||||
module('List view', {
|
||||
setup: function() {
|
||||
$.fx.off = true;
|
||||
}
|
||||
});
|
||||
|
||||
test('Basic', function() {
|
||||
var listView = {
|
||||
listView: {
|
||||
section: 'test123',
|
||||
fields: {
|
||||
fieldA: { label: 'testFieldA' },
|
||||
fieldB: { label: 'testFieldB' }
|
||||
},
|
||||
dataProvider: function(args) {
|
||||
args.response.success({
|
||||
data: []
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
var $listView;
|
||||
|
||||
ok($listView = $('<div>').listView(listView), 'Initialize list view');
|
||||
equal($listView.find('.list-view').size(), 1, 'List view has container div');
|
||||
equal($listView.find('.list-view.test123').size(), 1, 'Container div has section ID as CSS class');
|
||||
equal($listView.find('.list-view table').size(), 2, 'List view has split tables');
|
||||
equal($listView.find('.list-view .fixed-header table thead tr').size(), 1, 'List view has fixed table header');
|
||||
equal($listView.find('.list-view .fixed-header table thead th').size(), 2, 'List view has correct column headers');
|
||||
equal($listView.find('.list-view .fixed-header table thead th:first').html(), 'testFieldA', 'First header has correct label');
|
||||
ok($listView.find('.list-view .fixed-header table thead th:first').hasClass('fieldA'), 'First header has correct class');
|
||||
ok($listView.find('.list-view .fixed-header table thead th:last').hasClass('fieldB'), 'First header has correct class');
|
||||
equal($listView.find('.list-view .fixed-header table thead th:last').html(), 'testFieldB', 'First header has correct label');
|
||||
equal($listView.find('.list-view table tbody tr').size(), 1, 'List view has table body');
|
||||
equal($listView.find('.toolbar').size(), 1, 'List view has toolbar');
|
||||
equal($listView.find('.toolbar .text-search .search-bar input[type=text]').size(), 1, 'Toolbar has search box');
|
||||
equal($listView.find('.toolbar .text-search .button.search').size(), 1, 'Toolbar has search button');
|
||||
});
|
||||
}(jQuery));
|
||||
Loading…
Reference in New Issue