Skip to content

Commit 05351ac

Browse files
committed
small fixes and improvements
1 parent 90e3f31 commit 05351ac

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

Diff for: lib/client.d.ts

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { Config } from './config'
2-
import { ElementAWB } from './element'
3-
import { Keys } from './event/keys'
1+
import {Config} from './config'
2+
import {ElementAWB} from './element'
3+
import {Keys} from './event/keys'
44

55
interface ISessionLocalStorage {
66
get: (key: string) => Promise<string>
@@ -39,15 +39,15 @@ export declare class Client {
3939
mouseLeave: 'mouseLeave',
4040
mouseOut: 'mouseOut'
4141
}
42-
alert: Alert
42+
alert: IAlert
4343
Keys: Keys
4444
pressKeys(keys: Keys | [Keys])
45-
getSize(): Promise<{ height: number, width: number }>
45+
getSize(): Promise<{height: number, width: number}>
4646
dispatchEvent(element: ElementAWB, eventType: string): Promise<void>
4747
refresh(): Promise<any>
4848
back(): Promise<any>
4949
forward(): Promise<any>
50-
getRect(): Promise<{ height: number, width: number, x: number, y: number }>
50+
getRect(): Promise<{height: number, width: number, x: number, y: number}>
5151
pageSource(): Promise<string>
5252
maximizeWindow(): Promise<void>
5353
// minimizeWindow(): Promise<void>

Diff for: lib/client.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -202,9 +202,7 @@ function initializatorClient(requests, opts) {
202202
}
203203

204204
async goToInNewTab(url) {
205-
return callWithWrap.call(this, executeScript, function(link) {
206-
window.open(link, '_blank')
207-
}, url)
205+
return callWithWrap.call(this, executeScript, `window.open(arguments[0], '_blank')`, url)
208206
}
209207

210208
async switchToTab(indexOrTabId) {

Diff for: lib/element.js

+5-9
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const proxyActions = [
3030

3131
function elementsInitializer(requests, client) {
3232
const {getElementText, moveTo, buttonDown, elementFromElement, elementsFromElement, buttonUp, enabled, displayed, location, locationInView, click} = requests
33-
const {clickElement, sendKeys, getAttribute, executeScript, waitCondition, findElements, findElement, clearElementText, tagName, size, doubleClick} = requests
33+
const {clickElement, sendKeys, getAttribute, executeScript, findElements, findElement, clearElementText, tagName, size, doubleClick} = requests
3434
const {touchClick, touchDown, touchDoubleclick, touchLongclick, touchFlick, touchMove, touchPerform, touchMultiperform, touchScroll, touchUp} = requests
3535

3636
class ElementAWB {
@@ -45,24 +45,20 @@ function elementsInitializer(requests, client) {
4545
}
4646

4747
element(...args) {
48-
const self = this
49-
return initElement(self, ElementAWB)(...args)
48+
return initElement(this, ElementAWB)(...args)
5049
}
5150

5251
elements(...args) {
53-
const self = this
54-
return initElement(self, ElementsAWB)(...args)
52+
return initElement(this, ElementsAWB)(...args)
5553
}
5654

5755

5856
$(...args) {
59-
const self = this
60-
return initElement(self, ElementAWB)(...args)
57+
return initElement(this, ElementAWB)(...args)
6158
}
6259

6360
$$(...args) {
64-
const self = this
65-
return initElement(self, ElementsAWB)(...args)
61+
return initElement(this, ElementsAWB)(...args)
6662
}
6763

6864
waitForElement(...args) {

Diff for: lib/events.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,14 @@ const mouseOver = getEvent('mouseover')
2424
const mouseLeave = getEvent('mouseleave')
2525
const mouseEnter = getEvent('mouseenter')
2626
const mouseOut = getEvent('mouseout')
27+
const doubleClick = getEvent('dblclick')
2728

2829
const eventsScripts = {
2930
mouseEnter,
3031
mouseLeave,
3132
mouseOver,
32-
mouseOut
33+
mouseOut,
34+
doubleClick
3335
}
3436

3537
const eventsList = {

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "awb",
3-
"version": "0.7.6",
3+
"version": "0.7.7",
44
"description": "simple light weight interface for selenium webdriver (node js)",
55
"main": "./awb.js",
66
"bin": {

0 commit comments

Comments
 (0)