blob: 62bd13be168b133b7ddaeca9053199b2aa1ea972 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001// Copyright 2019 The Chromium Authors. All rights reserved.
2// 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});