blob: b68c72ff1ae029ef2d32cfe08a29b5793157ee5f [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001// Copyright 2019 The Chromium Authors
Copybara854996b2021-09-07 19:36:02 +00002// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5import {assert} from 'chai';
6import {EztShowColumnsConnector} from './ezt-show-columns-connector.js';
7
8
9let element;
10
11describe('ezt-show-columns-connector', () => {
12 beforeEach(() => {
13 element = document.createElement('ezt-show-columns-connector');
14 document.body.appendChild(element);
15 });
16
17 afterEach(() => {
18 document.body.removeChild(element);
19 });
20
21 it('initializes', () => {
22 assert.instanceOf(element, EztShowColumnsConnector);
23 });
24
25 it('initialColumns parses colspec', () => {
26 element.colspec = 'Summary ID Owner';
27 assert.deepEqual(element.initialColumns, ['Summary', 'ID', 'Owner']);
28 });
29
30 it('filters columns based on column mask', () => {
31 sinon.stub(element, 'initialColumns').get(() => ['ID', 'Summary']);
32 element.hiddenColumns = new Set([1]);
33
34 assert.deepEqual(element.columns, ['ID']);
35 });
36
37 it('phaseNames parses phasespec', () => {
38 element.phasespec = 'stable beta stable-exp';
39 assert.deepEqual(element.phaseNames, ['stable', 'beta', 'stable-exp']);
40 });
41});