{"size": 1767, "ext": "js", "max_stars_repo_path": "packages/integration-tests/src/components/accessibility/test-delegates-focus-click-shadow-input-negative-tab-index/delegates-focus-click-shadow-input-negative-tab-index.spec.js", "max_stars_repo_name": "luminixinc/lwc", "max_stars_repo_stars_event_min_datetime": "2020-04-08T16:53:32.000Z", "max_stars_repo_stars_event_max_datetime": "2020-04-08T16:53:32.000Z", "max_issues_repo_path": "packages/integration-tests/src/components/accessibility/test-delegates-focus-click-shadow-input-negative-tab-index/delegates-focus-click-shadow-input-negative-tab-index.spec.js", "max_issues_repo_name": "noob-tactics/lwc", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "packages/integration-tests/src/components/accessibility/test-delegates-focus-click-shadow-input-negative-tab-index/delegates-focus-click-shadow-input-negative-tab-index.spec.js", "max_forks_repo_name": "noob-tactics/lwc", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 38.4130434783, "max_line_length": 102, "alphanum_fraction": 0.5557441992}
/*
 * Copyright (c) 2018, salesforce.com, inc.
 * All rights reserved.
 * SPDX-License-Identifier: MIT
 * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
 */
describe('Tabbing into custom element with delegates focus', () => {
    const URL = 'http://localhost:4567/delegates-focus-click-shadow-input-negative-tab-index';

    before(() => {
        browser.url(URL);
    });

    it('should apply focus to input in shadow', function() {
        const div = browser.$(function() {
            return document
                .querySelector('integration-delegates-focus-click-shadow-input-negative-tab-index')
                .shadowRoot.querySelector('.selectable-div');
        });
        div.click();
        const input = browser.$(function() {
            return document
                .querySelector('integration-delegates-focus-click-shadow-input-negative-tab-index')
                .shadowRoot.querySelector('integration-child')
                .shadowRoot.querySelector('.negative-tab-index-input');
        });
        input.click();
        // browser.click('.selectable-div');
        // browser.click('.negative-tab-index-input');
        browser.waitUntil(
            () => {
                const active = browser.$(function() {
                    return document
                        .querySelector(
                            'integration-delegates-focus-click-shadow-input-negative-tab-index'
                        )
                        .shadowRoot.querySelector('integration-child').shadowRoot.activeElement;
                });
                return active.getTagName() === 'input';
            },
            500,
            'expect input to be focused'
        );
    });
});
