{"size": 1863, "ext": "js", "max_stars_repo_path": "node_modules/webdriverjs/test/spec/desktop/clientSideEvents.js", "max_stars_repo_name": "imaarthi/blockchain-explorer", "max_stars_repo_stars_event_min_datetime": "2016-05-25T20:01:08.000Z", "max_stars_repo_stars_event_max_datetime": "2016-05-25T20:01:08.000Z", "max_issues_repo_path": "node_modules/webdriverjs/test/spec/desktop/clientSideEvents.js", "max_issues_repo_name": "imaarthi/blockchain-explorer", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "node_modules/webdriverjs/test/spec/desktop/clientSideEvents.js", "max_forks_repo_name": "imaarthi/blockchain-explorer", "max_forks_repo_forks_event_min_datetime": "2022-01-09T18:02:14.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-09T18:02:14.000Z"}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 33.2678571429, "max_line_length": 88, "alphanum_fraction": 0.5485775631}
/**
 * currently client side events are only supported in chrome
 * dont execute this test for now
 */
describe.skip('test client side events', function() {
    before(h.setup);

    var keyCharacter = 't',
        keyType = 'keyup',
        keyPressTestDone = false,
        keypressListenerTest = function(e) {
            
            // test event values
            assert.strictEqual(e.keyIdentifier, 'U+0054'); // U+0054 === 't'
            assert.strictEqual(e.type, keyType);

            this.client
                .getValue('/' + e.target, function(err,res) {
                    assert.strictEqual(res,keyCharacter)
                })
                // set flag to test if event was fired in L44
                .call(function() {
                    keyPressTestDone = true;
                });
        };

    it('should be register/remove keypress event listener', function(done){

        this.client
            
            // register event browser listener
            .addEventListener(keyType,'.searchinput',keypressListenerTest.bind(this))
            
            // focus input
            .click('.searchinput')

            // type key character - listener should be invoked
            .keys(keyCharacter)

            .call(function() {
                // check if keypressListenerTest was executed and event was catched
                // should be because event callback should be fired
                assert.ok(keyPressTestDone);
            })

            // remove listener
            .removeEventListener(keyType,'.searchinput',keypressListenerTest.bind(this))
            
            // type another character and check if listener gets executed again
            // no listener should get executed otherwise L14 would cause AssertionError
            .addValue('.searchinput','o') 

            .call(done);
    });

});