Skip to content

Commit

Permalink
Merge branch 'master' into open933
Browse files Browse the repository at this point in the history
  • Loading branch information
akhenry committed Oct 7, 2016
2 parents 3e9c0eb + cbd001e commit 07140b1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 22 deletions.
16 changes: 8 additions & 8 deletions platform/features/table/src/controllers/MCTTableController.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

define(
[],
function () {
['zepto'],
function ($) {

/**
* A controller for the MCTTable directive. Populates scope with
Expand All @@ -16,13 +16,13 @@ define(
var self = this;

this.$scope = $scope;
this.element = element;
this.element = $(element[0]);
this.$timeout = $timeout;
this.maxDisplayRows = 50;

this.scrollable = element.find('div');
this.thead = element.find('thead');
this.tbody = element.find('tbody');
this.scrollable = this.element.find('.l-view-section.scrolling').first();
this.resultsHeader = this.element.find('.mct-table>thead').first();
this.sizingTableBody = this.element.find('.sizing-table>tbody').first();
this.$scope.sizingRow = {};

this.scrollable.on('scroll', this.onScroll.bind(this));
Expand Down Expand Up @@ -261,8 +261,8 @@ define(
* for individual rows.
*/
MCTTableController.prototype.setElementSizes = function () {
var thead = this.thead,
tbody = this.tbody,
var thead = this.resultsHeader,
tbody = this.sizingTableBody,
firstRow = tbody.find('tr'),
column = firstRow.find('td'),
headerHeight = thead.prop('offsetHeight'),
Expand Down
23 changes: 9 additions & 14 deletions platform/features/table/test/controllers/MCTTableControllerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,16 @@

define(
[
"zepto",
"../../src/controllers/MCTTableController"
],
function (MCTTableController) {
function ($, MCTTableController) {

var MOCK_ELEMENT_TEMPLATE =
'<div><div class="l-view-section scrolling">' +
'<table class="sizing-table"><tbody></tbody></table>' +
'<table class="mct-table"><thead></thead></table>' +
'</div></div>';

describe('The MCTTable Controller', function () {

Expand Down Expand Up @@ -55,19 +62,7 @@ define(
watches[event] = callback;
});

mockElement = jasmine.createSpyObj('element', [
'find',
'prop',
'on'
]);
mockElement.find.andReturn(mockElement);
mockElement.prop.andReturn(0);
mockElement[0] = {
scrollTop: 0,
scrollHeight: 500,
offsetHeight: 1000
};

mockElement = $(MOCK_ELEMENT_TEMPLATE);
mockExportService = jasmine.createSpyObj('exportService', [
'exportCSV'
]);
Expand Down

0 comments on commit 07140b1

Please sign in to comment.