Last active
August 10, 2017 20:36
-
-
Save yury-sannikov/c50a5c9ba73189edb9126fa90c16481a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// inputFieldAdapter.js | |
const sinon = require('sinon'); | |
exports.inputFieldAdapter = function inputFieldAdapter(componentInstance, params = {}) { | |
const setParam = (cmp, name, value) => cmp.params[name] = params.hasOwnProperty(name) ? params[name] : value; | |
// Set default property values on a component instance | |
setParam(componentInstance, 'label', ''); | |
setParam(componentInstance, 'fieldType', ''); | |
... | |
// Add component-specific methods on component instance | |
componentInstance.validate = sinon.spy(); | |
componentInstance.updateValue = sinon.spy(); | |
... | |
componentInstance.clearOptions = sinon.spy(); | |
return componentInstance; | |
} | |
// baseUIAdapters.js | |
const { inputFieldAdapter } = require('./adapters/inputFieldAdapter') | |
exports.baseUIAdapters = ({register}) => { | |
register('BaseUI:InputField', inputFieldAdapter) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment