blob: 195cb5f15f3a4058c395c7b62a22a2234a3bd747 [file] [log] [blame]
Adrià Vilanova Martínezf19ea432024-01-23 20:20:52 +01001// Copyright 2020 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 {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});