|
| 1 | +(function($) { |
| 2 | + module('List view', { |
| 3 | + setup: function() { |
| 4 | + $.fx.off = true; |
| 5 | + } |
| 6 | + }); |
| 7 | + |
| 8 | + test('Basic', function() { |
| 9 | + var listView = { |
| 10 | + listView: { |
| 11 | + section: 'test123', |
| 12 | + fields: { |
| 13 | + fieldA: { label: 'testFieldA' }, |
| 14 | + fieldB: { label: 'testFieldB' } |
| 15 | + }, |
| 16 | + dataProvider: function(args) { |
| 17 | + args.response.success({ |
| 18 | + data: [] |
| 19 | + }); |
| 20 | + } |
| 21 | + } |
| 22 | + }; |
| 23 | + var $listView; |
| 24 | + |
| 25 | + ok($listView = $('<div>').listView(listView), 'Initialize list view'); |
| 26 | + equal($listView.find('.list-view').size(), 1, 'List view has container div'); |
| 27 | + equal($listView.find('.list-view.test123').size(), 1, 'Container div has section ID as CSS class'); |
| 28 | + equal($listView.find('.list-view table').size(), 2, 'List view has split tables'); |
| 29 | + equal($listView.find('.list-view .fixed-header table thead tr').size(), 1, 'List view has fixed table header'); |
| 30 | + equal($listView.find('.list-view .fixed-header table thead th').size(), 2, 'List view has correct column headers'); |
| 31 | + equal($listView.find('.list-view .fixed-header table thead th:first').html(), 'testFieldA', 'First header has correct label'); |
| 32 | + ok($listView.find('.list-view .fixed-header table thead th:first').hasClass('fieldA'), 'First header has correct class'); |
| 33 | + ok($listView.find('.list-view .fixed-header table thead th:last').hasClass('fieldB'), 'First header has correct class'); |
| 34 | + equal($listView.find('.list-view .fixed-header table thead th:last').html(), 'testFieldB', 'First header has correct label'); |
| 35 | + equal($listView.find('.list-view table tbody tr').size(), 1, 'List view has table body'); |
| 36 | + equal($listView.find('.toolbar').size(), 1, 'List view has toolbar'); |
| 37 | + equal($listView.find('.toolbar .text-search .search-bar input[type=text]').size(), 1, 'Toolbar has search box'); |
| 38 | + equal($listView.find('.toolbar .text-search .button.search').size(), 1, 'Toolbar has search button'); |
| 39 | + }); |
| 40 | +}(jQuery)); |
0 commit comments