Sha256: 1876b18ef8de7e0ded65047cc70cbf7a592a735fb7fde914b724d8832ddbc970

Contents?: true

Size: 1.5 KB

Versions: 26

Compression:

Stored size: 1.5 KB

Contents

'use strict';

require('../../utils/click/isClickableInput.js');
require('../../utils/dataTransfer/Clipboard.js');
require('../../utils/edit/isEditable.js');
require('../../utils/edit/maxLength.js');
var isElementType = require('../../utils/misc/isElementType.js');
var getWindow = require('../../utils/misc/getWindow.js');
var isFocusable = require('../../utils/focus/isFocusable.js');
require('../../utils/keyDef/readNextDescriptor.js');
var cloneEvent = require('../../utils/misc/cloneEvent.js');
require('../../utils/misc/level.js');
require('../../options.js');
var focus = require('../focus.js');
var registry = require('./registry.js');

registry.behavior.click = (event, target, instance)=>{
    const context = target.closest('button,input,label,select,textarea');
    const control = context && isElementType.isElementType(context, 'label') && context.control;
    if (control) {
        return ()=>{
            if (isFocusable.isFocusable(control)) {
                focus.focusElement(control);
            }
            instance.dispatchEvent(control, cloneEvent.cloneEvent(event));
        };
    } else if (isElementType.isElementType(target, 'input', {
        type: 'file'
    })) {
        return ()=>{
            // blur fires when the file selector pops up
            focus.blurElement(target);
            target.dispatchEvent(new (getWindow.getWindow(target)).Event('fileDialog'));
            // focus fires after the file selector has been closed
            focus.focusElement(target);
        };
    }
};

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