diff --git a/src/qComponents/QInputNumber/QInputNumber.test.js b/src/qComponents/QInputNumber/QInputNumber.test.js new file mode 100644 index 00000000..623a1f98 --- /dev/null +++ b/src/qComponents/QInputNumber/QInputNumber.test.js @@ -0,0 +1,23 @@ +import Component from './src/QInputNumber.vue'; + +describe('QInputNumber', () => { + it('should match snapshot', async () => { + const { element } = shallowMount(Component); + + expect(element).toMatchSnapshot(); + }); + + it('should match snapshot without controls', async () => { + 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..71d533f3 --- /dev/null +++ b/src/qComponents/QInputNumber/__snapshots__/QInputNumber.test.js.snap @@ -0,0 +1,55 @@ +// 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 21df76a7..1c0a3b7b 100644 --- a/src/qComponents/QInputNumber/src/QInputNumber.vue +++ b/src/qComponents/QInputNumber/src/QInputNumber.vue @@ -15,6 +15,7 @@ :value="currentValue" class="q-input-number__input" :disabled="isDisabled" + :placeholder="placeholder" @blur="handleBlur" @focus="handleFocus" @input="handleChangeInput($event, 'input')" @@ -88,6 +89,10 @@ export default { type: Boolean, default: true }, + placeholder: { + type: String, + default: null + }, value: { type: [Number, String], default: null, diff --git a/stories/components/QInputNumber.stories.js b/stories/components/QInputNumber.stories.js index 0cfff4a3..333ae1e6 100644 --- a/stories/components/QInputNumber.stories.js +++ b/stories/components/QInputNumber.stories.js @@ -16,7 +16,7 @@ export const Default = (_, { argTypes }) => ({ props: Object.keys(argTypes).filter(val => val !== 'value'), data() { return { - value: '2' + value: 2 }; }, methods: { @@ -35,4 +35,3 @@ export const Default = (_, { argTypes }) => ({ }); Default.storyName = 'Default'; -Default.args = { value: 17 };