maxgui/src/components/common/DetailsPage/__tests__/DetailsParametersTable.spec.js
/**
 * This function puts component into editable mode to mockup the changes of parameters and open
 * confirmation dialog.
 * @param {Object} wrapper A Wrapper is an object that contains a mounted component and methods to test the component
 * @param {String} isDual If it is true, it mocks up the changes of enum and boolean parameters, otherwise
 * only enum will be mocked up. enum_param value will change from primary to secondary, bool_param will change
 * from false to true
 */
This function puts component into editable mode to mockup the changes of parameters and open
confirmation dialog.
@param {Object} wrapper A Wrapper is an object that contains a mounted component and methods to test the component
@param {String} isDual If it is true, it mocks up the changes of enum and boolean parameters, otherwise
only enum will be mocked up. enum_param value will change from primary to secondary, bool_param will change
from false to true
This function puts component into editable mode to mockup the changes of parameters and open confirmation dialog . @param { Object } wrapper A Wrapper is an object that contains a mounted component and methods to test the component @param { String } isDual If it is true it mocks up the changes of enum and boolean parameters otherwise only enum will be mocked up . enum_param value will change from primary to secondary bool_param will change from false to true
async function mockupParametersChange(wrapper, isDual) {
    const intercept = async () => {
        const enumParamTd = wrapper.find(`.cell-${1}-enum_param`)
        await itemSelectMock(enumParamTd, 'secondary')
        expect(wrapper.vm.$data.changedParams.length).to.be.equal(1)
        expect(wrapper.vm.$data.changedParams[0].value).to.be.equal('secondary')
        if (isDual) {
            const boolParamCell = wrapper.find(`.cell-${1}-bool_param`)
            await itemSelectMock(boolParamCell, true)
            expect(wrapper.vm.$data.changedParams.length).to.be.equal(2)
            expect(wrapper.vm.$data.changedParams[1].value).to.be.equal(true)
        }
    }
    const cb = () => expect(wrapper.vm.hasChanged).to.be.true
    await mockupOpenConfirmationDialog(wrapper, intercept, cb)
}
async function mockupParametersChange ( wrapper , isDual ) { const intercept = async ( ) => { const enumParamTd = wrapper . find ( ` ${ 1 } ` ) await itemSelectMock ( enumParamTd , 'secondary' ) expect ( wrapper . vm . $data . changedParams . length ) . to . be . equal ( 1 ) expect ( wrapper . vm . $data . changedParams [ 0 ] . value ) . to . be . equal ( 'secondary' ) if ( isDual ) { const boolParamCell = wrapper . find ( ` ${ 1 } ` ) await itemSelectMock ( boolParamCell , true ) expect ( wrapper . vm . $data . changedParams . length ) . to . be . equal ( 2 ) expect ( wrapper . vm . $data . changedParams [ 1 ] . value ) . to . be . equal ( true ) } } const cb = ( ) => expect ( wrapper . vm . hasChanged ) . to . be . true await mockupOpenConfirmationDialog ( wrapper , intercept , cb ) }
This function puts component into editable mode to mockup the changes of parameters and open
 confirmation dialog.
This function puts component into editable mode to mockup the changes of parameters and open confirmation dialog .
// mockup selecting item on an enum parameter // mockup selecting item on an boolean parameter