GUI -- Fixed broken table unit tests.
Change-Id: I863328d4db2f7daa5aebff16c2afcb85148f1f35
Showing
1 changed file
with
62 additions
and
55 deletions
... | @@ -22,62 +22,63 @@ describe('factory: fw/widget/table.js', function () { | ... | @@ -22,62 +22,63 @@ describe('factory: fw/widget/table.js', function () { |
22 | fs, mast, is, | 22 | fs, mast, is, |
23 | scope, compiled, | 23 | scope, compiled, |
24 | table, thead, tbody, mockHeader, | 24 | table, thead, tbody, mockHeader, |
25 | - mockh2Height = '10px', | 25 | + mockH2Height = 20, |
26 | + mockMastHeight = 20, | ||
27 | + mockHeaderHeight = mockH2Height + mockMastHeight, | ||
26 | tableIconTdSize = 100, | 28 | tableIconTdSize = 100, |
27 | - pdgTop = 101, | ||
28 | numTestElems = 4; | 29 | numTestElems = 4; |
29 | 30 | ||
30 | - var onosFixedHeaderTags = '<table ' + | 31 | + var onosFixedHeaderTags = |
31 | - 'onos-fixed-header>' + | 32 | + '<table onos-fixed-header>' + |
32 | - '<thead>' + | 33 | + '<thead style="height:27px;">' + |
33 | - '<tr>' + | 34 | + '<tr>' + |
34 | - '<th></th>' + | 35 | + '<th></th>' + |
35 | - '<th>Device ID </th>' + | 36 | + '<th>Device ID </th>' + |
36 | - '<th col-width="100px">H/W Version </th>' + | 37 | + '<th col-width="100px">H/W Version </th>' + |
37 | - '<th>S/W Version </th>' + | 38 | + '<th>S/W Version </th>' + |
38 | - '</tr>' + | 39 | + '</tr>' + |
39 | - '</thead>' + | 40 | + '</thead>' + |
40 | - '<tbody>' + | 41 | + '<tbody>' + |
41 | - '<tr>' + | 42 | + '<tr>' + |
42 | - '<td colspan="4">' + | 43 | + '<td colspan="4">' + |
43 | - 'No Devices found' + | 44 | + 'No Devices found' + |
44 | - '</td>' + | 45 | + '</td>' + |
45 | - '</tr>' + | 46 | + '</tr>' + |
46 | - '<tr>' + | 47 | + '<tr>' + |
47 | - '<td class="table-icon">' + | 48 | + '<td class="table-icon">' + |
48 | - '<div icon icon-id="{{dev._iconid_available}}">' + | 49 | + '<div icon icon-id="{{dev._iconid_available}}">' + |
49 | - '</div>' + | 50 | + '</div>' + |
50 | - '</td>' + | 51 | + '</td>' + |
51 | - '<td>Some ID</td>' + | 52 | + '<td>Some ID</td>' + |
52 | - '<td>Some HW</td>' + | 53 | + '<td>Some HW</td>' + |
53 | - '<td>Some Software</td>' + | 54 | + '<td>Some Software</td>' + |
54 | - '</tr>' + | 55 | + '</tr>' + |
55 | - '</tbody>' + | 56 | + '</tbody>' + |
56 | - '</table>', | 57 | + '</table>', |
57 | - | 58 | + |
58 | - onosSortableHeaderTags = '<table ' + | 59 | + onosSortableHeaderTags = |
59 | - 'onos-sortable-header ' + | 60 | + '<table onos-sortable-header ' + |
60 | - 'sort-callback="sortCallback(requestParams)">' + | 61 | + 'sort-callback="sortCallback(requestParams)">' + |
61 | - '<thead>' + | 62 | + '<thead>' + |
62 | - '<tr>' + | 63 | + '<tr>' + |
63 | - '<th colId="available"></th>' + | 64 | + '<th colId="available"></th>' + |
64 | - '<th colId="id" sortable>Device ID </th>' + | 65 | + '<th colId="id" sortable>Device ID </th>' + |
65 | - '<th colId="hw" sortable>H/W Version </th>' + | 66 | + '<th colId="hw" sortable>H/W Version </th>' + |
66 | - '<th colId="sw" sortable>S/W Version </th>' + | 67 | + '<th colId="sw" sortable>S/W Version </th>' + |
67 | - '</tr>' + | 68 | + '</tr>' + |
68 | - '</thead>' + | 69 | + '</thead>' + |
69 | - '<tbody>' + | 70 | + '<tbody>' + |
70 | - '<tr>' + | 71 | + '<tr>' + |
71 | - '<td>' + | 72 | + '<td>' + |
72 | - '<div icon icon-id="{{dev._iconid_available}}">' + | 73 | + '<div icon icon-id="{{dev._iconid_available}}">' + |
73 | - '</div>' + | 74 | + '</div>' + |
74 | - '</td>' + | 75 | + '</td>' + |
75 | - '<td>Some ID</td>' + | 76 | + '<td>Some ID</td>' + |
76 | - '<td>Some HW</td>' + | 77 | + '<td>Some HW</td>' + |
77 | - '<td>Some Software</td>' + | 78 | + '<td>Some Software</td>' + |
78 | - '</tr>' + | 79 | + '</tr>' + |
79 | - '</tbody>' + | 80 | + '</tbody>' + |
80 | - '</table>'; | 81 | + '</table>'; |
81 | 82 | ||
82 | beforeEach(module('onosWidget', 'onosUtil', 'onosMast', 'onosSvg')); | 83 | beforeEach(module('onosWidget', 'onosUtil', 'onosMast', 'onosSvg')); |
83 | 84 | ||
... | @@ -114,7 +115,8 @@ describe('factory: fw/widget/table.js', function () { | ... | @@ -114,7 +115,8 @@ describe('factory: fw/widget/table.js', function () { |
114 | beforeEach(function () { | 115 | beforeEach(function () { |
115 | mockHeader = d3.select('body') | 116 | mockHeader = d3.select('body') |
116 | .append('h2') | 117 | .append('h2') |
117 | - .style('height', mockh2Height) | 118 | + .classed('tabular-header', true) |
119 | + .style('height', mockHeaderHeight + 'px') | ||
118 | .html('Some Header'); | 120 | .html('Some Header'); |
119 | }); | 121 | }); |
120 | 122 | ||
... | @@ -142,12 +144,17 @@ describe('factory: fw/widget/table.js', function () { | ... | @@ -142,12 +144,17 @@ describe('factory: fw/widget/table.js', function () { |
142 | } | 144 | } |
143 | 145 | ||
144 | function verifyCssDisplay() { | 146 | function verifyCssDisplay() { |
145 | - var tableHeight = fs.windowSize(pdgTop).height; | 147 | + var padding = 21, // bottom table constant 12 + mastPadding(?) 9 |
148 | + tableHeight = fs.windowSize(mockHeaderHeight).height - | ||
149 | + (fs.noPx(table.find('thead').css('height')) + padding); | ||
146 | 150 | ||
147 | expect(thead.css('display')).toBe('block'); | 151 | expect(thead.css('display')).toBe('block'); |
148 | expect(tbody.css('display')).toBe('block'); | 152 | expect(tbody.css('display')).toBe('block'); |
149 | expect(tbody.css('height')).toBe(tableHeight + 'px'); | 153 | expect(tbody.css('height')).toBe(tableHeight + 'px'); |
150 | expect(tbody.css('overflow')).toBe('auto'); | 154 | expect(tbody.css('overflow')).toBe('auto'); |
155 | + | ||
156 | + // TODO: investigate why math for calculating the height works better | ||
157 | + // in the browser window (thead height is 0 in this test?) | ||
151 | } | 158 | } |
152 | 159 | ||
153 | function verifyColWidth() { | 160 | function verifyColWidth() { | ... | ... |
-
Please register or login to post a comment