shuimo-design / shuimo-ui

ไธ€ๆฌพๆฐดๅขจ้ฃŽUI
https://shuimo.design
MIT License
285 stars 24 forks source link

๐Ÿ”ง [inputNumber] fix input number less than min #77

Closed QJvic closed 8 months ago

QJvic commented 8 months ago

๐Ÿค” Nature of this PR

๐Ÿ”— Related Issue

https://github.com/shuimo-design/shuimo-ui/issues/76

๐Ÿ’ก Background and Solution

โœ… Pre-merge Checklist

change the position of setting e.target.value

โ—๏ธPlease self-check and check all options.โ—๏ธ

higuaifan commented 8 months ago

Can you provide a test case about this bug?

QJvic commented 8 months ago

Can you provide a test case about this bug?

test('่ฎพ็ฝฎๆœ€ๅฐๅ€ผ', async () => {
  const wrapper = mount(MInputNumber, {
    props: { modelValue: 5, min: 4 },
  });

  await wrapper.find('input').setValue(4);

  // modify once more
  await wrapper.find('input').setValue(3);

  expect(wrapper.element.querySelector('input')!.value).toBe('4');
});

Before fixing, the result is

AssertionError: expected '3' to be '4' // Object.is equality
Expected :4
Actual   :3

After fixing, the test passed.

Do you need me to add a PR or add it you yourself ?

higuaifan commented 8 months ago

Do you need me to add a PR or add it you yourself ?

If you want more commits, PR Welcome. If not, itโ€™s okay for me to add it. That's up to you๐Ÿ˜ถโ€๐ŸŒซ๏ธ.

QJvic commented 8 months ago

Do you need me to add a PR or add it you yourself ?

If you want more commits, PR Welcome. If not, itโ€™s okay for me to add it. That's up to you๐Ÿ˜ถโ€๐ŸŒซ๏ธ.

I'm pleasure to add more commits. ๐Ÿค“