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.26 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.25 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.24 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.23 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.22 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.21 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.20 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.19 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.18 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.17 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.16 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.15 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.14 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.13 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.12 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.11 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.10 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.9 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.8 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js
clapton-0.0.7 lib/clapton/javascripts/node_modules/@testing-library/user-event/dist/cjs/utility/type.js