Skip to content

Commit

Permalink
fix(VBtn): don't add color classes when disabled
Browse files Browse the repository at this point in the history
fixes #8030
  • Loading branch information
dsseng committed Aug 7, 2019
1 parent 6e4f083 commit d1755df
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/vuetify/src/components/VBtn/VBtn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,6 @@ export default baseMixins.extend<options>().extend({
? this.value
: JSON.stringify(this.value)

return h(tag, setColor(this.color, data), children)
return h(tag, this.disabled ? data : setColor(this.color, data), children)
},
})
15 changes: 15 additions & 0 deletions packages/vuetify/src/components/VBtn/__tests__/VBtn.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,4 +270,19 @@ describe('VBtn.ts', () => {
wrapper.setProps({ value: { foo: 'bar' } })
expect(wrapper.attributes('value')).toBe('{"foo":"bar"}')
})

it('should not add color classes if disabled', () => {
const wrapper = mountFunction({
propsData: {
color: 'primary--text text--darken-2',
},
})

expect(wrapper.html()).toMatchSnapshot()

wrapper.setProps({
disabled: true,
})
expect(wrapper.html()).toMatchSnapshot()
})
})
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`VBtn.ts should not add color classes if disabled 1`] = `
<button type="button"
class="v-btn v-btn--contained theme--light v-size--default primary--text text--darken-2"
>
<span class="v-btn__content">
</span>
</button>
`;

exports[`VBtn.ts should not add color classes if disabled 2`] = `
<button type="button"
class="v-btn v-btn--contained v-btn--disabled theme--light v-size--default"
disabled="disabled"
>
<span class="v-btn__content">
</span>
</button>
`;

exports[`VBtn.ts should render an <a> tag when using href prop 1`] = `
<a href="http://www.google.com"
class="v-btn v-btn--contained theme--light v-size--default"
Expand Down

0 comments on commit d1755df

Please sign in to comment.