{"size": 2000, "ext": "js", "max_stars_repo_path": "sencha-workspace/tests/siesta-4.0.6-lite/tests/recorder/target_extractor/010_slider.t.js", "max_stars_repo_name": "nbey/slate-cbl", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "sencha-workspace/tests/siesta-4.0.6-lite/tests/recorder/target_extractor/010_slider.t.js", "max_issues_repo_name": "nbey/slate-cbl", "max_issues_repo_issues_event_min_datetime": "2019-06-25T18:36:34.000Z", "max_issues_repo_issues_event_max_datetime": "2019-06-25T18:36:34.000Z", "max_forks_repo_path": "sencha-workspace/tests/siesta-4.0.6-lite/tests/recorder/target_extractor/010_slider.t.js", "max_forks_repo_name": "nbey/slate-cbl", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 1, "max_forks_count": null, "avg_line_length": 34.4827586207, "max_line_length": 111, "alphanum_fraction": 0.4215}
StartTest(function (t) {

    t.it('Slider test', function (t) {

        new Ext.Panel({
            renderTo    : document.body,
            xtype       : 'panel',
            title       : 'Slider',
            height      : 200,
            width       : 200,
            layout      : 'anchor',

            items : [
                {
                    xtype     : 'slider',
                    anchor    : '100%'
                },
                {
                    xtype    : 'slider',
                    vertical : true,
                    height   : 100
                }
            ]
        });

        // Menus require a bit of special treatment since a submenu doesn't open sync,
        // We may actually need to automatically inject a 'waitForTarget' statement before clicking a menu item
        var recorder = new Siesta.Recorder.ExtJS({ ignoreSynthetic : false });
        recorder.attach(window);
        recorder.start();

        t.chain(
            { drag : 'panel slider => .x-slider-thumb', by: [40, 0], offset : [5, 5] },
            { drag : 'panel slider => .x-slider-thumb', by: [-30, 0], offset : [5, 5] },

            function () {
                var steps = recorder.getRecordedActionsAsSteps();

                recorder.stop();

                t.is(steps.length, 2);
                
                t.is(steps[ 0 ].action, "drag")
                t.is(steps[ 0 ].target, "panel[title=Slider] slider => .x-slider-thumb")
                
                t.isDeeply(steps[ 0 ].by, [ 40, 0 ]);
                t.isApprox(steps[ 0 ].offset[ 0 ], 5, 2);
                t.isApprox(steps[ 0 ].offset[ 1 ], 5, 2);

                t.is(steps[ 1 ].action, "drag")
                t.is(steps[ 1 ].target, "panel[title=Slider] slider => .x-slider-thumb")
                t.isDeeply(steps[ 1 ].by, [ -30, 0 ]);
                t.isApprox(steps[ 1 ].offset[ 0 ], 5, 2);
                t.isApprox(steps[ 1 ].offset[ 1 ], 5, 2);
            }
        );
    })
})