ES6ify /gr-change-table-behavior/*

Bug: Issue 6179
Change-Id: Ib3ea20a7450afd1752caeffe408e00b0699edf40
This commit is contained in:
Kasper Nilsson
2017-05-14 17:58:48 -07:00
parent 7ecd5593f5
commit 8215e498a3
2 changed files with 19 additions and 18 deletions

View File

@@ -18,7 +18,7 @@ limitations under the License.
'use strict';
/** @polymerBehavior Gerrit.ChangeTableBehavior */
var ChangeTableBehavior = {
const ChangeTableBehavior = {
properties: {
columnNames: {
type: Array,
@@ -32,21 +32,21 @@ limitations under the License.
'Size',
],
readOnly: true,
}
},
},
/**
* Returns the complement to the given column array
* @param {Array} columns
*/
getComplementColumns: function(columns) {
return this.columnNames.filter(function(column) {
return columns.indexOf(column) === -1;
getComplementColumns(columns) {
return this.columnNames.filter(column => {
return !columns.includes(column);
});
},
isColumnHidden: function(columnToCheck, columnsToDisplay) {
return columnsToDisplay.indexOf(columnToCheck) === -1;
isColumnHidden(columnToCheck, columnsToDisplay) {
return !columnsToDisplay.includes(columnToCheck);
},
};

View File

@@ -39,11 +39,12 @@ limitations under the License.
</test-fixture>
<script>
suite('gr-change-table-behavior tests', function() {
var element;
var overlay;
suite('gr-change-table-behavior tests', () => {
let element;
// eslint-disable-next-line no-unused-vars
let overlay;
suiteSetup(function() {
suiteSetup(() => {
// Define a Polymer element that uses this behavior.
Polymer({
is: 'test-element',
@@ -51,13 +52,13 @@ limitations under the License.
});
});
setup(function() {
setup(() => {
element = fixture('basic');
overlay = fixture('within-overlay');
});
test('getComplementColumns', function() {
var columns = [
test('getComplementColumns', () => {
let columns = [
'Subject',
'Status',
'Owner',
@@ -79,9 +80,9 @@ limitations under the License.
['Owner', 'Updated']);
});
test('isColumnHidden', function() {
var columnToCheck = 'Project';
var columnsToDisplay = [
test('isColumnHidden', () => {
const columnToCheck = 'Project';
let columnsToDisplay = [
'Subject',
'Status',
'Owner',
@@ -92,7 +93,7 @@ limitations under the License.
];
assert.isFalse(element.isColumnHidden(columnToCheck, columnsToDisplay));
var columnsToDisplay = [
columnsToDisplay = [
'Subject',
'Status',
'Owner',