mirror of
https://github.com/ElemeFE/element.git
synced 2025-12-16 11:44:01 +08:00
input: fix focus
This commit is contained in:
@@ -99,15 +99,30 @@ describe('MessageBox', () => {
|
||||
inputErrorMessage: 'validation failed'
|
||||
});
|
||||
setTimeout(() => {
|
||||
expect(document.querySelector('.el-message-box__input')).to.exist;
|
||||
const messageBox = document.querySelector('.el-message-box__wrapper').__vue__.$parent;
|
||||
expect(messageBox.$el.querySelector('.el-message-box__input')).to.exist;
|
||||
const haveFocus = messageBox.$el.querySelector('input').isSameNode(document.activeElement);
|
||||
expect(haveFocus).to.true;
|
||||
messageBox.inputValue = 'no';
|
||||
setTimeout(() => {
|
||||
expect(document.querySelector('.el-message-box__errormsg')
|
||||
expect(messageBox.$el.querySelector('.el-message-box__errormsg')
|
||||
.textContent).to.equal('validation failed');
|
||||
done();
|
||||
}, 100);
|
||||
}, 200);
|
||||
}, 700);
|
||||
});
|
||||
|
||||
it('prompt: focus on textarea', done => {
|
||||
MessageBox.prompt('这是一段内容', {
|
||||
inputType: 'textarea',
|
||||
title: '标题名称'
|
||||
});
|
||||
setTimeout(() => {
|
||||
const messageBox = document.querySelector('.el-message-box__wrapper').__vue__.$parent;
|
||||
const haveFocus = messageBox.$el.querySelector('textarea').isSameNode(document.activeElement);
|
||||
expect(haveFocus).to.true;
|
||||
done();
|
||||
}, 700);
|
||||
});
|
||||
|
||||
describe('custom validator', () => {
|
||||
|
||||
Reference in New Issue
Block a user