vimo-dt
Version:
A Vue2.x UI Project For Mobile & HyBrid
50 lines (42 loc) • 1.7 kB
JavaScript
;
var _vueTestUtils = require('vue-test-utils');
var _index = require('../index');
var _index2 = _interopRequireDefault(_index);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var options = {
propsData: {
showFocusHighlight: true,
showValidHighlight: true,
showInvalidHighlight: true,
clearInput: true,
clearOnEdit: true,
disabled: true,
max: 100,
min: 1,
decimal: 3,
autofocus: true,
readonly: true,
check: true,
step: 1,
debounce: 1000,
mode: 'md',
type: 'text',
value: 'this is a text',
placeholder: 'this is a placeholder'
}
};
describe('Input', function () {
it('@base: renders the correct markup', function () {
var wrapper = (0, _vueTestUtils.mount)(_index2.default, options);
var result = '<div class="ion-input input-md clearInput"><div class="input-inner-wrap"><input type="text" placeholder="this is a placeholder" disabled="disabled" readonly="readonly" max="100" min="1" step="1" autofocus="autofocus" class="text-input text-input-md"></div> <button class="ion-button text-input-clear-icon button button-ios button-clear button-clear-ios button-clear-ios-default"><span class="button-inner"></span></button></div>';
expect(wrapper.html()).toEqual(result);
});
it('@base: component must have a name', function () {
var wrapper = (0, _vueTestUtils.mount)(_index2.default, options);
expect(wrapper.name()).toEqual('Input');
});
it('@base: have the right className', function () {
var wrapper = (0, _vueTestUtils.mount)(_index2.default, options);
expect(wrapper.hasClass('ion-input')).toBeTruthy();
});
});