diff --git a/src/qComponents/QInputNumber/QInputNumber.test.js b/src/qComponents/QInputNumber/QInputNumber.test.js new file mode 100644 index 00000000..87fcd27d --- /dev/null +++ b/src/qComponents/QInputNumber/QInputNumber.test.js @@ -0,0 +1,23 @@ +import Component from './src/QInputNumber'; + +describe('QInputNumber', () => { + it('should match snapshot', () => { + const { element } = shallowMount(Component); + + expect(element).toMatchSnapshot(); + }); + + it('should match snapshot without controls', () => { + const { element } = shallowMount(Component, { + propsData: { + controls: false + } + }); + + expect(element).toMatchSnapshot(); + }); + + it('data should match snapshot', () => { + expect(Component.data()).toMatchSnapshot(); + }); +}); diff --git a/src/qComponents/QInputNumber/__snapshots__/QInputNumber.test.js.snap b/src/qComponents/QInputNumber/__snapshots__/QInputNumber.test.js.snap new file mode 100644 index 00000000..82635c2c --- /dev/null +++ b/src/qComponents/QInputNumber/__snapshots__/QInputNumber.test.js.snap @@ -0,0 +1,53 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`QInputNumber data should match snapshot 1`] = ` +Object { + "number": null, + "prevNumber": null, + "userNumber": null, +} +`; + +exports[`QInputNumber should match snapshot 1`] = ` +
+
+`; + +exports[`QInputNumber should match snapshot without controls 1`] = ` +
+ + + + + +
+`; diff --git a/src/qComponents/QInputNumber/src/QInputNumber.vue b/src/qComponents/QInputNumber/src/QInputNumber.vue index 700cc29e..e31def04 100644 --- a/src/qComponents/QInputNumber/src/QInputNumber.vue +++ b/src/qComponents/QInputNumber/src/QInputNumber.vue @@ -15,10 +15,13 @@ :value="currentValue" class="q-input-number__input" :disabled="isDisabled" + :placeholder="placeholder" + :validate-event="false" + type="number" @blur="handleBlur" @focus="handleFocus" - @input="handleInput" - @change="handleChange" + @input="handleChangeInput($event, 'input')" + @change="handleChangeInput($event, 'change')" />