Bri Prebilic Cole

GUI -- Fixed broken table unit tests.

Change-Id: I863328d4db2f7daa5aebff16c2afcb85148f1f35
......@@ -22,14 +22,15 @@ describe('factory: fw/widget/table.js', function () {
fs, mast, is,
scope, compiled,
table, thead, tbody, mockHeader,
mockh2Height = '10px',
mockH2Height = 20,
mockMastHeight = 20,
mockHeaderHeight = mockH2Height + mockMastHeight,
tableIconTdSize = 100,
pdgTop = 101,
numTestElems = 4;
var onosFixedHeaderTags = '<table ' +
'onos-fixed-header>' +
'<thead>' +
var onosFixedHeaderTags =
'<table onos-fixed-header>' +
'<thead style="height:27px;">' +
'<tr>' +
'<th></th>' +
'<th>Device ID </th>' +
......@@ -55,8 +56,8 @@ describe('factory: fw/widget/table.js', function () {
'</tbody>' +
'</table>',
onosSortableHeaderTags = '<table ' +
'onos-sortable-header ' +
onosSortableHeaderTags =
'<table onos-sortable-header ' +
'sort-callback="sortCallback(requestParams)">' +
'<thead>' +
'<tr>' +
......@@ -114,7 +115,8 @@ describe('factory: fw/widget/table.js', function () {
beforeEach(function () {
mockHeader = d3.select('body')
.append('h2')
.style('height', mockh2Height)
.classed('tabular-header', true)
.style('height', mockHeaderHeight + 'px')
.html('Some Header');
});
......@@ -142,12 +144,17 @@ describe('factory: fw/widget/table.js', function () {
}
function verifyCssDisplay() {
var tableHeight = fs.windowSize(pdgTop).height;
var padding = 21, // bottom table constant 12 + mastPadding(?) 9
tableHeight = fs.windowSize(mockHeaderHeight).height -
(fs.noPx(table.find('thead').css('height')) + padding);
expect(thead.css('display')).toBe('block');
expect(tbody.css('display')).toBe('block');
expect(tbody.css('height')).toBe(tableHeight + 'px');
expect(tbody.css('overflow')).toBe('auto');
// TODO: investigate why math for calculating the height works better
// in the browser window (thead height is 0 in this test?)
}
function verifyColWidth() {
......