blob: 1d55c3930b0c62efa29cc664f70bab43ba78b968 [file] [log] [blame]
Copybara854996b2021-09-07 19:36:02 +00001// Copyright 2020 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 {MrTabs} from './mr-tabs.js';
7
8/** @type {MrTabs} */
9let element;
10
11describe('mr-tabs', () => {
12 beforeEach(() => {
13 // @ts-ignore
14 element = document.createElement('mr-tabs');
15 document.body.appendChild(element);
16 });
17
18 afterEach(() => {
19 document.body.removeChild(element);
20 });
21
22 it('initializes', () => {
23 assert.instanceOf(element, MrTabs);
24 });
25
26 it('renders tabs', async () => {
27 element.items = [
28 {text: 'Text 1'},
29 {text: 'Text 2', icon: 'done', url: 'https://url'},
30 ];
31 element.selected = 1;
32 await element.updateComplete;
33
34 const items = element.shadowRoot.querySelectorAll('li');
35 assert.equal(items[0].className, '');
36 assert.equal(items[1].className, 'selected');
37 });
38});