-
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 key-reorder test suite to wdio
- Loading branch information
1 parent
ab97fdf
commit 346aa51
Showing
6 changed files
with
49 additions
and
96 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
This file was deleted.
Oops, something went wrong.
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,47 @@ | ||
import { h, Fragment } from '@stencil/core'; | ||
import { render } from '@wdio/browser-runner/stencil'; | ||
|
||
describe('key-reorder', function () { | ||
beforeEach(() => { | ||
render({ | ||
template: () => <key-reorder></key-reorder>, | ||
}); | ||
}); | ||
|
||
it('uses same nodes after reorder', async () => { | ||
const root = $('key-reorder'); | ||
await root.waitForExist(); | ||
let item0 = document.body.querySelector('#item-0') as any; | ||
let item1 = document.body.querySelector('#item-1') as any; | ||
let item2 = document.body.querySelector('#item-2') as any; | ||
let item3 = document.body.querySelector('#item-3') as any; | ||
let item4 = document.body.querySelector('#item-4') as any; | ||
|
||
expect(item0.previousElementSibling).toBe(null); | ||
expect(item1.previousElementSibling).toBe(item0); | ||
expect(item2.previousElementSibling).toBe(item1); | ||
expect(item3.previousElementSibling).toBe(item2); | ||
expect(item4.previousElementSibling).toBe(item3); | ||
|
||
item0.__orgItem = 0; | ||
item1.__orgItem = 1; | ||
item2.__orgItem = 2; | ||
item3.__orgItem = 3; | ||
item4.__orgItem = 4; | ||
|
||
const button = root.$('button'); | ||
await button.click(); | ||
|
||
item0 = document.body.querySelector('#item-0') as any; | ||
item1 = document.body.querySelector('#item-1') as any; | ||
item2 = document.body.querySelector('#item-2') as any; | ||
item3 = document.body.querySelector('#item-3') as any; | ||
item4 = document.body.querySelector('#item-4') as any; | ||
|
||
expect(item0.previousElementSibling).toBe(item1); | ||
expect(item1.previousElementSibling).toBe(item2); | ||
expect(item2.previousElementSibling).toBe(item3); | ||
expect(item3.previousElementSibling).toBe(item4); | ||
expect(item4.previousElementSibling).toBe(null); | ||
}); | ||
}); |
4 changes: 2 additions & 2 deletions
4
test/karma/test-app/key-reorder/cmp-root.tsx → test/wdio/key-reorder/cmp.tsx
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