GUI -- Fixed broken table unit tests.
Change-Id: I863328d4db2f7daa5aebff16c2afcb85148f1f35
Showing
1 changed file
with
16 additions
and
9 deletions
| ... | @@ -22,14 +22,15 @@ describe('factory: fw/widget/table.js', function () { | ... | @@ -22,14 +22,15 @@ 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>' + |
| ... | @@ -55,8 +56,8 @@ describe('factory: fw/widget/table.js', function () { | ... | @@ -55,8 +56,8 @@ describe('factory: fw/widget/table.js', function () { |
| 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>' + |
| ... | @@ -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