Copybara | 854996b | 2021-09-07 19:36:02 +0000 | [diff] [blame] | 1 | // 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 | |
| 5 | import {assert} from 'chai'; |
| 6 | import {ChopsCollapse} from './chops-collapse.js'; |
| 7 | |
| 8 | |
| 9 | let element; |
| 10 | describe('chops-collapse', () => { |
| 11 | beforeEach(() => { |
| 12 | element = document.createElement('chops-collapse'); |
| 13 | document.body.appendChild(element); |
| 14 | }); |
| 15 | |
| 16 | afterEach(() => { |
| 17 | document.body.removeChild(element); |
| 18 | }); |
| 19 | |
| 20 | it('initializes', () => { |
| 21 | assert.instanceOf(element, ChopsCollapse); |
| 22 | }); |
| 23 | |
| 24 | it('toggling chops-collapse changes aria-hidden', () => { |
| 25 | element.opened = true; |
| 26 | |
| 27 | assert.isNull(element.getAttribute('aria-hidden')); |
| 28 | |
| 29 | element.opened = false; |
| 30 | |
| 31 | assert.isDefined(element.getAttribute('aria-hidden')); |
| 32 | }); |
| 33 | }); |