maxgui/tests/unit/utils.js
/**
 * This function mockups the change of an input field. By default, it finds all input
 * elements and expect to have one element only, if selector param is defined, it finds element
 * using selector
 * @param {Object} wrapper A Wrapper is an object that contains a mounted component and methods to test the component
 * @param {String} selector valid DOM selector syntax. e.g. '.class' or '#id'
 * @param {String} newValue new string value for input field
 */
This function mockups the change of an input field. By default, it finds all input
elements and expect to have one element only, if selector param is defined, it finds element
using selector
@param {Object} wrapper A Wrapper is an object that contains a mounted component and methods to test the component
@param {String} selector valid DOM selector syntax.
This function mockups the change of an input field . By default it finds all input elements and expect to have one element only if selector param is defined it finds element using selector @param { Object } wrapper A Wrapper is an object that contains a mounted component and methods to test the component @param { String } selector valid DOM selector syntax .
async function inputChangeMock(wrapper, newValue, selector = '') {
    let inputs
    if (selector) {
        inputs = wrapper.findAll(selector)
    } else {
        inputs = wrapper.findAll('input')
    }
    inputs.at(0).element.value = newValue
    expect(inputs.length).to.be.equal(1)
    await inputs.at(0).trigger('input')
}
async function inputChangeMock ( wrapper , newValue , selector = '' ) { let inputs if ( selector ) { inputs = wrapper . findAll ( selector ) } else { inputs = wrapper . findAll ( 'input' ) } inputs . at ( 0 ) . element . value = newValue expect ( inputs . length ) . to . be . equal ( 1 ) await inputs . at ( 0 ) . trigger ( 'input' ) }
This function mockups the change of an input field.
This function mockups the change of an input field .
// manually triggering input event on v-text-field