feat(Field): highlight word num when reaching maxlength

This commit is contained in:
陈嘉涵
2020-02-05 15:58:51 +08:00
parent eb7abea49c
commit 61093ef00f
5 changed files with 32 additions and 1 deletions
@@ -53,6 +53,15 @@ exports[`label-width prop without unit 1`] = `
</div>
`;
exports[`reach max word-limit 1`] = `
<div class="van-cell van-field">
<div class="van-cell__value van-cell__value--alone">
<div class="van-field__body"><input type="text" class="van-field__control"></div>
<div class="van-field__word-limit"><span class="van-field__word-num van-field__word-num--full">3</span>/3</div>
</div>
</div>
`;
exports[`render input slot 1`] = `
<div class="van-cell van-field">
<div class="van-cell__value van-cell__value--alone">
+11
View File
@@ -280,3 +280,14 @@ test('formatter prop', () => {
input.trigger('input');
expect(wrapper.emitted('input')[1][0]).toEqual('efg');
});
test('reach max word-limit', () => {
const wrapper = mount(Field, {
propsData: {
value: 'foo',
maxlength: 3,
showWordLimit: true,
},
});
expect(wrapper).toMatchSnapshot();
});