-
Notifications
You must be signed in to change notification settings - Fork 795
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(wdio): port delegates-foucs test suite to wdio
port the `test/karma/test-app/delegates-focus` test suite to webdriverio. git history has been preserved as much as possible here, using `git mv` to move files from the `karma` dir to `wdio/` in all possible cases. however, git may fail to mark some files as 'moved' if we change a file enough that it exceeds git's "sameness threshold".
- Loading branch information
1 parent
722a11c
commit fae0532
Showing
6 changed files
with
48 additions
and
59 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,48 @@ | ||
import { Fragment, h } from '@stencil/core'; | ||
import { render } from '@wdio/browser-runner/stencil'; | ||
|
||
describe('delegates-focus', function () { | ||
beforeEach(() => { | ||
render({ | ||
template: () => ( | ||
<> | ||
<button onClick={setFocus}>Set Focus</button> | ||
<hr /> | ||
<div>Delegate Focus Enabled:</div> | ||
<delegates-focus class="set-focus"></delegates-focus> | ||
<hr /> | ||
<div>Delegate Focus Not Enabled:</div> | ||
<no-delegates-focus class="set-focus"></no-delegates-focus> | ||
</> | ||
), | ||
}); | ||
function setFocus() { | ||
const elms = document.querySelectorAll('.set-focus'); | ||
for (let i = 0; i < elms.length; i++) { | ||
(elms[i] as HTMLElement).focus(); | ||
} | ||
} | ||
}); | ||
|
||
it('should delegate focus', async () => { | ||
await $('delegates-focus').waitForExist(); | ||
await $('no-delegates-focus').waitForExist(); | ||
|
||
const delegatesFocus = document.querySelector('delegates-focus'); | ||
const noDelegatesFocus = document.querySelector('no-delegates-focus'); | ||
|
||
const delegateFocusStyles1 = window.getComputedStyle(delegatesFocus); | ||
expect(delegateFocusStyles1.borderColor).toBe('rgb(255, 0, 0)'); | ||
|
||
const noDelegateFocusStyles1 = window.getComputedStyle(noDelegatesFocus); | ||
expect(noDelegateFocusStyles1.borderColor).toBe('rgb(255, 0, 0)'); | ||
|
||
await $('button').click(); | ||
|
||
const delegateFocusStyles2 = window.getComputedStyle(delegatesFocus); | ||
expect(delegateFocusStyles2.borderColor).toBe('rgb(0, 0, 255)'); | ||
|
||
const noDelegateFocusStyles2 = window.getComputedStyle(noDelegatesFocus); | ||
expect(noDelegateFocusStyles2.borderColor).toBe('rgb(255, 0, 0)'); | ||
}); | ||
}); |
File renamed without changes.
File renamed without changes.
File renamed without changes.