-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5777 from nextcloud-libraries/fix/checkbox-attrs-…
…aria
- Loading branch information
Showing
7 changed files
with
78 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import type { mount } from '@cypress/vue2' | ||
|
||
// Augment the Cypress namespace to include type definitions for | ||
// your custom commands | ||
declare global { | ||
// eslint-disable-next-line @typescript-eslint/no-namespace | ||
namespace Cypress { | ||
interface Chainable { | ||
mount: typeof mount | ||
} | ||
} | ||
} | ||
|
||
export {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* SPDX-FileCopyrightText: Nextcloud GmbH and Nextcloud contributors | ||
* SPDX-License-Identifier: AGPL-3.0-or-later | ||
*/ | ||
|
||
import NcCheckboxRadioSwitch from '../../src/components/NcCheckboxRadioSwitch/NcCheckboxRadioSwitch.vue' | ||
|
||
describe('NcCheckboxRadioSwitch', () => { | ||
it('Sets attributes correctly', () => { | ||
cy.mount({ | ||
render: (h) => h(NcCheckboxRadioSwitch, { | ||
// TODO: With Vue3 move class and style to attrs | ||
class: 'my-class', | ||
style: 'background: red;', | ||
attrs: { | ||
'aria-describedby': 'unique-id', | ||
'data-my-attribute': 'yes', | ||
}, | ||
}, ['My checkbox']), | ||
}).then(({ wrapper }) => { | ||
// Class and style belong the wrapper | ||
expect(wrapper.classes('my-class')).to.be.true | ||
// expect(wrapper.attributes('style')).to.equal('background: red;') | ||
// Custom data attributes too | ||
expect(wrapper.attributes('data-my-attribute')).to.equal('yes') | ||
// real HTML attributes are passed to the real checkbox | ||
expect(wrapper.attributes('aria-describedby')).to.be.undefined | ||
}) | ||
|
||
cy.findByRole('checkbox').should('have.attr', 'aria-describedby', 'unique-id') | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters