{"size": 3269, "ext": "js", "max_stars_repo_path": "unit-tests/services/plotServices/generate/options_test.js", "max_stars_repo_name": "silverbullet-dk/opentele-client-html", "max_stars_repo_stars_event_min_datetime": "2015-05-28T15:33:24.000Z", "max_stars_repo_stars_event_max_datetime": "2015-05-28T15:33:24.000Z", "max_issues_repo_path": "unit-tests/services/plotServices/generate/options_test.js", "max_issues_repo_name": "silverbullet-dk/opentele-client-html", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "unit-tests/services/plotServices/generate/options_test.js", "max_forks_repo_name": "silverbullet-dk/opentele-client-html", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 37.5747126437, "max_line_length": 105, "alphanum_fraction": 0.4322422759}
(function() {
    'use strict';

    describe('opentele.plotServices.generate.options module', function () {

        beforeEach(module('opentele.plotServices.generate.options'));

        describe('options', function () {
            var options, graphDescription, jqplot;

            beforeEach(module(function($provide) {

                var styles = {
                    byType: function(type) {
                        return { from: 'styles' };
                    }
                };
                $provide.value('styles', styles);

                var descriptions = {
                    legend: function(type) {
                        return { from: 'descriptions' };
                    }
                };
                $provide.value('descriptions', descriptions);

            }));

            beforeEach(inject(function (_options_) {
                options = _options_;
            }));

            describe('byType', function() {

                beforeEach(function() {
                    graphDescription = {
                        title: 'MEASUREMENT_TYPE_PULSE',
                        ticksX: [1, 2, 3],
                        ticksY: [40, 80, 120, 160, 200],
                        formatStringX: '[formatStringX]',
                        formatStringY: '[formatStringY]',
                        labelY: 'Beats per minute',
                        boundariesY: {
                            min: 34,
                            max: 220
                        }
                    };

                    jqplot = {
                        DateAxisRenderer: {},
                        CanvasAxisTickRenderer: {},
                        CanvasAxisLabelRenderer: {}
                    };
                });

                it('should generate correct graph options', function() {
                    var resultOptions = options.byType('pulse', graphDescription, jqplot);
                    expect(resultOptions.title).toEqual('Pulse');
                    expect(resultOptions.grid).toEqual({
                        backgroundColor: '#CCCCCC',
                        gridLineColor: '#999999'
                    });
                    expect(resultOptions.series).toEqual({ from: 'styles' });
                    expect(resultOptions.legend).toEqual({ from: 'descriptions' });
                    expect(resultOptions.axes.xaxis.ticks).toEqual([1, 2, 3]);
                    expect(resultOptions.axes.xaxis.tickOptions.formatString).toEqual('[formatStringX]');
                    expect(resultOptions.axes.yaxis.ticks).toEqual([40, 80, 120, 160, 200]);
                    expect(resultOptions.axes.yaxis.label).toEqual('Beats per minute');
                    expect(resultOptions.axes.yaxis.tickOptions.formatString).toEqual('[formatStringY]');
                    expect(resultOptions.highlighter).toEqual({
                        show: true,
                        sizeAdjust: 7.5,
                        tooltipOffset: 5,
                        yvalues: 10,
                        fadeTooltip: true
                    });
                    expect(resultOptions.cursor).toEqual({
                        show: false
                    });
                });

            });

        });
    });
}());
