ES6ify /gr-change-table-behavior/*
Bug: Issue 6179 Change-Id: Ib3ea20a7450afd1752caeffe408e00b0699edf40
This commit is contained in:
@@ -18,7 +18,7 @@ limitations under the License.
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
/** @polymerBehavior Gerrit.ChangeTableBehavior */
|
/** @polymerBehavior Gerrit.ChangeTableBehavior */
|
||||||
var ChangeTableBehavior = {
|
const ChangeTableBehavior = {
|
||||||
properties: {
|
properties: {
|
||||||
columnNames: {
|
columnNames: {
|
||||||
type: Array,
|
type: Array,
|
||||||
@@ -32,21 +32,21 @@ limitations under the License.
|
|||||||
'Size',
|
'Size',
|
||||||
],
|
],
|
||||||
readOnly: true,
|
readOnly: true,
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the complement to the given column array
|
* Returns the complement to the given column array
|
||||||
* @param {Array} columns
|
* @param {Array} columns
|
||||||
*/
|
*/
|
||||||
getComplementColumns: function(columns) {
|
getComplementColumns(columns) {
|
||||||
return this.columnNames.filter(function(column) {
|
return this.columnNames.filter(column => {
|
||||||
return columns.indexOf(column) === -1;
|
return !columns.includes(column);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
isColumnHidden: function(columnToCheck, columnsToDisplay) {
|
isColumnHidden(columnToCheck, columnsToDisplay) {
|
||||||
return columnsToDisplay.indexOf(columnToCheck) === -1;
|
return !columnsToDisplay.includes(columnToCheck);
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -39,11 +39,12 @@ limitations under the License.
|
|||||||
</test-fixture>
|
</test-fixture>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
suite('gr-change-table-behavior tests', function() {
|
suite('gr-change-table-behavior tests', () => {
|
||||||
var element;
|
let element;
|
||||||
var overlay;
|
// eslint-disable-next-line no-unused-vars
|
||||||
|
let overlay;
|
||||||
|
|
||||||
suiteSetup(function() {
|
suiteSetup(() => {
|
||||||
// Define a Polymer element that uses this behavior.
|
// Define a Polymer element that uses this behavior.
|
||||||
Polymer({
|
Polymer({
|
||||||
is: 'test-element',
|
is: 'test-element',
|
||||||
@@ -51,13 +52,13 @@ limitations under the License.
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
setup(function() {
|
setup(() => {
|
||||||
element = fixture('basic');
|
element = fixture('basic');
|
||||||
overlay = fixture('within-overlay');
|
overlay = fixture('within-overlay');
|
||||||
});
|
});
|
||||||
|
|
||||||
test('getComplementColumns', function() {
|
test('getComplementColumns', () => {
|
||||||
var columns = [
|
let columns = [
|
||||||
'Subject',
|
'Subject',
|
||||||
'Status',
|
'Status',
|
||||||
'Owner',
|
'Owner',
|
||||||
@@ -79,9 +80,9 @@ limitations under the License.
|
|||||||
['Owner', 'Updated']);
|
['Owner', 'Updated']);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('isColumnHidden', function() {
|
test('isColumnHidden', () => {
|
||||||
var columnToCheck = 'Project';
|
const columnToCheck = 'Project';
|
||||||
var columnsToDisplay = [
|
let columnsToDisplay = [
|
||||||
'Subject',
|
'Subject',
|
||||||
'Status',
|
'Status',
|
||||||
'Owner',
|
'Owner',
|
||||||
@@ -92,7 +93,7 @@ limitations under the License.
|
|||||||
];
|
];
|
||||||
assert.isFalse(element.isColumnHidden(columnToCheck, columnsToDisplay));
|
assert.isFalse(element.isColumnHidden(columnToCheck, columnsToDisplay));
|
||||||
|
|
||||||
var columnsToDisplay = [
|
columnsToDisplay = [
|
||||||
'Subject',
|
'Subject',
|
||||||
'Status',
|
'Status',
|
||||||
'Owner',
|
'Owner',
|
||||||
|
Reference in New Issue
Block a user