|
| 1 | +/** |
| 2 | + * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors |
| 3 | + * SPDX-License-Identifier: AGPL-3.0-or-later |
| 4 | + */ |
| 5 | + |
| 6 | +import { mount } from 'cypress/vue2' |
| 7 | +import NcAppSettingsDialog from '../../src/components/NcAppSettingsDialog/NcAppSettingsDialog.vue' |
| 8 | +import NcAppSettingsSection from '../../src/components/NcAppSettingsSection/NcAppSettingsSection.vue' |
| 9 | +import { defineComponent } from 'vue' |
| 10 | + |
| 11 | +describe('NcAppSettingsDialog', () => { |
| 12 | + it('Dialog is correctly labelled', () => { |
| 13 | + mount(NcAppSettingsDialog, { |
| 14 | + propsData: { |
| 15 | + open: true, |
| 16 | + name: 'My settings dialog', |
| 17 | + }, |
| 18 | + slots: { |
| 19 | + default: defineComponent({ |
| 20 | + render: (h) => h(NcAppSettingsSection, { props: { name: 'First section', id: 'first' } }) |
| 21 | + }) |
| 22 | + }, |
| 23 | + }) |
| 24 | + |
| 25 | + cy.findByRole('dialog', { name: 'My settings dialog' }).should('exist') |
| 26 | + }) |
| 27 | + |
| 28 | + it('Dialog sections are correctly labelled', () => { |
| 29 | + mount(NcAppSettingsDialog, { |
| 30 | + propsData: { |
| 31 | + open: true, |
| 32 | + name: 'My settings dialog', |
| 33 | + showNavigation: true, |
| 34 | + }, |
| 35 | + slots: { |
| 36 | + default: defineComponent({ |
| 37 | + render: (h) => h(NcAppSettingsSection, { props: { name: 'First section', id: 'first' } }, ['The section content']) |
| 38 | + }) |
| 39 | + }, |
| 40 | + }) |
| 41 | + |
| 42 | + cy.findByRole('dialog', { name: 'My settings dialog' }).should('exist') |
| 43 | + cy.findByRole('dialog', { name: 'My settings dialog' }) |
| 44 | + .findByRole('region', { name: 'First section' }) |
| 45 | + .should('exist') |
| 46 | + .and('contain.text', 'The section content') |
| 47 | + }) |
| 48 | +}) |
0 commit comments