Skip to content

Commit

Permalink
Revert "feat(UsaCheckbox): add disabled prop and render `aria-disab…
Browse files Browse the repository at this point in the history
…led` attr"

This reverts commit efeaac82645e8a3bc85cfb38bae3d3198e8b0594.
  • Loading branch information
patrickcate committed Oct 10, 2023
1 parent b58fc6f commit 6f07c3d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 30 deletions.
15 changes: 0 additions & 15 deletions src/components/UsaCheckbox/UsaCheckbox.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const defaultProps = {
modelValue: UsaCheckbox.props.modelValue.default,
label: UsaCheckbox.props.label.default,
description: UsaCheckbox.props.description.default,
disabled: UsaCheckbox.props.disabled.default,
id: UsaCheckbox.props.id.default,
customClasses: UsaCheckbox.props.customClasses.default(),
}
Expand All @@ -27,9 +26,6 @@ export default {
description: {
control: { type: 'text' },
},
disabled: {
control: { type: 'boolean' },
},
id: {
control: { type: 'text' },
},
Expand All @@ -45,7 +41,6 @@ export default {
modelValue: defaultProps.modelValue,
label: defaultProps.label,
description: defaultProps.description,
disabled: defaultProps.disabled,
id: defaultProps.id,
customClasses: defaultProps.customClasses,
default: '',
Expand All @@ -70,7 +65,6 @@ const DefaultTemplate = (args, { argTypes }) => ({
:tile="tile"
:label="label"
:description="description"
:disabled="disabled"
:id="id"
:custom-classes="customClasses"
v-model="modelValue"
Expand Down Expand Up @@ -106,15 +100,6 @@ CheckedByDefaultCheckbox.args = {
}
CheckedByDefaultCheckbox.storyName = 'Checked by Default'

export const DisabledCheckbox = DefaultTemplate.bind({})
DisabledCheckbox.args = {
...defaultProps,
label: 'Sojourner Truth',
modelValue: true,
disabled: true,
}
DisabledCheckbox.storyName = 'Disabled'

export const TileCheckbox = DefaultTemplate.bind({})
TileCheckbox.args = {
...defaultProps,
Expand Down
15 changes: 6 additions & 9 deletions src/components/UsaCheckbox/UsaCheckbox.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,8 @@ describe('UsaCheckbox', () => {
cy.get('div.usa-checkbox').should('exist')

cy.get('input.usa-checkbox__input')
.should('have.attr', 'type', 'checkbox')
.and('not.have.attr', 'disabled', 'disabled')
.and('not.have.attr', 'aria-disabled', 'true')
.and('not.have.attr', 'aria-disabled', 'false')
.should('have.attr', 'type')
.and('contain', 'checkbox')
cy.get('input.usa-checkbox__input').should('have.attr', 'id')
cy.get('input.usa-checkbox__input').should('not.be.checked')

Expand Down Expand Up @@ -85,18 +83,17 @@ describe('UsaCheckbox', () => {
)
})

it('`disabled` prop disables checkbox', () => {
it('`disabled` attr binding disables checkbox', () => {
mount(UsaCheckbox, {
props: {
label: 'Test label',
},
attrs: {
disabled: true,
},
})

cy.get('.usa-checkbox__input')
.should('be.disabled')
.and('have.attr', 'disabled', 'disabled')
.and('have.attr', 'aria-disabled', 'true')
cy.get('.usa-checkbox__input').should('be.disabled')
})

it('root element does not inherit attrs', () => {
Expand Down
6 changes: 0 additions & 6 deletions src/components/UsaCheckbox/UsaCheckbox.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,6 @@ const props = defineProps({
type: String,
default: '',
},
disabled: {
type: Boolean,
default: false,
},
id: {
type: String,
default: '',
Expand Down Expand Up @@ -71,8 +67,6 @@ const classes = computed(() => [
v-bind="$attrs"
:id="computedId"
v-model="checkboxValue"
:disabled="disabled"
:aria-disabled="disabled || null"
class="usa-checkbox__input"
type="checkbox"
:class="classes"
Expand Down

0 comments on commit 6f07c3d

Please sign in to comment.