Skip to content

Commit 925a8d7

Browse files
committed
chore(integration-tests): delegate-focus- -> delegates-focus-
1 parent 4f543a0 commit 925a8d7

File tree

10 files changed

+95
-0
lines changed

10 files changed

+95
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright (c) 2018, salesforce.com, inc.
3+
* All rights reserved.
4+
* SPDX-License-Identifier: MIT
5+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6+
*/
7+
const assert = require('assert');
8+
9+
// The bug: Cannot click into the first child of a shadow root when the active element is
10+
// the previous sibling to the custom element
11+
12+
describe('Delegates focus', () => {
13+
const URL = '/delegate-focus-click-input-in-negative-tabindex-previous-sibling-focused';
14+
15+
before(async () => {
16+
await browser.url(URL);
17+
});
18+
19+
it('should focus the input when clicked', async () => {
20+
await browser.keys(['Tab']); // focus first anchor
21+
await browser.keys(['Tab']); // focus second anchor
22+
const input = await browser.shadowDeep$(
23+
'integration-delegate-focus-click-input-in-negative-tabindex-previous-sibling-focused',
24+
'integration-child',
25+
'input'
26+
);
27+
28+
await input.click();
29+
30+
const active = await browser.activeElementShadowDeep();
31+
assert.strictEqual(await active.getTagName(), 'input');
32+
});
33+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
<input type="text" />
3+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { LightningElement } from 'lwc';
2+
3+
export default class Child extends LightningElement {
4+
static delegatesFocus = true;
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<template>
2+
<a href="#">Anchor 1</a>
3+
<a href="#">Anchor 2</a>
4+
<integration-child tabindex="-1"></integration-child>
5+
<span tabindex="0">Focusable span</span>
6+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { LightningElement } from 'lwc';
2+
3+
export default class DelegatesFocus extends LightningElement {}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*
2+
* Copyright (c) 2018, salesforce.com, inc.
3+
* All rights reserved.
4+
* SPDX-License-Identifier: MIT
5+
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
6+
*/
7+
const assert = require('assert');
8+
describe('Delegates focus', () => {
9+
const URL = '/delegate-focus-click-input-in-negative-tabindex';
10+
11+
before(async () => {
12+
await browser.url(URL);
13+
});
14+
15+
it('should focus the input when clicked', async () => {
16+
await browser.keys(['Tab']); // focus first anchor
17+
const input = await browser.shadowDeep$(
18+
'integration-delegate-focus-click-input-in-negative-tabindex',
19+
'integration-child',
20+
'input'
21+
);
22+
23+
await input.click(); // click into input
24+
25+
const active = await browser.activeElementShadowDeep();
26+
assert.strictEqual(await active.getTagName(), 'input');
27+
});
28+
});
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<template>
2+
<input type="text" />
3+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { LightningElement } from 'lwc';
2+
3+
export default class Child extends LightningElement {
4+
static delegatesFocus = true;
5+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<template>
2+
<a href="#">Anchor 1</a>
3+
<a href="#">Anchor 2</a>
4+
<integration-child tabindex="-1"></integration-child>
5+
<span tabindex="0">Focusable span</span>
6+
</template>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import { LightningElement } from 'lwc';
2+
3+
export default class DelegatesFocus extends LightningElement {}

0 commit comments

Comments
 (0)