New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

lc2-driver

Package Overview
Dependencies
Maintainers
3
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lc2-driver - npm Package Compare versions

Comparing version 1.2.4 to 1.2.6

src/device/keyboard/index.js

19

index.js
const mouse = require('./src/device/mouse');
const {keyboard} = require('./src/device/keyboard');
const {page} = require('./src/viewport');

@@ -91,3 +92,8 @@ const {scrollByElement, getElementClientPosition, getElementRect} = require('./src/element');

return this.move({selector}).then(target => {
page.setFocusElement(target);
if (target !== page.focusElement) {
return mouse.clickButton('left').then(() => target);
}
return target;
}).then(target => {
return accessor(target).setValue(value);

@@ -98,2 +104,11 @@ });

return Promise.resolve(signal.uploading);
},
keydown(code) {
return keyboard.down(code);
},
keyup() {
return keyboard.up();
},
keypress(code) {
return keyboard.press(code);
}

@@ -174,2 +189,2 @@ };

window.__LC2__ = module.exports = driver;
module.exports = driver;

9

package.json
{
"name": "lc2-driver",
"version": "1.2.4",
"version": "1.2.6",
"description": "",

@@ -8,3 +8,3 @@ "main": "index.js",

"test": "mocha test/*-spec.js",
"start": "webpack-dev-server --port 8400",
"start": "webpack-dev-server --hot --no-info --port 8400 --host 0.0.0.0",
"build": "webpack --config webpack.prod.js --progress"

@@ -28,5 +28,6 @@ },

"babel-preset-es2015": "^6.24.1",
"babel-plugin-transform-runtime": "^6.23.0",
"mocha": "^3.2.0",
"webpack": "^1.13.3",
"webpack-dev-server": "^1.16.2"
"webpack": "^2.4.1",
"webpack-dev-server": "2.4.2"
},

@@ -33,0 +34,0 @@ "dependencies": {

@@ -1,2 +0,2 @@

const {createUIEvent, createMouseEvent} = require('./event');
const {createUIEvent, createMouseEvent, createKeyboardEvent} = require('./event');

@@ -96,3 +96,2 @@ function isInputElement(element) {

this.element.dispatchEvent(createUIEvent('change'));
this.element.dispatchEvent(createUIEvent('blur'));

@@ -123,3 +122,2 @@ return true;

this.element.dispatchEvent(createUIEvent('change'));
this.element.dispatchEvent(createUIEvent('blur'));

@@ -178,4 +176,2 @@ return true;

this.element.dispatchEvent(createUIEvent('blur'));
return true;

@@ -182,0 +178,0 @@ }

@@ -47,4 +47,4 @@ 'use strict';

const state = {button: 0, buttons: 0o000};
const buttonGroup = module.exports = Object.setPrototypeOf({
get state() {
const buttonGroup = module.exports = Object.assign(new EventEmitter(), {
state() {
return Object.assign({}, state);

@@ -96,2 +96,2 @@ },

}
}, new EventEmitter());
});

@@ -12,8 +12,8 @@ 'use strict';

const mouse = module.exports = Object.setPrototypeOf({
get pointerState() {
const mouse = module.exports = Object.assign(new EventEmitter, {
pointerState() {
return pointer.position();
},
get buttonState() {
return button.state;
buttonState() {
return button.state();
},

@@ -44,2 +44,2 @@ pointTo({clientX, clientY}) {

}
}, new EventEmitter);
});

@@ -32,3 +32,3 @@ 'use strict';

const lastStyle = window.__LC2_HOVER_STYLE__;
lastStyle && lastStyle.remove();
lastStyle && lastStyle.parentNode.removeChild(lastStyle);

@@ -35,0 +35,0 @@ const styleElement =

'use strict';
const mouse = require('./device/mouse');
const {keyboard} = require('./device/keyboard');
const element = require('./element');
const {createMouseEvent} = require('./event');
const {createMouseEvent, createKeyboardEvent, createUIEvent, createFocusEvent} = require('./event');
const {updateHoverSheet} = require('./hover');

@@ -13,2 +14,18 @@ const driver = require('./emitter');

/**
*
* Focus Event Order
* https://www.w3.org/TR/DOM-Level-3-Events/#events-focusevent-event-order
*
* [EventType] [Notes]
* -- User shifts focus
* 1 focusin Sent before first target element receives focus
* 2 focus Sent after first target element receives focus
* -- User shifts focus
* 3 focusout Sent before first target element loses focus
* 4 focusin Sent before second target element receives focus
* 5 blur Sent after first target element loses focus
* 6 focus Sent after second target element receives focus
*
*/
setFocusElement(element) {

@@ -19,11 +36,10 @@ if (element === this.focusElement) {

if (this.focusElement) {
this.focusElement.blur();
}
const oldFocusElement = this.focusElement;
oldFocusElement && oldFocusElement.dispatchEvent(createFocusEvent('focusout'));
this.focusElement = element && canFocused(element) ? element: null;
if (element && canFocused(element)) {
this.focusElement = element;
} else {
this.focusElement = null;
}
this.focusElement && this.focusElement.dispatchEvent(createFocusEvent('focusin'));
oldFocusElement && oldFocusElement.dispatchEvent(createUIEvent('blur'));
this.focusElement && this.focusElement.dispatchEvent(createUIEvent('focus'));
}

@@ -95,3 +111,3 @@ };

dispatchEvent('mousedown');
target.focus();
// target.dispatchEvent(createUIEvent('focus'));
}

@@ -108,2 +124,6 @@ };

keyboard.on('handle', type => {
page.focusElement.dispatchEvent(createKeyboardEvent(type));
});
exports.page = page;
$(document).ready(function () {
setTimeout(runTest, 1000);
});
const {action, query, mouse} = __LC2__;

@@ -229,4 +228,40 @@ const act = action;

}, function ($, _) {
console.log(dblclick)
console.log(dblclick);
return dblclick === true;
});
let keydownCode = 0;
it('keydown', function ($, _) {
$('input').keydown(function (ev) {
keydownCode = ev.keyCode;
});
return act.click({selector: _('input')}).then(() => {
return act.keydown('Enter');
});
}, function ($, _) {
return keydownCode === 13;
});
let keyup = false;
it('keyup', function ($, _) {
$('input').keyup(function () {
keyup = true;
});
return act.click({selector: _('input')}).then(() => {
return act.keyup();
});
}, function ($, _) {
return keyup === true;
});
let keypressCode = 0;
it('keypress', function ($, _) {
document.onkeypress = function(ev) {
keypressCode = ev.keyCode;
};
return act.click({selector: _('input')}).then(() => {
return act.keypress('Enter');
});
}, function ($, _) {
return keypressCode === 13;
});

