|
| 1 | +/** |
| 2 | + * @copyright Copyright (c) 2023 Ferdinand Thiessen <[email protected]> |
| 3 | + * |
| 4 | + * @author Ferdinand Thiessen <[email protected]> |
| 5 | + * |
| 6 | + * @license AGPL-3.0-or-later |
| 7 | + * |
| 8 | + * This program is free software: you can redistribute it and/or modify |
| 9 | + * it under the terms of the GNU Affero General Public License as |
| 10 | + * published by the Free Software Foundation, either version 3 of the |
| 11 | + * License, or (at your option) any later version. |
| 12 | + * |
| 13 | + * This program is distributed in the hope that it will be useful, |
| 14 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | + * GNU Affero General Public License for more details. |
| 17 | + * |
| 18 | + * You should have received a copy of the GNU Affero General Public License |
| 19 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 | + * |
| 21 | + */ |
| 22 | + |
| 23 | +import { mount } from '@vue/test-utils' |
| 24 | + |
| 25 | +import NcActionButton from '../../../../src/components/NcActionButton/NcActionButton.vue' |
| 26 | + |
| 27 | +describe('NcActionButton', () => { |
| 28 | + it('supports icon classes', () => { |
| 29 | + const wrapper = mount(NcActionButton, { |
| 30 | + propsData: { |
| 31 | + icon: 'icon-add' |
| 32 | + }, |
| 33 | + slots: { |
| 34 | + default: 'text', |
| 35 | + }, |
| 36 | + }) |
| 37 | + expect(wrapper.find('.action-button__icon').classes('icon-add')).toBe(true) |
| 38 | + }) |
| 39 | + |
| 40 | + it('supports icon URL', () => { |
| 41 | + const wrapper = mount(NcActionButton, { |
| 42 | + propsData: { |
| 43 | + icon: 'http://example.com/icon.png' |
| 44 | + }, |
| 45 | + slots: { |
| 46 | + default: 'text', |
| 47 | + }, |
| 48 | + }) |
| 49 | + expect(wrapper.find('.action-button__icon').attributes('style')).toContain('background-image: url(http://example.com/icon.png);') |
| 50 | + }) |
| 51 | + |
| 52 | + it('supports relative icon URL', () => { |
| 53 | + const wrapper = mount(NcActionButton, { |
| 54 | + propsData: { |
| 55 | + icon: '/icon.png', |
| 56 | + }, |
| 57 | + slots: { |
| 58 | + default: 'text', |
| 59 | + }, |
| 60 | + }) |
| 61 | + expect(wrapper.find('.action-button__icon').attributes('style')).toContain('background-image: url(/icon.png);') |
| 62 | + }) |
| 63 | +}) |
0 commit comments