-
Notifications
You must be signed in to change notification settings - Fork 402
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(engine): handling empty shadow roots
- Loading branch information
David Turissini
committed
Nov 7, 2018
1 parent
599bfce
commit e70185c
Showing
11 changed files
with
93 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
...r-elements/delegates-focus-tab-index-zero-no-focusable-elements-no-after-elements.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const assert = require('assert'); | ||
describe('Delegate focus with tabindex 0, no tabbable elements, and no tabbable elements after', () => { | ||
const URL = 'http://localhost:4567/delegates-focus-tab-index-zero-no-focusable-elements-no-after-elements'; | ||
let element; | ||
|
||
before(() => { | ||
browser.url(URL); | ||
}); | ||
|
||
it('should correctly have no activeelement', function () { | ||
browser.keys(['Tab']); | ||
browser.keys(['Tab']); | ||
let active = browser.execute(function () { | ||
return document.activeElement; | ||
}); | ||
|
||
assert.deepEqual(active.getTagName().toLowerCase(), 'body'); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
...focus-tab-index-zero-no-focusable-elements-no-after-elements/integration/child/child.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
No focusable elements | ||
</template> |
5 changes: 5 additions & 0 deletions
5
...s-focus-tab-index-zero-no-focusable-elements-no-after-elements/integration/child/child.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class Child extends LightningElement { | ||
static delegatesFocus = true; | ||
} |
4 changes: 4 additions & 0 deletions
4
...fter-elements/delegates-focus-tab-index-zero-no-focusable-elements-no-after-elements.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<template> | ||
<button>first button</button> | ||
<integration-child tabindex="0"></integration-child> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
...-after-elements/delegates-focus-tab-index-zero-no-focusable-elements-no-after-elements.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class Parent extends LightningElement { | ||
|
||
} |
27 changes: 27 additions & 0 deletions
27
...x-zero-no-focusable-elements/delegates-focus-tab-index-zero-no-focusable-elements.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const assert = require('assert'); | ||
describe('Delegate focus with tabindex 0 and no tabbable elements', () => { | ||
const URL = 'http://localhost:4567/delegates-focus-tab-index-zero-no-focusable-elements'; | ||
let element; | ||
|
||
before(() => { | ||
browser.url(URL); | ||
}); | ||
|
||
it('should correctly skip the custom element', function () { | ||
browser.keys(['Tab']); | ||
browser.keys(['Tab']); | ||
let active = browser.execute(function () { | ||
return document.activeElement.shadowRoot.activeElement; | ||
}); | ||
|
||
assert.deepEqual(active.getText(), 'second button') | ||
|
||
browser.keys(['Shift', 'Tab']); | ||
|
||
active = browser.execute(function () { | ||
return document.activeElement.shadowRoot.activeElement; | ||
}); | ||
|
||
assert.deepEqual(active.getText(), 'first button'); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
...ty/test-delegates-focus-tab-index-zero-no-focusable-elements/integration/child/child.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
<template> | ||
No focusable elements | ||
</template> |
5 changes: 5 additions & 0 deletions
5
...lity/test-delegates-focus-tab-index-zero-no-focusable-elements/integration/child/child.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class Child extends LightningElement { | ||
static delegatesFocus = true; | ||
} |
5 changes: 5 additions & 0 deletions
5
...ndex-zero-no-focusable-elements/delegates-focus-tab-index-zero-no-focusable-elements.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<template> | ||
<button>first button</button> | ||
<integration-child tabindex="0"></integration-child> | ||
<button>second button</button> | ||
</template> |
5 changes: 5 additions & 0 deletions
5
...-index-zero-no-focusable-elements/delegates-focus-tab-index-zero-no-focusable-elements.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { LightningElement } from 'lwc'; | ||
|
||
export default class Parent extends LightningElement { | ||
|
||
} |