Skip to content
This repository was archived by the owner on Jan 7, 2022. It is now read-only.

Commit d9f45b7

Browse files
committed
Don't add the id attribute when it is empty. Fixes: #202.
1 parent 0adf7f8 commit d9f45b7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/Datetime.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ export default {
6565
},
6666
inputId: {
6767
type: String,
68-
default: ''
68+
default: null
6969
},
7070
inputClass: {
7171
type: [Object, Array, String],

test/specs/Datetime.spec.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,16 @@ describe('Datetime.vue', function () {
4444
expect(vm.$('.vdatetime-input')).to.have.id('id-name')
4545
})
4646

47+
it('should not add empty id to input', function () {
48+
const vm = createVM(this,
49+
`<Datetime></Datetime>`,
50+
{
51+
components: { Datetime }
52+
})
53+
54+
expect(vm.$('.vdatetime-input')).to.not.have.attribute('id')
55+
})
56+
4757
it('should add style to input', function () {
4858
const vm = createVM(this,
4959
`<Datetime :input-style="{backgroundColor: 'cyan'}"></Datetime>`,

0 commit comments

Comments
 (0)