@@ -10,4 +10,4 @@ const mouse = require('../src/device/mouse');

mouse.clickButton().then(() => {
assert.equal(mouse.buttonState.button, 0);
assert.equal(mouse.buttonState.buttons, 0o000);
assert.equal(mouse.buttonState().button, 0);
assert.equal(mouse.buttonState().buttons, 0o000);
done();

@@ -18,7 +18,7 @@ });

mouse.holdButton().then(() => {
assert.equal(mouse.buttonState.button, 0);
assert.equal(mouse.buttonState.buttons, 0o001);
assert.equal(mouse.buttonState().button, 0);
assert.equal(mouse.buttonState().buttons, 0o001);
return mouse.releaseButton();
}).then(() => {
assert.equal(mouse.buttonState.button, 0o000);
assert.equal(mouse.buttonState().button, 0o000);
done();

@@ -25,0 +25,0 @@ });

@@ -1,9 +0,50 @@

module.exports = {
entry: ['./index.js'],
output: {
filename: 'driver.js',
path: __dirname + '/dist',
library: 'lcd',
libraryTarget: 'umd'
module.exports = [
{
entry: ['./index.js'],
output: {
filename: './driver.es5.js',
path: __dirname + '/dist',
library: '__LC2__',
libraryTarget: 'umd'
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
}
},
{
entry: ['./test/case.js'],
output: {
filename: 'case.es5.js',
},
module: {
loaders: [
{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}
]
}
},
{
entry: ['./test/case.js'],
output: {
filename: 'case.es6.js',
}
},
{
entry: ['./index.js'],
output: {
filename: 'driver.es6.js',
path: __dirname + '/dist',
library: '__LC2__',
libraryTarget: 'umd'
}
}
};
];

@@ -8,4 +8,4 @@ const devConfig = require('./webpack.config.js');

{
test: /\.js$/,
loader: 'babel-loader'
test: /\.js$/,
loader: 'babel-loader'
}

@@ -12,0 +12,0 @@ ]

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc