Sha256: d504cdc69c8ddace1a5ce93b018b45f37411ce1a967d833eaf100fcb7f885fe3

Contents?: true

Size: 1.13 KB

Versions: 26

Compression:

Stored size: 1.13 KB

Contents

'use strict';

var index = require('../keyboard/index.js');
require('../utils/click/isClickableInput.js');
require('../utils/dataTransfer/Clipboard.js');
require('../utils/edit/isEditable.js');
require('../utils/edit/maxLength.js');
require('../utils/keyDef/readNextDescriptor.js');
require('../utils/misc/level.js');
require('../options.js');
var setSelectionRange = require('../event/selection/setSelectionRange.js');

async function type(element, text, { skipClick = this.config.skipClick, skipAutoClose = this.config.skipAutoClose, initialSelectionStart, initialSelectionEnd } = {}) {
    // TODO: properly type guard
    // we use this workaround for now to prevent changing behavior
    if (element.disabled) return;
    if (!skipClick) {
        await this.click(element);
    }
    if (initialSelectionStart !== undefined) {
        setSelectionRange.setSelectionRange(element, initialSelectionStart, initialSelectionEnd !== null && initialSelectionEnd !== void 0 ? initialSelectionEnd : initialSelectionStart);
    }
    await this.keyboard(text);
    if (!skipAutoClose) {
        await index.releaseAllKeys(this);
    }
}

exports.type = type;

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
clapton-0.0.6 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.5 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.4 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.3 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.2 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.1 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js