File tree Expand file tree Collapse file tree 5 files changed +57
-20
lines changed
Expand file tree Collapse file tree 5 files changed +57
-20
lines changed Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ Files: package.json package-lock.json .github/pull_request_template.md
77Copyright: Nextcloud GmbH and Nextcloud contributors
88License: AGPL-3.0-or-later
99
10- Files: styleguide/assets/icons.css styleguide/assets/server.css cypress/snapshots/* tests/unit/functions/usernameToColor/__snapshots__/usernameToColor.spec.js.snap
10+ Files: styleguide/assets/icons.css cypress/snapshots/* tests/unit/functions/usernameToColor/__snapshots__/usernameToColor.spec.js.snap
1111Copyright: Nextcloud GmbH and Nextcloud contributors
1212License: AGPL-3.0-or-later
1313
Original file line number Diff line number Diff line change 1+ /**
2+ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
3+ * SPDX-License-Identifier: AGPL-3.0-or-later
4+ */
5+
6+ import type { mount } from '@cypress/vue2'
7+
8+ // Augment the Cypress namespace to include type definitions for
9+ // your custom commands
10+ declare global {
11+ // eslint-disable-next-line @typescript-eslint/no-namespace
12+ namespace Cypress {
13+ interface Chainable {
14+ mount : typeof mount
15+ }
16+ }
17+ }
18+
19+ export { }
Original file line number Diff line number Diff line change 1+ /**
2+ * SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors
3+ * SPDX-License-Identifier: AGPL-3.0-or-later
4+ */
5+
6+ import NcCheckboxRadioSwitch from '../../src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue'
7+
8+ describe ( 'NcCheckboxRadioSwitch' , ( ) => {
9+ it ( 'Sets attributes correctly' , ( ) => {
10+ cy . mount ( {
11+ render : ( h ) => h ( NcCheckboxRadioSwitch , {
12+ // TODO: With Vue3 move class and style to attrs
13+ class : 'my-class' ,
14+ style : 'background: red;' ,
15+ attrs : {
16+ 'aria-describedby' : 'unique-id' ,
17+ 'data-my-attribute' : 'yes' ,
18+ } ,
19+ } , [ 'My checkbox' ] ) ,
20+ } ) . then ( ( { wrapper } ) => {
21+ // Class and style belong the wrapper
22+ expect ( wrapper . classes ( 'my-class' ) ) . to . be . true
23+ // expect(wrapper.attributes('style')).to.equal('background: red;')
24+ // Custom data attributes too
25+ expect ( wrapper . attributes ( 'data-my-attribute' ) ) . to . equal ( 'yes' )
26+ // real HTML attributes are passed to the real checkbox
27+ expect ( wrapper . attributes ( 'aria-describedby' ) ) . to . be . undefined
28+ } )
29+
30+ cy . findByRole ( 'checkbox' ) . should ( 'have.attr' , 'aria-describedby' , 'unique-id' )
31+ } )
32+ } )
Original file line number Diff line number Diff line change 33 * SPDX-License-Identifier: AGPL-3.0-or-later
44 */
55
6+ import { mount } from '@cypress/vue2'
67import { addCompareSnapshotCommand } from 'cypress-visual-regression/dist/command'
78
89import '@testing-library/cypress/add-commands'
910
1011addCompareSnapshotCommand ( )
12+
13+ // Example use:
14+ // cy.mount(MyComponent)
15+ Cypress . Commands . add ( 'mount' , mount )
Original file line number Diff line number Diff line change @@ -10,22 +10,3 @@ import '../../styleguide/assets/icons.css'
1010
1111// cypress commands
1212import './commands'
13- import { mount } from '@cypress/vue2'
14-
15- // Augment the Cypress namespace to include type definitions for
16- // your custom command.
17- // Alternatively, can be defined in cypress/support/component.d.ts
18- // with a <reference path="./component" /> at the top of your spec.
19-
20- declare global {
21- // eslint-disable-next-line @typescript-eslint/no-namespace
22- namespace Cypress {
23- interface Chainable {
24- mount : typeof mount
25- }
26- }
27- }
28-
29- // Example use:
30- // cy.mount(MyComponent)
31- Cypress . Commands . add ( 'mount' , mount )
You can’t perform that action at this time.
0 commit comments