<commit_before>/** @jsx React.DOM */
/** @jsx React.DOM */
'use strict';
var React = require('react');
var _ = require('underscore');
var globals = require('./globals');
var dbxref = require('./dbxref');
var dataset = require('./dataset');
var statuslabel = require('./statuslabel');

var DbxrefList = dbxref.DbxrefList;
var FileTable = dataset.FileTable;
var StatusLabel = statuslabel.StatusLabel;

var Panel = function (props) {
    // XXX not all panels have the same markup
    var context;
    if (props['@id']) {
        context = props;
        props = {context: context};
    }
    return globals.panel_views.lookup(props.context)(props);
};

var Experiment = module.exports.Experiment = React.createClass({
    render: function() {
        var context = this.props.context;
        var itemClass = globals.itemClass(context, 'view-item');
        var replicates = _.sortBy(context.replicates, function(item) {
            return item.biological_replicate_number;
        });
        var aliasList = context.aliases.join(", ");

        var documents = {};
        replicates.forEach(function (replicate) {
            if (!replicate.library) return;
            replicate.library.documents.forEach(function (doc) {
                documents[doc['@id']] = Panel({context: doc});
            });
        });

        // Process biosamples for summary display
        var biosamples = [], lifeAge = [], organismName = [];
        replicates.forEach(function (replicate) {
            var biosample = replicate.library && replicate.library.biosample;
            if (biosample) {
                biosamples.push(biosample);

                // Add to array of scientific names for rare experiments with cross-species biosamples
                organismName.push(biosample.organism.scientific_name);

                // Build a string with non-'unknown' life_stage, age, and age_units concatenated
                var lifeAgeString = (biosample.life_stage && biosample.life_stage != 'unknown') ? biosample.life_stage : '';
                if (biosample.age && biosample.age != 'unknown') {
                    lifeAgeString += (lifeAgeString ? ' ' : '') + biosample.age;
                    lifeAgeString += (biosample.age_units && biosample.age_units != 'unknown') ? ' ' + biosample.age_units : '';
                }
                if (lifeAgeString) {
                    lifeAge.push(lifeAgeString);
                }
            }
        });

        // Eliminate duplicates in lifeAge and organismName arrays so each displayed only once
        if (lifeAge.length) {
            lifeAge = _.uniq(lifeAge);
        }
        if (organismName.length) {
            organismName = _.uniq(organismName);
        }

        // Build the text of the Treatment string array and the synchronization string array
        var treatmentText = [];
        var synchText = [];
        biosamples.map(function(biosample) {
            // Collect treatments
            treatmentText = treatmentText.concat(biosample.treatments.map(function(treatment) {
                var singleTreatment = '';
                if (treatment.concentration) {
                    singleTreatment += treatment.concentration + (treatment.concentration_units ? ' ' + treatment.concentration_units : '') + ' ';
                }
                singleTreatment += treatment.treatment_term_name + (treatment.treatment_term_id ? ' (' + treatment.treatment_term_id + ')' : '') + ' ';
                if (treatment.duration) {
                    singleTreatment += 'for ' + treatment.duration + ' ' + (treatment.duration_units ? treatment.duration_units : '');
                }
                return singleTreatment;
            }));

            // Collect synchronizations
            if (biosample.synchronization) {
                synchText.push(biosample.synchronization +
                    (biosample.post_synchronization_time ?
                        ' + ' + biosample.post_synchronization_time + (biosample.post_synchronization_time_units ? ' ' + biosample.post_synchronization_time_units : '')
                    : ''));
            }
        });
        if (treatmentText) {
            treatmentText = _.uniq(treatmentText);
        }
        if (synchText) {
            synchText = _.uniq(synchText);
        }

        // Adding experiment specific documents
        context.documents.forEach(function (document) {
            documents[document['@id']] = Panel({context: document});
        });
        var antibodies = {};
        replicates.forEach(function (replicate) {
            if (replicate.antibody) {
                antibodies[replicate.antibody['@id']] = replicate.antibody;
            }
        });

        // Determine this experiment's ENCODE version
        var encodevers = "";
        if (context.award.rfa) {
            encodevers = globals.encodeVersionMap[context.award.rfa.substring(0,7)];
            if (typeof encodevers === "undefined") {
                encodevers = "";
            }
        }

        // Make list of statuses
        var statuses = [{status: context.status, title: "Status"}];
        if (encodevers === "3" && context.status === "released") {
            statuses.push({status: "pending", title: "Validation"});
        }

        // Make string of alternate accessions
        var altacc = context.alternate_accessions ? context.alternate_accessions.join(', ') : undefined;

        // XXX This makes no sense.
        //var control = context.possible_controls[0];
        return (

Experiment

{context.assay_term_name}

                            Experiment summary for {context.accession}

                        {altacc ?
Replaces {altacc}
 : null}

                            <StatusLabel status={statuses} />

Assay

{context.assay_term_name}

Accession

{context.accession}

                        {biosamples.length || context.biosample_term_name ?

Biosample summary

                                    {context.biosample_term_name ? {context.biosample_term_name + ' '} : null}
                                    {organismName.length || lifeAge.length ? '(' : null}
                                    {organismName.length ?

                                            {organismName.map(function(name, i) {
                                                if (i === 0) {
                                                    return ({name});
                                                } else {
                                                    return ({' and '}{name});
                                                }
                                            })}

                                    : null}
                                    {lifeAge.length ? ', ' + lifeAge.join(' and ') : ''}
                                    {organismName.length || lifeAge.length ? ')' : null}

                        : null}

                        {synchText ?

Synchronization timepoint

                                    {synchText.join(', ')}

                        : null}

                        {context.biosample_type ?

Type

{context.biosample_type}

                        : null}

                        {treatmentText.length ?

Treatment

                                        {treatmentText.map(function (treatment) {
                                            return (
{treatment}
);
                                        })}

                        : null}

                        {context.target ?

Target

{context.target.label}

                        : null}

                        {Object.keys(antibodies).length ?

Antibody

{Object.keys(antibodies).map(function(antibody, i) {
                                    return ({i !== 0 ? ', ' : ''}{antibodies[antibody].accession});
                                })}

                        : null}

                        {context.possible_controls.length ?

Controls

                                        {context.possible_controls.map(function (control) {
                                            return (

                                                        {control.accession}

                                            );
                                        })}

                        : null}

                        {context.description ?

Description

{context.description}

                        : null}

Lab

{context.lab.title}

Project

{context.award.project}

                        {context.dbxrefs.length ?

External resources

<DbxrefList values={context.dbxrefs} />

                        : null}

                        {context.aliases.length ?

Aliases

{aliasList}

                        : null}

                        {context.references.length ?

References

<DbxrefList values={context.references} className="horizontal-list"/>

                        : null}

                        {context.date_released ?

Date released

{context.date_released}

                        : null}

                <AssayDetails replicates={replicates} />

                {Object.keys(documents).length ?

Protocols

                        {documents}

                : null}

                {replicates.map(function (replicate, index) {
                    return (
                        <Replicate replicate={replicate} key={index} />
                    );
                })}

                {context.visualize_ucsc  && context.status == "released" ?

                        Visualize Data

                : null }

                {context.files.length ?

Files linked to {context.accession}

                        <FileTable items={context.files} encodevers={encodevers} />

                : null }

        );
    }
});

globals.content_views.register(Experiment, 'experiment');

var AssayDetails = module.exports.AssayDetails = function (props) {
    var replicates = props.replicates.sort(function(a, b) {
        if (b.biological_replicate_number === a.biological_replicate_number) {
            return a.technical_replicate_number - b.technical_replicate_number;
        }
        return a.biological_replicate_number - b.biological_replicate_number;
    });

    if (!replicates.length) return (

);

    var replicate = replicates[0];
    var library = replicate.library;
    var platform = replicate.platform;
    var depletedIn;
    var treatments;

    if (library && library.depleted_in_term_name && library.depleted_in_term_name.length) {
        depletedIn = library.depleted_in_term_name.join(", ");
    }

    if (library && library.treatments && library.treatments.length) {
        var i = library.treatments.length;
        var t;
        var treatmentList = [];
        while (i--) {
            t = library.treatments[i];
            treatmentList.push(t.treatment_term_name);
        }
        treatments = treatmentList.join(", ");
    }

    if (!library && !depletedIn && !treatments && !platform) {
        return (

);
    }

    return (

Assay details

                {library && library.nucleic_acid_term_name ?
Nucleic acid type
 : null}
				{library && library.nucleic_acid_term_name ?
{library.nucleic_acid_term_name}
 : null}

                {depletedIn ?
Depleted in
 : null}
				{depletedIn ?
{depletedIn}
 : null}

                {library && library.lysis_method ?
Lysis method
 : null}
				{library && library.lysis_method ?
{library.lysis_method}
 : null}

                {library && library.extraction_method ?
Extraction method
 : null}
				{library && library.extraction_method ?
{library.extraction_method}
 : null}

                {library && library.fragmentation_method ?
Fragmentation method
 : null}
				{library && library.fragmentation_method ?
{library.fragmentation_method}
 : null}

                {library && library.size_range ?
Size range
 : null}
				{library && library.size_range ?
{library.size_range}
 : null}

                {library && library.library_size_selection_method ?
Size selection method
 : null}
				{library && library.library_size_selection_method ?
{library.library_size_selection_method}
 : null}

                {treatments ?
Treatments
 : null}
				{treatments ?
{treatments}
 : null}

                {platform ?
Platform
 : null}
				{platform ?
{platform.title}
 : null}

    );
};

var Replicate = module.exports.Replicate = function (props) {
    var replicate = props.replicate;
    var concentration = replicate.rbns_protein_concentration;
    var library = replicate.library;
    var biosample = library && library.biosample;
    var paired_end = replicate.paired_ended;
    return (

Biological replicate - {replicate.biological_replicate_number}

Technical replicate

{replicate.technical_replicate_number}

                {concentration ?
Protein concentration
 : null}
                {concentration ?
{concentration}{replicate.rbns_protein_concentration_units}
 : null}

                {library ?
Library
 : null}
                {library ?
{library.accession}
 : null}

                {library && library.nucleic_acid_starting_quantity ?
Library starting quantity
 : null}
                {library && library.nucleic_acid_starting_quantity ?

{library.nucleic_acid_starting_quantity}{library.nucleic_acid_starting_quantity_units}

                : null}

                {biosample ?
Biosample
 : null}
                {biosample ?

                        {biosample.accession}
                    {' '}-{' '}{biosample.biosample_term_name}

 : null}

                {replicate.read_length ?
Run type
 : null}
                {replicate.read_length ?
{paired_end ? 'paired-end' : 'single-end'}
 : null}

                {replicate.read_length ?
Read length
 : null}
                {replicate.read_length ?
{replicate.read_length}{replicate.read_length_units}
 : null}

    );
};

// Can't be a proper panel as the control must be passed in.
//globals.panel_views.register(Replicate, 'replicate');
<commit_msg>Fix typo in synchronization display<commit_after>/** @jsx React.DOM */
/** @jsx React.DOM */
'use strict';
var React = require('react');
var _ = require('underscore');
var globals = require('./globals');
var dbxref = require('./dbxref');
var dataset = require('./dataset');
var statuslabel = require('./statuslabel');

var DbxrefList = dbxref.DbxrefList;
var FileTable = dataset.FileTable;
var StatusLabel = statuslabel.StatusLabel;

var Panel = function (props) {
    // XXX not all panels have the same markup
    var context;
    if (props['@id']) {
        context = props;
        props = {context: context};
    }
    return globals.panel_views.lookup(props.context)(props);
};

var Experiment = module.exports.Experiment = React.createClass({
    render: function() {
        var context = this.props.context;
        var itemClass = globals.itemClass(context, 'view-item');
        var replicates = _.sortBy(context.replicates, function(item) {
            return item.biological_replicate_number;
        });
        var aliasList = context.aliases.join(", ");

        var documents = {};
        replicates.forEach(function (replicate) {
            if (!replicate.library) return;
            replicate.library.documents.forEach(function (doc) {
                documents[doc['@id']] = Panel({context: doc});
            });
        });

        // Process biosamples for summary display
        var biosamples = [], lifeAge = [], organismName = [];
        replicates.forEach(function (replicate) {
            var biosample = replicate.library && replicate.library.biosample;
            if (biosample) {
                biosamples.push(biosample);

                // Add to array of scientific names for rare experiments with cross-species biosamples
                organismName.push(biosample.organism.scientific_name);

                // Build a string with non-'unknown' life_stage, age, and age_units concatenated
                var lifeAgeString = (biosample.life_stage && biosample.life_stage != 'unknown') ? biosample.life_stage : '';
                if (biosample.age && biosample.age != 'unknown') {
                    lifeAgeString += (lifeAgeString ? ' ' : '') + biosample.age;
                    lifeAgeString += (biosample.age_units && biosample.age_units != 'unknown') ? ' ' + biosample.age_units : '';
                }
                if (lifeAgeString) {
                    lifeAge.push(lifeAgeString);
                }
            }
        });

        // Eliminate duplicates in lifeAge and organismName arrays so each displayed only once
        if (lifeAge.length) {
            lifeAge = _.uniq(lifeAge);
        }
        if (organismName.length) {
            organismName = _.uniq(organismName);
        }

        // Build the text of the Treatment string array and the synchronization string array
        var treatmentText = [];
        var synchText = [];
        biosamples.map(function(biosample) {
            // Collect treatments
            treatmentText = treatmentText.concat(biosample.treatments.map(function(treatment) {
                var singleTreatment = '';
                if (treatment.concentration) {
                    singleTreatment += treatment.concentration + (treatment.concentration_units ? ' ' + treatment.concentration_units : '') + ' ';
                }
                singleTreatment += treatment.treatment_term_name + (treatment.treatment_term_id ? ' (' + treatment.treatment_term_id + ')' : '') + ' ';
                if (treatment.duration) {
                    singleTreatment += 'for ' + treatment.duration + ' ' + (treatment.duration_units ? treatment.duration_units : '');
                }
                return singleTreatment;
            }));

            // Collect synchronizations
            if (biosample.synchronization) {
                synchText.push(biosample.synchronization +
                    (biosample.post_synchronization_time ?
                        ' + ' + biosample.post_synchronization_time + (biosample.post_synchronization_time_units ? ' ' + biosample.post_synchronization_time_units : '')
                    : ''));
            }
        });
        if (treatmentText) {
            treatmentText = _.uniq(treatmentText);
        }
        if (synchText) {
            synchText = _.uniq(synchText);
        }

        // Adding experiment specific documents
        context.documents.forEach(function (document) {
            documents[document['@id']] = Panel({context: document});
        });
        var antibodies = {};
        replicates.forEach(function (replicate) {
            if (replicate.antibody) {
                antibodies[replicate.antibody['@id']] = replicate.antibody;
            }
        });

        // Determine this experiment's ENCODE version
        var encodevers = "";
        if (context.award.rfa) {
            encodevers = globals.encodeVersionMap[context.award.rfa.substring(0,7)];
            if (typeof encodevers === "undefined") {
                encodevers = "";
            }
        }

        // Make list of statuses
        var statuses = [{status: context.status, title: "Status"}];
        if (encodevers === "3" && context.status === "released") {
            statuses.push({status: "pending", title: "Validation"});
        }

        // Make string of alternate accessions
        var altacc = context.alternate_accessions ? context.alternate_accessions.join(', ') : undefined;

        // XXX This makes no sense.
        //var control = context.possible_controls[0];
        return (

Experiment

{context.assay_term_name}

                            Experiment summary for {context.accession}

                        {altacc ?
Replaces {altacc}
 : null}

                            <StatusLabel status={statuses} />

Assay

{context.assay_term_name}

Accession

{context.accession}

                        {biosamples.length || context.biosample_term_name ?

Biosample summary

                                    {context.biosample_term_name ? {context.biosample_term_name + ' '} : null}
                                    {organismName.length || lifeAge.length ? '(' : null}
                                    {organismName.length ?

                                            {organismName.map(function(name, i) {
                                                if (i === 0) {
                                                    return ({name});
                                                } else {
                                                    return ({' and '}{name});
                                                }
                                            })}

                                    : null}
                                    {lifeAge.length ? ', ' + lifeAge.join(' and ') : ''}
                                    {organismName.length || lifeAge.length ? ')' : null}

                        : null}

                        {synchText.length ?

Synchronization timepoint

                                    {synchText.join(', ')}

                        : null}

                        {context.biosample_type ?

Type

{context.biosample_type}

                        : null}

                        {treatmentText.length ?

Treatment

                                        {treatmentText.map(function (treatment) {
                                            return (
{treatment}
);
                                        })}

                        : null}

                        {context.target ?

Target

{context.target.label}

                        : null}

                        {Object.keys(antibodies).length ?

Antibody

{Object.keys(antibodies).map(function(antibody, i) {
                                    return ({i !== 0 ? ', ' : ''}{antibodies[antibody].accession});
                                })}

                        : null}

                        {context.possible_controls.length ?

Controls

                                        {context.possible_controls.map(function (control) {
                                            return (

                                                        {control.accession}

                                            );
                                        })}

                        : null}

                        {context.description ?

Description

{context.description}

                        : null}

Lab

{context.lab.title}

Project

{context.award.project}

                        {context.dbxrefs.length ?

External resources

<DbxrefList values={context.dbxrefs} />

                        : null}

                        {context.aliases.length ?

Aliases

{aliasList}

                        : null}

                        {context.references.length ?

References

<DbxrefList values={context.references} className="horizontal-list"/>

                        : null}

                        {context.date_released ?

Date released

{context.date_released}

                        : null}

                <AssayDetails replicates={replicates} />

                {Object.keys(documents).length ?

Protocols

                        {documents}

                : null}

                {replicates.map(function (replicate, index) {
                    return (
                        <Replicate replicate={replicate} key={index} />
                    );
                })}

                {context.visualize_ucsc  && context.status == "released" ?

                        Visualize Data

                : null }

                {context.files.length ?

Files linked to {context.accession}

                        <FileTable items={context.files} encodevers={encodevers} />

                : null }

        );
    }
});

globals.content_views.register(Experiment, 'experiment');

var AssayDetails = module.exports.AssayDetails = function (props) {
    var replicates = props.replicates.sort(function(a, b) {
        if (b.biological_replicate_number === a.biological_replicate_number) {
            return a.technical_replicate_number - b.technical_replicate_number;
        }
        return a.biological_replicate_number - b.biological_replicate_number;
    });

    if (!replicates.length) return (

);

    var replicate = replicates[0];
    var library = replicate.library;
    var platform = replicate.platform;
    var depletedIn;
    var treatments;

    if (library && library.depleted_in_term_name && library.depleted_in_term_name.length) {
        depletedIn = library.depleted_in_term_name.join(", ");
    }

    if (library && library.treatments && library.treatments.length) {
        var i = library.treatments.length;
        var t;
        var treatmentList = [];
        while (i--) {
            t = library.treatments[i];
            treatmentList.push(t.treatment_term_name);
        }
        treatments = treatmentList.join(", ");
    }

    if (!library && !depletedIn && !treatments && !platform) {
        return (

);
    }

    return (

Assay details

                {library && library.nucleic_acid_term_name ?
Nucleic acid type
 : null}
				{library && library.nucleic_acid_term_name ?
{library.nucleic_acid_term_name}
 : null}

                {depletedIn ?
Depleted in
 : null}
				{depletedIn ?
{depletedIn}
 : null}

                {library && library.lysis_method ?
Lysis method
 : null}
				{library && library.lysis_method ?
{library.lysis_method}
 : null}

                {library && library.extraction_method ?
Extraction method
 : null}
				{library && library.extraction_method ?
{library.extraction_method}
 : null}

                {library && library.fragmentation_method ?
Fragmentation method
 : null}
				{library && library.fragmentation_method ?
{library.fragmentation_method}
 : null}

                {library && library.size_range ?
Size range
 : null}
				{library && library.size_range ?
{library.size_range}
 : null}

                {library && library.library_size_selection_method ?
Size selection method
 : null}
				{library && library.library_size_selection_method ?
{library.library_size_selection_method}
 : null}

                {treatments ?
Treatments
 : null}
				{treatments ?
{treatments}
 : null}

                {platform ?
Platform
 : null}
				{platform ?
{platform.title}
 : null}

    );
};

var Replicate = module.exports.Replicate = function (props) {
    var replicate = props.replicate;
    var concentration = replicate.rbns_protein_concentration;
    var library = replicate.library;
    var biosample = library && library.biosample;
    var paired_end = replicate.paired_ended;
    return (

Biological replicate - {replicate.biological_replicate_number}

Technical replicate

{replicate.technical_replicate_number}

                {concentration ?
Protein concentration
 : null}
                {concentration ?
{concentration}{replicate.rbns_protein_concentration_units}
 : null}

                {library ?
Library
 : null}
                {library ?
{library.accession}
 : null}

                {library && library.nucleic_acid_starting_quantity ?
Library starting quantity
 : null}
                {library && library.nucleic_acid_starting_quantity ?

{library.nucleic_acid_starting_quantity}{library.nucleic_acid_starting_quantity_units}

                : null}

                {biosample ?
Biosample
 : null}
                {biosample ?

                        {biosample.accession}
                    {' '}-{' '}{biosample.biosample_term_name}

 : null}

                {replicate.read_length ?
Run type
 : null}
                {replicate.read_length ?
{paired_end ? 'paired-end' : 'single-end'}
 : null}

                {replicate.read_length ?
Read length
 : null}
                {replicate.read_length ?
{replicate.read_length}{replicate.read_length_units}
 : null}

    );
};

// Can't be a proper panel as the control must be passed in.
//globals.panel_views.register(Replicate, 'replicate');
<|endoftext|>


<commit_before>/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, describe, it, expect, beforeEach, afterEach, waits, waitsFor, runs, $, waitsForDone, spyOn */

// see main.js for path mapping config
define(['jquery', 'text!spec/test-files/markup.html', 'PolygonEditor'],
function($, markup, PolygonEditor){

    function _getPolygonFromBox(element){
        var box = element.getBoundingClientRect();
        return expectedValue = [
            'polygon(',
            [
                'nonzero',
                '0px 0px',
                box.width + 'px' + ' ' + '0px',
                box.width + 'px' + ' ' +  box.height +'px',
                '0px' + ' ' +  box.height +'px',
            ].join(', '),
            ')'
        ].join('')
    }

    describe('PolygonEditor', function(){
        var editor,
            target,
            property = 'shape-inside',
            value = 'polygon(nonzero, 0 0, 100px 0, 100px 100px)',
            $fixture = $('#test-fixture').html(markup);

        beforeEach(function(){
            // inject markup for test
            $fixture.html(markup);
            target = $('#test-shape')[0];
        });

        afterEach(function(){
            editor.remove();
            $fixture.empty();
        });

        it('should be defined', function(){
            editor = new PolygonEditor(target, value);
            expect(editor).toBeDefined();
        });

        it('should be of type polygon', function(){
            editor = new PolygonEditor(target, value);
            expect(editor.type).toBe('polygon');
        });

        it('should throw error when css value missing polygon declaration', function(){
            function setupWithEmtpy(){
                var value = '';
                editor = new PolygonEditor(target, value);
            };

            function setupWithNull(){
                var value = null;
                editor = new PolygonEditor(target, value);
            };

            function setupWithFake(){
                var value = 'fake()';
                editor = new PolygonEditor(target, value);
            };

            function setupWithFalsePositive(){
                var value = 'fake-polygon()';
                editor = new PolygonEditor(target, value);
            };

            expect(setupWithEmtpy).toThrow();
            expect(setupWithNull).toThrow();
            expect(setupWithFake).toThrow();
            expect(setupWithFalsePositive).toThrow();
        });

        it('should return polygon css shape value', function(){
            var inValue = 'polygon(nonzero, 0px 0px, 100px 0px, 100px 100px)',
                outValue;

            editor = new PolygonEditor(target, inValue);
            outValue = editor.getCSSValue();

            expect(outValue).toEqual(inValue);
        });

        it('should infer polygon from element when value contains empty polygon', function(){
            // empty polygon declaration tells the editor to automatically infer the shape
            // should not throw error.
            var inValue = 'polygon()',
                expectedValue = _getPolygonFromBox(target),
                outValue;

            editor = new PolygonEditor(target, inValue);
            outValue = editor.getCSSValue();

            expect(outValue).toEqual(expectedValue);
        });

        it('should infer polygon from element when value is incomplete', function(){
            var inValue = 'polygon(0 0, 100px 0)',
                expectedValue = _getPolygonFromBox(target),
                outValue;

            editor = new PolygonEditor(target, inValue);
            outValue = editor.getCSSValue();

            expect(outValue).toEqual(expectedValue);
        });

        it('should add new vertex when edge is clicked', function(){
            var inValue = 'polygon()',
                box = target.getBoundingClientRect(),
                mockEvent = {
                    x: target.offsetLeft,
                    // mid-way on the left edge
                    y: target.offsetTop + box.height / 2
                },
                expectedVerticesLength;

            editor = new PolygonEditor(target, inValue);
            // expect to add one more vertex
            expectedVerticesLength = editor.vertices.length + 1;

            // dispatch mock 'mousedown' event
            editor.onMouseDown.call(editor, mockEvent);

            expect(editor.vertices.length).toEqual(expectedVerticesLength);
        });

        it('should trigger "shapechange" event when new vertex is added', function(){
            var inValue = 'polygon()',
                box = target.getBoundingClientRect(),
                mockEvent = {
                    x: target.offsetLeft,
                    // mid-way on the left edge
                    y: target.offsetTop + box.height / 2
                };

            editor = new PolygonEditor(target, inValue);
            spyOn(editor, 'trigger');

            // dispatch mock 'mousedown' event
            editor.onMouseDown.call(editor, mockEvent);

            expect(editor.trigger).toHaveBeenCalled();
            expect(editor.trigger).toHaveBeenCalledWith('shapechange', editor);
        });

        it('should remove vertex when double clicked', function(){
            var inValue = 'polygon()',
                mockEvent = {
                    x: target.offsetLeft,
                    y: target.offsetTop
                },
                expectedVerticesLength;

            editor = new PolygonEditor(target, inValue);
            // expect to remove a vertex
            expectedVerticesLength = editor.vertices.length - 1;

            // dispatch mock 'mousedown' event
            editor.onDblClick.call(editor, mockEvent);

            expect(editor.vertices.length).toEqual(expectedVerticesLength);
        });

        it('should trigger "shapechange" event when vertex is removed', function(){
            var inValue = 'polygon()',
                mockEvent = {
                    x: target.offsetLeft,
                    y: target.offsetTop
                };

            editor = new PolygonEditor(target, inValue);
            spyOn(editor, 'trigger')

            // dispatch mock 'mousedown' event
            editor.onDblClick.call(editor, mockEvent);

            expect(editor.trigger).toHaveBeenCalled();
            expect(editor.trigger).toHaveBeenCalledWith('shapechange', editor);
        });

        it('should trigger "shapechange" event when vertex is moved', function(){
            var inValue = 'polygon()',
                moveBy = 100,
                mockMouseDownEvent = {
                    x: target.offsetLeft,
                    y: target.offsetTop
                },
                mockMouseMoveEvent = {
                    x: target.offsetLeft + moveBy,
                    y: target.offsetTop + moveBy
                },
                firstVertex = {};

            editor = new PolygonEditor(target, inValue);

            // cache the first vertex coordinates
            firstVertex.x = editor.vertices[0].x;
            firstVertex.y = editor.vertices[0].y;

            spyOn(editor, 'trigger');

            // dispatch mock 'mousedown' event;
            // mousedown on existing vertex sets the editor.activeVertex used when dragging
            editor.onMouseDown.call(editor, mockMouseDownEvent);

            // dispatch mock mousemove event
            editor.onMouseMove.call(editor, mockMouseMoveEvent);

            expect(editor.trigger).toHaveBeenCalled();
            expect(editor.trigger).toHaveBeenCalledWith('shapechange', editor);
            expect(editor.trigger.callCount).toEqual(1);

            // expect the first vertex to have been moved
            expect(editor.vertices[0].x).toEqual(firstVertex.x + moveBy);
            expect(editor.vertices[0].y).toEqual(firstVertex.y + moveBy);
        });

        it('should turn on the transforms editor', function(){
            editor = new PolygonEditor(target, value);
            editor.turnOnFreeTransform();

            expect(editor.transformEditor).toBeDefined();
            expect(editor.transformEditor.bbox).toBeDefined();
        });

        it('should turn off the transforms editor', function(){
            editor = new PolygonEditor(target, value);

            // turn it on
            editor.turnOnFreeTransform();
            expect(editor.transformEditor).toBeDefined();

            // now turn it off
            editor.turnOffFreeTransform();
            expect(editor.transformEditor).not.toBeDefined();
        });

        it('should not add new vertex when transform editor is on', function(){
            var inValue = 'polygon()',
                box = target.getBoundingClientRect(),
                mockEvent = {
                    x: target.offsetLeft,
                    // mid-way on the left edge
                    y: target.offsetTop + box.height / 2
                },
                expectedVerticesLength;

            editor = new PolygonEditor(target, inValue);
            // expect vertices count to be the same
            expectedVerticesLength = editor.vertices.length;

            editor.turnOnFreeTransform();

            // dispatch mock 'mousedown' event
            editor.onMouseDown.call(editor, mockEvent);

            expect(editor.vertices.length).toEqual(expectedVerticesLength);
        });

        it('should not remove vertex when transform editor is on', function(){
            var inValue = 'polygon()',
                mockEvent = {
                    x: target.offsetLeft,
                    y: target.offsetTop
                },
                expectedVerticesLength;

            editor = new PolygonEditor(target, inValue);
            // expect vertices count to be the same
            expectedVerticesLength = editor.vertices.length;

            editor.turnOnFreeTransform();

            // dispatch mock 'mousedown' event
            editor.onDblClick.call(editor, mockEvent);

            expect(editor.vertices.length).toEqual(expectedVerticesLength);
        });

        it('should add new vertex after transform editor is turned off', function(){
            var inValue = 'polygon()',
                box = target.getBoundingClientRect(),
                mockEvent = {
                    x: target.offsetLeft,
                    // mid-way on the left edge
                    y: target.offsetTop + box.height / 2
                },
                expectedVerticesLength;

            editor = new PolygonEditor(target, inValue);
            console.log('before', editor.vertices.length)
            // expect vertices count to be increased by one
            expectedVerticesLength = editor.vertices.length + 1;

            spyOn(editor, 'trigger');

            // turn transform editor on then off
            editor.toggleFreeTransform();
            editor.toggleFreeTransform();

            // dispatch mock 'mousedown' event
            editor.onMouseDown.call(editor, mockEvent);

            console.log('after', editor.vertices.length)
            console.log('after', editor.getCSSValue())

            expect(editor.trigger).toHaveBeenCalled();
            expect(editor.trigger).toHaveBeenCalledWith('shapechange', editor);
            expect(editor.vertices.length).toEqual(expectedVerticesLength);
        });

        it('should have an update function', function(){
            var inValue = 'polygon(nonzero, 0px 0px, 100px 0px, 100px 100px)',
                outValue;

            expect(editor.update).toBeDefined();
        });

        it('should update with new polygon css shape value', function(){
            var inValue = 'polygon(nonzero, 0px 0px, 100px 0px, 100px 100px)',
                newValue = 'polygon(nonzero, 0px 0px, 99px 0px, 99px 99px)';

            editor = new PolygonEditor(target, inValue);
            editor.update(newValue);

            expect(editor.getCSSValue()).toEqual(newValue);
        });

        it('should update with inferred shaped when target value is empty polygon()', function(){
            var inValue = 'polygon(nonzero, 0px 0px, 100px 0px, 100px 100px)',
                newValue = 'polygon()',
                expectedValue = _getPolygonFromBox(target);

            editor = new PolygonEditor(target, inValue);
            expect(editor.getCSSValue()).toEqual(inValue);

            editor.update(newValue);
            expect(editor.getCSSValue()).toEqual(expectedValue);
        });

        it('should throw error when updating with invalid css value', function(){

            function updateWithEmpty(){
                editor = new PolygonEditor(target, value);
                editor.update('');
            }

            function updateWithFake(){
                editor = new PolygonEditor(target, value);
                editor.update('fake');
            }

            function updateWithNull(){
                editor = new PolygonEditor(target, value);
                editor.update(null);
            };

            function updateWithFalsePositive(){
                editor = new PolygonEditor(target, value);
                editor.update('fake-polygon()');
            };

            function updateWithCircle(){
                editor = new PolygonEditor(target, value);
                editor.update('circle()');
            };

            expect(updateWithEmpty).toThrow();
            expect(updateWithFake).toThrow();
            expect(updateWithNull).toThrow();
            expect(updateWithFalsePositive).toThrow();
            // PolygonEditor does not mutate to CircleEditor
            expect(updateWithCircle).toThrow();
        });

    });
});
<commit_msg>cleanup test console<commit_after>/*jslint vars: true, plusplus: true, devel: true, browser: true, nomen: true, indent: 4, maxerr: 50 */
/*global define, describe, it, expect, beforeEach, afterEach, waits, waitsFor, runs, $, waitsForDone, spyOn */

// see main.js for path mapping config
define(['jquery', 'text!spec/test-files/markup.html', 'PolygonEditor'],
function($, markup, PolygonEditor){

    function _getPolygonFromBox(element){
        var box = element.getBoundingClientRect();
        return expectedValue = [
            'polygon(',
            [
                'nonzero',
                '0px 0px',
                box.width + 'px' + ' ' + '0px',
                box.width + 'px' + ' ' +  box.height +'px',
                '0px' + ' ' +  box.height +'px',
            ].join(', '),
            ')'
        ].join('')
    }

    describe('PolygonEditor', function(){
        var editor,
            target,
            property = 'shape-inside',
            value = 'polygon(nonzero, 0 0, 100px 0, 100px 100px)',
            $fixture = $('#test-fixture').html(markup);

        beforeEach(function(){
            // inject markup for test
            $fixture.html(markup);
            target = $('#test-shape')[0];
        });

        afterEach(function(){
            editor.remove();
            $fixture.empty();
        });

        it('should be defined', function(){
            editor = new PolygonEditor(target, value);
            expect(editor).toBeDefined();
        });

        it('should be of type polygon', function(){
            editor = new PolygonEditor(target, value);
            expect(editor.type).toBe('polygon');
        });

        it('should throw error when css value missing polygon declaration', function(){
            function setupWithEmtpy(){
                var value = '';
                editor = new PolygonEditor(target, value);
            };

            function setupWithNull(){
                var value = null;
                editor = new PolygonEditor(target, value);
            };

            function setupWithFake(){
                var value = 'fake()';
                editor = new PolygonEditor(target, value);
            };

            function setupWithFalsePositive(){
                var value = 'fake-polygon()';
                editor = new PolygonEditor(target, value);
            };

            expect(setupWithEmtpy).toThrow();
            expect(setupWithNull).toThrow();
            expect(setupWithFake).toThrow();
            expect(setupWithFalsePositive).toThrow();
        });

        it('should return polygon css shape value', function(){
            var inValue = 'polygon(nonzero, 0px 0px, 100px 0px, 100px 100px)',
                outValue;

            editor = new PolygonEditor(target, inValue);
            outValue = editor.getCSSValue();

            expect(outValue).toEqual(inValue);
        });

        it('should infer polygon from element when value contains empty polygon', function(){
            // empty polygon declaration tells the editor to automatically infer the shape
            // should not throw error.
            var inValue = 'polygon()',
                expectedValue = _getPolygonFromBox(target),
                outValue;

            editor = new PolygonEditor(target, inValue);
            outValue = editor.getCSSValue();

            expect(outValue).toEqual(expectedValue);
        });

        it('should infer polygon from element when value is incomplete', function(){
            var inValue = 'polygon(0 0, 100px 0)',
                expectedValue = _getPolygonFromBox(target),
                outValue;

            editor = new PolygonEditor(target, inValue);
            outValue = editor.getCSSValue();

            expect(outValue).toEqual(expectedValue);
        });

        it('should add new vertex when edge is clicked', function(){
            var inValue = 'polygon()',
                box = target.getBoundingClientRect(),
                mockEvent = {
                    x: target.offsetLeft,
                    // mid-way on the left edge
                    y: target.offsetTop + box.height / 2
                },
                expectedVerticesLength;

            editor = new PolygonEditor(target, inValue);
            // expect to add one more vertex
            expectedVerticesLength = editor.vertices.length + 1;

            // dispatch mock 'mousedown' event
            editor.onMouseDown.call(editor, mockEvent);

            expect(editor.vertices.length).toEqual(expectedVerticesLength);
        });

        it('should trigger "shapechange" event when new vertex is added', function(){
            var inValue = 'polygon()',
                box = target.getBoundingClientRect(),
                mockEvent = {
                    x: target.offsetLeft,
                    // mid-way on the left edge
                    y: target.offsetTop + box.height / 2
                };

            editor = new PolygonEditor(target, inValue);
            spyOn(editor, 'trigger');

            // dispatch mock 'mousedown' event
            editor.onMouseDown.call(editor, mockEvent);

            expect(editor.trigger).toHaveBeenCalled();
            expect(editor.trigger).toHaveBeenCalledWith('shapechange', editor);
        });

        it('should remove vertex when double clicked', function(){
            var inValue = 'polygon()',
                mockEvent = {
                    x: target.offsetLeft,
                    y: target.offsetTop
                },
                expectedVerticesLength;

            editor = new PolygonEditor(target, inValue);
            // expect to remove a vertex
            expectedVerticesLength = editor.vertices.length - 1;

            // dispatch mock 'mousedown' event
            editor.onDblClick.call(editor, mockEvent);

            expect(editor.vertices.length).toEqual(expectedVerticesLength);
        });

        it('should trigger "shapechange" event when vertex is removed', function(){
            var inValue = 'polygon()',
                mockEvent = {
                    x: target.offsetLeft,
                    y: target.offsetTop
                };

            editor = new PolygonEditor(target, inValue);
            spyOn(editor, 'trigger')

            // dispatch mock 'mousedown' event
            editor.onDblClick.call(editor, mockEvent);

            expect(editor.trigger).toHaveBeenCalled();
            expect(editor.trigger).toHaveBeenCalledWith('shapechange', editor);
        });

        it('should trigger "shapechange" event when vertex is moved', function(){
            var inValue = 'polygon()',
                moveBy = 100,
                mockMouseDownEvent = {
                    x: target.offsetLeft,
                    y: target.offsetTop
                },
                mockMouseMoveEvent = {
                    x: target.offsetLeft + moveBy,
                    y: target.offsetTop + moveBy
                },
                firstVertex = {};

            editor = new PolygonEditor(target, inValue);

            // cache the first vertex coordinates
            firstVertex.x = editor.vertices[0].x;
            firstVertex.y = editor.vertices[0].y;

            spyOn(editor, 'trigger');

            // dispatch mock 'mousedown' event;
            // mousedown on existing vertex sets the editor.activeVertex used when dragging
            editor.onMouseDown.call(editor, mockMouseDownEvent);

            // dispatch mock mousemove event
            editor.onMouseMove.call(editor, mockMouseMoveEvent);

            expect(editor.trigger).toHaveBeenCalled();
            expect(editor.trigger).toHaveBeenCalledWith('shapechange', editor);
            expect(editor.trigger.callCount).toEqual(1);

            // expect the first vertex to have been moved
            expect(editor.vertices[0].x).toEqual(firstVertex.x + moveBy);
            expect(editor.vertices[0].y).toEqual(firstVertex.y + moveBy);
        });

        it('should turn on the transforms editor', function(){
            editor = new PolygonEditor(target, value);
            editor.turnOnFreeTransform();

            expect(editor.transformEditor).toBeDefined();
            expect(editor.transformEditor.bbox).toBeDefined();
        });

        it('should turn off the transforms editor', function(){
            editor = new PolygonEditor(target, value);

            // turn it on
            editor.turnOnFreeTransform();
            expect(editor.transformEditor).toBeDefined();

            // now turn it off
            editor.turnOffFreeTransform();
            expect(editor.transformEditor).not.toBeDefined();
        });

        it('should not add new vertex when transform editor is on', function(){
            var inValue = 'polygon()',
                box = target.getBoundingClientRect(),
                mockEvent = {
                    x: target.offsetLeft,
                    // mid-way on the left edge
                    y: target.offsetTop + box.height / 2
                },
                expectedVerticesLength;

            editor = new PolygonEditor(target, inValue);
            // expect vertices count to be the same
            expectedVerticesLength = editor.vertices.length;

            editor.turnOnFreeTransform();

            // dispatch mock 'mousedown' event
            editor.onMouseDown.call(editor, mockEvent);

            expect(editor.vertices.length).toEqual(expectedVerticesLength);
        });

        it('should not remove vertex when transform editor is on', function(){
            var inValue = 'polygon()',
                mockEvent = {
                    x: target.offsetLeft,
                    y: target.offsetTop
                },
                expectedVerticesLength;

            editor = new PolygonEditor(target, inValue);
            // expect vertices count to be the same
            expectedVerticesLength = editor.vertices.length;

            editor.turnOnFreeTransform();

            // dispatch mock 'mousedown' event
            editor.onDblClick.call(editor, mockEvent);

            expect(editor.vertices.length).toEqual(expectedVerticesLength);
        });

        it('should add new vertex after transform editor is turned off', function(){
            var inValue = 'polygon()',
                box = target.getBoundingClientRect(),
                mockEvent = {
                    x: target.offsetLeft,
                    // mid-way on the left edge
                    y: target.offsetTop + box.height / 2
                },
                expectedVerticesLength;

            editor = new PolygonEditor(target, inValue);
            // expect vertices count to be increased by one
            expectedVerticesLength = editor.vertices.length + 1;

            spyOn(editor, 'trigger');

            // turn transform editor on then off
            editor.toggleFreeTransform();
            editor.toggleFreeTransform();

            // dispatch mock 'mousedown' event
            editor.onMouseDown.call(editor, mockEvent);

            expect(editor.trigger).toHaveBeenCalled();
            expect(editor.trigger).toHaveBeenCalledWith('shapechange', editor);
            expect(editor.vertices.length).toEqual(expectedVerticesLength);
        });

        it('should have an update function', function(){
            var inValue = 'polygon(nonzero, 0px 0px, 100px 0px, 100px 100px)',
                outValue;

            expect(editor.update).toBeDefined();
        });

        it('should update with new polygon css shape value', function(){
            var inValue = 'polygon(nonzero, 0px 0px, 100px 0px, 100px 100px)',
                newValue = 'polygon(nonzero, 0px 0px, 99px 0px, 99px 99px)';

            editor = new PolygonEditor(target, inValue);
            editor.update(newValue);

            expect(editor.getCSSValue()).toEqual(newValue);
        });

        it('should update with inferred shaped when target value is empty polygon()', function(){
            var inValue = 'polygon(nonzero, 0px 0px, 100px 0px, 100px 100px)',
                newValue = 'polygon()',
                expectedValue = _getPolygonFromBox(target);

            editor = new PolygonEditor(target, inValue);
            expect(editor.getCSSValue()).toEqual(inValue);

            editor.update(newValue);
            expect(editor.getCSSValue()).toEqual(expectedValue);
        });

        it('should throw error when updating with invalid css value', function(){

            function updateWithEmpty(){
                editor = new PolygonEditor(target, value);
                editor.update('');
            }

            function updateWithFake(){
                editor = new PolygonEditor(target, value);
                editor.update('fake');
            }

            function updateWithNull(){
                editor = new PolygonEditor(target, value);
                editor.update(null);
            };

            function updateWithFalsePositive(){
                editor = new PolygonEditor(target, value);
                editor.update('fake-polygon()');
            };

            function updateWithCircle(){
                editor = new PolygonEditor(target, value);
                editor.update('circle()');
            };

            expect(updateWithEmpty).toThrow();
            expect(updateWithFake).toThrow();
            expect(updateWithNull).toThrow();
            expect(updateWithFalsePositive).toThrow();
            // PolygonEditor does not mutate to CircleEditor
            expect(updateWithCircle).toThrow();
        });

    });
});
<|endoftext|>


<commit_before>const resumeData = {
	bio: {
		name: 'David Villarreal',
		role: 'Software Engineer',
		email: 'steadypathapp@gmail.com',
		location: {city: 'Zapopan', state: 'Jalisco', country: 'Mexico'},

		profiles: {
			github: 'https://github.com/Phaze1D',
			codefights: 'https://codefights.com/profile/playssss',
			stackoverflow: 'http://stackoverflow.com/story/davidstory',
			linkedin: 'https://www.linkedin.com/in/david-villarreal-720ab5134/',
		},

		about: `
		I have always been inspired by people who create art because I have never
		been able to do it, until I found out how to code. I feel like coding
		satisfies my logical side, and at the same time, it gives me a way to create
		amazing and beautiful art in the form of code.
		`,

		biopic: 'https://avatars0.githubusercontent.com/u/8495952?v=3',
	},

	skills: {
		technologies: [
			{ name: 'Java', mastery: 80 },
			{ name: 'Javascript', mastery: 95 },
			{ name: 'HTML', mastery: 90 },
			{ name: 'CSS', mastery: 90 },
			{ name: 'Bash Scripting', mastery: 50 },
			{ name: 'Ruby On Rails', mastery: 75 },
			{ name: 'Python', mastery: 65 },
			{ name: 'ReactJS', mastery: 95 },
			{ name: 'PHP', mastery: 68 },
			{ name: 'Laravel', mastery: 65 },
			{ name: 'Web Development', mastery: 90 },
			{ name: 'Mobile Development', mastery: 67 },
			{ name: 'Objective C', mastery: 70 },
			{ name: 'C++', mastery: 64 },
			{ name: 'C', mastery: 60 },
			{ name: 'SQL', mastery: 78 },
			{ name: 'NoSQL', mastery: 78 },
			{ name: 'Security Fundamentals', mastery: 65 },
			{ name: 'Data Structures', mastery: 80 },
			{ name: 'Algorithms', mastery: 80 },
			{ name: 'Machine Learning', mastery: 60 },
			{ name: 'ExpressJS', mastery: 85}
		],
	},

	education: {
		schools: [
			{
				name: 'Santa Monica College',
				location: {city: 'Santa Monica', state: 'CA', country: 'USA'},
				degree: 'Dropout',
				majors: 'Computer Science',
				dates: {from: 'Nov 29, 2011', to: 'July 02, 2014'},
				url: 'https://www.smc.edu'
			},
		],

		onlineCourses: [
			{
				name: 'Introduction to Algorithms',
				school: 'MIT',
				dates: {from: 'July 28, 2013', to: 'August 25, 2013'},
				url: 'https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/'
			},
			{
				name: 'Mathematics for Computer Science',
				school: 'MIT',
				dates: {from: 'August 01, 2012', to: 'September 25, 2012'},
				url: 'https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-042j-mathematics-for-computer-science-fall-2010/'
			},
			{
				name: 'Artificial Intelligence',
				school: 'MIT',
				dates: {from: 'November 01, 2016', to: 'Jan 15, 2017'},
				url: 'https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-034-artificial-intelligence-fall-2010/'
			},
			{
				name: 'Introduction to Machine Learning',
				school: 'Udacity',
				dates: {from: 'Jan 15, 2017', to: 'Feb 01, 2017'},
				url: 'https://www.udacity.com/course/intro-to-machine-learning--ud120'
			},
			{
				name: 'Full Stack Web Developer Nanodegree',
				school: 'Udacity',
				dates: {from: 'Feb 15, 2017', to: 'June 2, 2017'},
				url: 'https://www.udacity.com/course/full-stack-web-developer-nanodegree--nd004'
			},
			{
				name: 'Front-End Web Developer Nanodegree',
				school: 'Udacity',
				dates: {from: 'Feb 15, 2017', to: 'June 2, 2017'},
				url: 'https://www.udacity.com/course/front-end-web-developer-nanodegree--nd001'
			}
		],
	},
	work: {
		jobs: [
			{
				employer: 'Vida Flor',
				title: 'Fullstack Engineer',
				location: {city: 'Zapopan', state: 'Jalisco', country: 'Mexico'},
				dates: {from: 'Nov 2014', to: 'Dec 2016'},
				url: 'https://bellezaorganica.com.mx/',
				description: `
				Vida Flor is an organic beauty company that first hire me to help them
				build an e-commerce website. After finishing the website, they ask me
				if I could stay full time. I managed their database and created a Point
				of Sales system to help them with organizing all there sells and
				inventory. I also used Microsoft Access to create reports about their
				clients and products.
				`
			}
		],
	},

	intro: {
		welcomeMessage: `
			Thanks for visiting my Interactive Resume. My name is David Villarreal and
			I'm a Software Engineer If you'll like to get to know more about me enter
			these commands in the terminal
		`,
		commands: [
			{name: 'bio', info: '- Displays my bio information e.g contact info'},
			{name: 'skills', info: '- Displays my technical skills with a mastery level'},
			{name: 'education', info: '- Displays all the education I have received'},
			{name: 'education --schools', info: '- Displays the schools that I have attend'},
			{name: 'education --online', info: '- Displays just the online courses I have taken'},
			{name: 'work', info: '- Displays my work experience'},
			{name: 'projects', info: '- Displays all my projects that I have created'},
			{name: 'projects --search <query>', info: '- Search projects by technical skill used'},
			{name: 'intro', info: '- Reset the terminal and display these instructions'},
			{name: 'print', info: '- Print out a PDF version of my resume'},
		],
		example: {
			instruction: 'To display all my Javascript projects just type',
			command: 'projects --search Javascript'
		},
		ps: `
		This is an exact replica of my terminal. You can also use some common
		terminal keystrokes like up and down arrows to navigate throught previously
		entered commands. If you are using Mac OS and you have the Chrome browser
		expanded you can press COMMAND SHIFT F to get a more immersive experience.
		`
	},

	print: {
	}
}

export default {
	get: (command) => {
		return new Promise(function(resolve, reject) {
			if(command.length > 0 && resumeData[command]){
				resolve({
					data: {
						command: command,
						value: resumeData[command]
					}
				})
			}else if(command.length == 0){
				resolve({
					data: {
						command: command,
						value: ''
					}
				})
			}else{
				reject({
					data: {
						command: 'error',
						value: `-bash: ${command}: command not found`
					}
				})
			}
		})
	}
}
<commit_msg>Required the certificate images and add achievements<commit_after>const resumeData = {
	bio: {
		name: 'David Villarreal',
		role: 'Software Engineer',
		email: 'steadypathapp@gmail.com',
		location: {city: 'Zapopan', state: 'Jalisco', country: 'Mexico'},

		profiles: {
			github: 'https://github.com/Phaze1D',
			codefights: 'https://codefights.com/profile/playssss',
			stackoverflow: 'http://stackoverflow.com/story/davidstory',
			linkedin: 'https://www.linkedin.com/in/david-villarreal-720ab5134/',
		},

		about: `
		I have always been inspired by people who create art because I have never
		been able to do it, until I found out how to code. I feel like coding
		satisfies my logical side, and at the same time, it gives me a way to create
		amazing and beautiful art in the form of code.
		`,

		biopic: 'https://avatars0.githubusercontent.com/u/8495952?v=3',
	},

	skills: {
		technologies: [
			{ name: 'Java', mastery: 80 },
			{ name: 'Javascript', mastery: 95 },
			{ name: 'HTML', mastery: 90 },
			{ name: 'CSS', mastery: 90 },
			{ name: 'Bash Scripting', mastery: 50 },
			{ name: 'Ruby On Rails', mastery: 75 },
			{ name: 'Python', mastery: 65 },
			{ name: 'ReactJS', mastery: 95 },
			{ name: 'PHP', mastery: 68 },
			{ name: 'Laravel', mastery: 65 },
			{ name: 'Web Development', mastery: 90 },
			{ name: 'Mobile Development', mastery: 67 },
			{ name: 'Objective C', mastery: 70 },
			{ name: 'C++', mastery: 64 },
			{ name: 'C', mastery: 60 },
			{ name: 'SQL', mastery: 78 },
			{ name: 'NoSQL', mastery: 78 },
			{ name: 'Security Fundamentals', mastery: 65 },
			{ name: 'Data Structures', mastery: 80 },
			{ name: 'Algorithms', mastery: 80 },
			{ name: 'Machine Learning', mastery: 60 },
			{ name: 'ExpressJS', mastery: 85}
		],
	},

	education: {
		schools: [
			{
				name: 'Santa Monica College',
				location: {city: 'Santa Monica', state: 'CA', country: 'USA'},
				degree: 'Dropout',
				majors: 'Computer Science',
				dates: {from: 'Nov 29, 2011', to: 'July 02, 2014'},
				url: 'https://www.smc.edu'
			},{
				name: 'Tecnologico de Monterrey Campus Guadalajara',
				location: {city: 'Zapopan', state: 'Jalisco', country: 'Mexico'},
				degree: 'High School Diploma',
				dates: {from: 'August 29, 2005', to: 'May 02, 2009'},
				url: 'http://www.itesm.mx/wps/wcm/connect/Campus/GDA/Guadalajara/'
			}
		],

		onlineCourses: [
			{
				name: 'Introduction to Algorithms',
				school: 'MIT OpenCourseWare',
				dates: {from: 'July 28, 2013', to: 'August 25, 2013'},
				url: 'https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-006-introduction-to-algorithms-fall-2011/',
			},
			{
				name: 'Mathematics for Computer Science',
				school: 'MIT OpenCourseWare',
				dates: {from: 'August 01, 2012', to: 'September 25, 2012'},
				url: 'https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-042j-mathematics-for-computer-science-fall-2010/'
			},
			{
				name: 'Artificial Intelligence',
				school: 'MIT OpenCourseWare',
				dates: {from: 'November 01, 2016', to: 'Jan 15, 2017'},
				url: 'https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-034-artificial-intelligence-fall-2010/'
			},
			{
				name: 'Introduction to Machine Learning',
				school: 'Udacity',
				dates: {from: 'Jan 15, 2017', to: 'Feb 01, 2017'},
				url: 'https://www.udacity.com/course/intro-to-machine-learning--ud120'
			},
			{
				name: 'Full Stack Web Developer Nanodegree',
				school: 'Udacity',
				dates: {from: 'Feb 15, 2017', to: 'June 2, 2017'},
				url: 'https://www.udacity.com/course/full-stack-web-developer-nanodegree--nd004',
				certificate: require('resources/images/fullstack.jpg')
			},
			{
				name: 'Front-End Web Developer Nanodegree',
				school: 'Udacity',
				dates: {from: 'Feb 15, 2017', to: 'June 2, 2017'},
				url: 'https://www.udacity.com/course/front-end-web-developer-nanodegree--nd001',
				certificate: require('resources/images/frontend.jpg')
			}
		],
	},
	work: {
		jobs: [
			{
				employer: 'Comercializadora Vida Flor SA de CV',
				role: 'Fullstack Engineer',
				location: {city: 'Zapopan', state: 'Jalisco', country: 'Mexico'},
				dates: {from: 'July 2014', to: 'June 2017'},
				url: 'https://bellezaorganica.com.mx/',
				description: `
				Vida Flor is an organic beauty company that first hire me to help them
				build an e-commerce website. After finishing the website, they ask me
				if I could stay full time. I managed their database and created a Point
				of Sales system to help them with organizing all there sells and
				inventory. I also used Microsoft Access to create reports about their
				clients and products.
				`,
				achievements: [
					'Optimized website for better SEO and loading speed, which increased sales by 20%',
					'Automated the creation of reports with Microsoft Access which lead to a workforce that was more focus on improving the company',
					'Created simple machine learning models with sklearn that lead to less waste products and around $10,000 USD in monthly savings '
				]
			}
		],
	},

	intro: {
		welcomeMessage: `
			Thanks for visiting my Interactive Resume. My name is David Villarreal and
			I'm a Software Engineer If you'll like to get to know more about me enter
			these commands in the terminal
		`,
		commands: [
			{name: 'bio', info: '- Displays my bio information e.g contact info'},
			{name: 'projects', info: '- Displays all my projects that I have created'},
			{name: 'projects --search <query>', info: '- Search projects by technical skill used'},
			{name: 'skills', info: '- Displays my technical skills with a mastery level'},
			{name: 'education', info: '- Displays all the education I have received'},
			{name: 'education --schools', info: '- Displays the schools that I have attend'},
			{name: 'education --online', info: '- Displays just the online courses I have taken'},
			{name: 'work', info: '- Displays my work experience'},
			{name: 'intro', info: '- Reset the terminal and display these instructions'},
			{name: 'print', info: '- Print out a PDF version of my resume'},
		],
		example: {
			instruction: 'To display all my Javascript projects just type',
			command: 'projects --search Javascript'
		},
		ps: `
		This is an exact replica of my terminal. You can also use some common
		terminal keystrokes like up and down arrows to navigate throught previously
		entered commands. If you are using Mac OS and you have the Chrome browser
		expanded you can press COMMAND SHIFT F to get a more immersive experience.
		`
	},

	print: {
	}
}

export default {
	get: (command) => {
		return new Promise(function(resolve, reject) {
			if(command.length > 0 && resumeData[command]){
				resolve({
					data: {
						command: command,
						value: resumeData[command]
					}
				})
			}else if(command.length == 0){
				resolve({
					data: {
						command: command,
						value: ''
					}
				})
			}else{
				reject({
					data: {
						command: 'error',
						value: `-bash: ${command}: command not found`
					}
				})
			}
		})
	}
}
<|endoftext|>


<commit_before>/* File: mentions.js
 *
 * Copyright (c) 2014
 * Centre National d’Enseignement à Distance (Cned), Boulevard Nicephore Niepce, 86360 CHASSENEUIL-DU-POITOU, France
 * (direction-innovation@cned.fr)
 *
 * GNU Affero General Public License (AGPL) version 3.0 or later version
 *
 * This file is part of a program which is free software: you can
 * redistribute it and/or modify it under the terms of the
 * GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program.
 * If not, see <http://www.gnu.org/licenses/>.
 *
 */

'use strict';

describe('Controller: mentionsCtrl', function() {

  // load the controller's module
  beforeEach(module('cnedApp'));

  var mentionsCtrl,
    scope;

  // Initialize the controller and a mock scope
  beforeEach(inject(function($controller, $rootScope) {
    scope = $rootScope.$new();
    mentionsCtrl = $controller('mentionsCtrl', {
      $scope: scope
    });

  }));

  it('should redirect to mentions Page ', function() {
    expect(scope.showMentions).toBeDefined();
  });
});<commit_msg>test unitaire<commit_after>/* File: mentions.js
 *
 * Copyright (c) 2014
 * Centre National d’Enseignement à Distance (Cned), Boulevard Nicephore Niepce, 86360 CHASSENEUIL-DU-POITOU, France
 * (direction-innovation@cned.fr)
 *
 * GNU Affero General Public License (AGPL) version 3.0 or later version
 *
 * This file is part of a program which is free software: you can
 * redistribute it and/or modify it under the terms of the
 * GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public
 * License along with this program.
 * If not, see <http://www.gnu.org/licenses/>.
 *
 */

'use strict';

describe('Controller: mentionsCtrl', function() {

  // load the controller's module
  beforeEach(module('cnedApp'));

  var mentionsCtrl,
    scope;

  // Initialize the controller and a mock scope
  beforeEach(inject(function($controller, $rootScope) {
    scope = $rootScope.$new();
    mentionsCtrl = $controller('mentionsCtrl', {
      $scope: scope
    });

  }));

  it('should redirect to mentions Page ', function() {
    scope.showMentions();
    expect(scope.showMentions).toBeDefined();
  });

});<|endoftext|>


<commit_before>var SummaryScheduleCard = {
    name: 'SummaryScheduleCard',
    dom_target: undefined,
    term: undefined,

    hide_card: function() {
        if (window.user.instructor) {
            return false;
        }
        return true;
    },

    render_init: function() {
        if (SummaryScheduleCard.hide_card()) {
            $("#SummaryScheduleCard").hide();
            return;
        }

        if (!SummaryScheduleCard.term || SummaryScheduleCard.term === 'current') {
            SummaryScheduleCard.term = window.term.year + ',' + window.term.quarter;
        }

        WSData.fetch_instructed_course_data_for_term(SummaryScheduleCard.term,
                                                     SummaryScheduleCard.render_upon_data,
                                                     SummaryScheduleCard.render_error);
    },

    render_upon_data: function() {
        var inst_course_data = WSData._instructed_course_data[SummaryScheduleCard.term];
        if (inst_course_data) {
            // if .sections.length is 0, display msg
            SummaryScheduleCard._render();
            LogUtils.cardLoaded(SummaryScheduleCard.name, SummaryScheduleCard.dom_target);
        }
    },

    render_error: function() {
        var error_code = WSData.instructed_course_data_error_code(SummaryScheduleCard.term);
        if (error_code === 410) {
            Error410.render();
            return;
        }
        if (error_code === 404) {
            $("#SummaryScheduleCard").hide();
            return;
        }
        var raw = CardWithError.render("Schedule Summary");
        InstructorCourseCards.dom_target.html(raw);
    },

    _render: function () {
        Handlebars.registerPartial('summary_section_panel', $("#summary_section_panel").html());
        var term = SummaryScheduleCard.term;
        var instructed_course_data = WSData._link_secondary_sections(term);
        var source = $("#instructor_summary_schedule").html();
        var courses_template = Handlebars.compile(source);
        var data = {
            first_day_quarter: instructed_course_data.term.first_day_quarter,
            quarter: instructed_course_data.quarter,
            year: instructed_course_data.year,
            future_term: instructed_course_data.future_term,
            sections: instructed_course_data.sections,
            section_count: instructed_course_data.sections.length
        };
        var raw = courses_template(data);
        SummaryScheduleCard.dom_target.html(raw);
        SummaryScheduleCard.add_events(term);
    },

    add_events: function(term) {
        var term_id = term.replace(',', '_');

        $(".show_map").on("click", function(ev) {
            var course_id = ev.currentTarget.getAttribute("rel");
            course_id = course_id.replace(/[^a-z0-9]/gi, '_');
            var building = ev.currentTarget.getAttribute("rel");
            building = building.replace(/[^a-z0-9]/gi, '_');
            WSData.log_interaction("show_map_from_course_list_"+building, term);
        });

        $(".course_class_list").on("click", function(ev) {
            var width = 800;
            var height = 400;

            var left = window.screenX + 200;
            var top = window.screenY + 200;

            window.open(ev.target.href, '_blank', 'scrollbars=1,resizable=1,width='+width+',height='+height+',left='+left+',top='+top);

            var course_id = ev.currentTarget.getAttribute("rel");
            course_id = course_id.replace(/[^a-z0-9]/gi, '_');
            WSData.log_interaction("open_course_classlist_"+course_id, term);
            return false;
        });

        $(".toggle_secondary_" + term_id).on("click", function(ev) {
            var item_id = this.getAttribute("aria-controls");
            WSData.log_interaction("toggle_disclosure_of_"+item_id);
        });
    }
};

/* node.js exports */
if (typeof exports == "undefined") {
    var exports = {};
}
exports.SummaryScheduleCard = SummaryScheduleCard;
<commit_msg>Modified href source for class list link, fixing MUWM-4007<commit_after>var SummaryScheduleCard = {
    name: 'SummaryScheduleCard',
    dom_target: undefined,
    term: undefined,

    hide_card: function() {
        if (window.user.instructor) {
            return false;
        }
        return true;
    },

    render_init: function() {
        if (SummaryScheduleCard.hide_card()) {
            $("#SummaryScheduleCard").hide();
            return;
        }

        if (!SummaryScheduleCard.term || SummaryScheduleCard.term === 'current') {
            SummaryScheduleCard.term = window.term.year + ',' + window.term.quarter;
        }

        WSData.fetch_instructed_course_data_for_term(SummaryScheduleCard.term,
                                                     SummaryScheduleCard.render_upon_data,
                                                     SummaryScheduleCard.render_error);
    },

    render_upon_data: function() {
        var inst_course_data = WSData._instructed_course_data[SummaryScheduleCard.term];
        if (inst_course_data) {
            // if .sections.length is 0, display msg
            SummaryScheduleCard._render();
            LogUtils.cardLoaded(SummaryScheduleCard.name, SummaryScheduleCard.dom_target);
        }
    },

    render_error: function() {
        var error_code = WSData.instructed_course_data_error_code(SummaryScheduleCard.term);
        if (error_code === 410) {
            Error410.render();
            return;
        }
        if (error_code === 404) {
            $("#SummaryScheduleCard").hide();
            return;
        }
        var raw = CardWithError.render("Schedule Summary");
        InstructorCourseCards.dom_target.html(raw);
    },

    _render: function () {
        Handlebars.registerPartial('summary_section_panel', $("#summary_section_panel").html());
        var term = SummaryScheduleCard.term;
        var instructed_course_data = WSData._link_secondary_sections(term);
        var source = $("#instructor_summary_schedule").html();
        var courses_template = Handlebars.compile(source);
        var data = {
            first_day_quarter: instructed_course_data.term.first_day_quarter,
            quarter: instructed_course_data.quarter,
            year: instructed_course_data.year,
            future_term: instructed_course_data.future_term,
            sections: instructed_course_data.sections,
            section_count: instructed_course_data.sections.length
        };
        var raw = courses_template(data);
        SummaryScheduleCard.dom_target.html(raw);
        SummaryScheduleCard.add_events(term);
    },

    add_events: function(term) {
        var term_id = term.replace(',', '_');

        $(".show_map").on("click", function(ev) {
            var course_id = ev.currentTarget.getAttribute("rel");
            course_id = course_id.replace(/[^a-z0-9]/gi, '_');
            var building = ev.currentTarget.getAttribute("rel");
            building = building.replace(/[^a-z0-9]/gi, '_');
            WSData.log_interaction("show_map_from_course_list_"+building, term);
        });

        $(".course_class_list").on("click", function(ev) {
            var width = 800;
            var height = 400;

            var left = window.screenX + 200;
            var top = window.screenY + 200;

            window.open(ev.currentTarget.href, '_blank', 'scrollbars=1,resizable=1,width='+width+',height='+height+',left='+left+',top='+top);

            var course_id = ev.currentTarget.getAttribute("rel");
            course_id = course_id.replace(/[^a-z0-9]/gi, '_');
            WSData.log_interaction("open_course_classlist_"+course_id, term);
            return false;
        });

        $(".toggle_secondary_" + term_id).on("click", function(ev) {
            var item_id = this.getAttribute("aria-controls");
            WSData.log_interaction("toggle_disclosure_of_"+item_id);
        });
    }
};

/* node.js exports */
if (typeof exports == "undefined") {
    var exports = {};
}
exports.SummaryScheduleCard = SummaryScheduleCard;
<|endoftext|>


<commit_before>import color from 'color';

import { Platform, Dimensions, PixelRatio } from 'react-native';

const deviceHeight = Dimensions.get('window').height;
const deviceWidth = Dimensions.get('window').width;
const platform = Platform.OS;
const platformStyle = undefined;

export default {
  platformStyle,
  platform,
    // AndroidRipple
  androidRipple: true,
  androidRippleColor: 'rgba(256, 256, 256, 0.3)',
  androidRippleColorDark: 'rgba(0, 0, 0, 0.15)',

    // Badge
  badgeBg: '#ED1727',
  badgeColor: '#fff',
    // New Variable
  badgePadding: (platform === 'ios') ? 3 : 0,

    // Button
  btnFontFamily: (platform === 'ios') ? 'System' : 'Roboto_medium',
  btnDisabledBg: '#b5b5b5',
  btnDisabledClr: '#f1f1f1',

    // CheckBox
  CheckboxRadius: (platform === 'ios') ? 13 : 0,
  CheckboxBorderWidth: (platform === 'ios') ? 1 : 2,
  CheckboxPaddingLeft: (platform === 'ios') ? 4 : 2,
  CheckboxPaddingBottom: (platform === 'ios') ? 0 : 5,
  CheckboxIconSize: (platform === 'ios') ? 21 : 14,
  CheckboxIconMarginTop: (platform === 'ios') ? undefined : 1,
  CheckboxFontSize: (platform === 'ios') ? (23 / 0.9) : 18,
  DefaultFontSize: 17,
  checkboxBgColor: '#039BE5',
  checkboxSize: 20,
  checkboxTickColor: '#fff',

  // Segment
  segmentBackgroundColor: (platform === 'ios') ? '#F8F8F8' : '#3F51B5',
  segmentActiveBackgroundColor: (platform === 'ios') ? '#007aff' : '#fff',
  segmentTextColor: (platform === 'ios') ? '#007aff' : '#fff',
  segmentActiveTextColor: (platform === 'ios') ? '#fff' : '#3F51B5',
  segmentBorderColor: (platform === 'ios') ? '#007aff' : '#fff',
  segmentBorderColorMain: (platform === 'ios') ? '#a7a6ab' : '#3F51B5',

    // New Variable
  get defaultTextColor() {
    return this.textColor;
  },

  get btnPrimaryBg() {
    return this.brandPrimary;
  },
  get btnPrimaryColor() {
    return this.inverseTextColor;
  },
  get btnInfoBg() {
    return this.brandInfo;
  },
  get btnInfoColor() {
    return this.inverseTextColor;
  },
  get btnSuccessBg() {
    return this.brandSuccess;
  },
  get btnSuccessColor() {
    return this.inverseTextColor;
  },
  get btnDangerBg() {
    return this.brandDanger;
  },
  get btnDangerColor() {
    return this.inverseTextColor;
  },
  get btnWarningBg() {
    return this.brandWarning;
  },
  get btnWarningColor() {
    return this.inverseTextColor;
  },
  get btnTextSize() {
    return (platform === 'ios') ? this.fontSizeBase * 1.1 :
        this.fontSizeBase - 1;
  },
  get btnTextSizeLarge() {
    return this.fontSizeBase * 1.5;
  },
  get btnTextSizeSmall() {
    return this.fontSizeBase * 0.8;
  },
  get borderRadiusLarge() {
    return this.fontSizeBase * 3.8;
  },

  buttonPadding: 6,

  get iconSizeLarge() {
    return this.iconFontSize * 1.5;
  },
  get iconSizeSmall() {
    return this.iconFontSize * 0.6;
  },

    // Card
  cardDefaultBg: '#fff',

      // Color
  brandPrimary: (platform === 'ios') ? '#007aff' : '#4F3381',
  brandInfo: '#62B1F6',
  brandSuccess: '#5cb85c',
  brandDanger: '#d9534f',
  brandWarning: '#f0ad4e',
  brandSidebar: '#252932',

    // Font
  fontFamily: (platform === 'ios') ? 'System' : 'Roboto',
  fontSizeBase: 15,

  get fontSizeH1() {
    return this.fontSizeBase * 1.8;
  },
  get fontSizeH2() {
    return this.fontSizeBase * 1.6;
  },
  get fontSizeH3() {
    return this.fontSizeBase * 1.4;
  },

    // Footer
  footerHeight: 55,
  footerDefaultBg: (platform === 'ios') ? '#F8F8F8' : '#4179F7',

    // FooterTab
  tabBarTextColor: (platform === 'ios') ? '#6b6b6b' : '#b3c7f9',
  tabBarTextSize: (platform === 'ios') ? 14 : 11,
  activeTab: (platform === 'ios') ? '#007aff' : '#fff',
  sTabBarActiveTextColor: '#007aff',
  tabBarActiveTextColor: (platform === 'ios') ? '#007aff' : '#fff',
  tabActiveBgColor: (platform === 'ios') ? '#cde1f9' : '#3F51B5',

    // Tab
  tabDefaultBg: (platform === 'ios') ? '#F8F8F8' : '#3F51B5',
  topTabBarTextColor: (platform === 'ios') ? '#6b6b6b' : '#b3c7f9',
  topTabBarActiveTextColor: (platform === 'ios') ? '#007aff' : '#fff',
  topTabActiveBgColor: (platform === 'ios') ? '#cde1f9' : undefined,
  topTabBarBorderColor: (platform === 'ios') ? '#a7a6ab' : '#fff',
  topTabBarActiveBorderColor: (platform === 'ios') ? '#007aff' : '#fff',

    // Header
  toolbarBtnColor: (platform === 'ios') ? '#007aff' : '#fff',
  toolbarDefaultBg: (platform === 'ios') ? '#F8F8F8' : '#4F3381',
  toolbarHeight: (platform === 'ios') ? 64 : 56,
  toolbarIconSize: (platform === 'ios') ? 20 : 22,
  toolbarSearchIconSize: (platform === 'ios') ? 20 : 23,
  toolbarInputColor: (platform === 'ios') ? '#CECDD2' : '#fff',
  searchBarHeight: (platform === 'ios') ? 30 : 40,
  toolbarInverseBg: '#222',
  toolbarTextColor: (platform === 'ios') ? '#000' : '#fff',
  toolbarDefaultBorder: (platform === 'ios') ? '#a7a6ab' : '#4F3381',
  iosStatusbar: (platform === 'ios') ? 'dark-content' : 'light-content',
  get statusBarColor() {
    return color(this.toolbarDefaultBg).darken(0.2).hexString();
  },

    // Icon
  iconFamily: 'Ionicons',
  iconFontSize: (platform === 'ios') ? 30 : 28,
  iconMargin: 7,
  iconHeaderSize: (platform === 'ios') ? 33 : 24,

    // InputGroup
  inputFontSize: 17,
  inputBorderColor: '#D9D5DC',
  inputSuccessBorderColor: '#2b8339',
  inputErrorBorderColor: '#ed2f2f',

  get inputColor() {
    return this.textColor;
  },
  get inputColorPlaceholder() {
    return '#575757';
  },

  inputGroupMarginBottom: 10,
  inputHeightBase: 50,
  inputPaddingLeft: 5,

  get inputPaddingLeftIcon() {
    return this.inputPaddingLeft * 8;
  },

    // Line Height
  btnLineHeight: 19,
  lineHeightH1: 32,
  lineHeightH2: 27,
  lineHeightH3: 22,
  iconLineHeight: (platform === 'ios') ? 37 : 30,
  lineHeight: (platform === 'ios') ? 20 : 24,

    // List
  listBorderColor: '#c9c9c9',
  listDividerBg: '#f4f4f4',
  listItemHeight: 45,
  listBtnUnderlayColor: '#DDD',

    // Card
  cardBorderColor: '#ccc',

    // Changed Variable
  listItemPadding: (platform === 'ios') ? 10 : 12,

  listNoteColor: '#808080',
  listNoteSize: 13,

    // Progress Bar
  defaultProgressColor: '#E4202D',
  inverseProgressColor: '#1A191B',

    // Radio Button
  radioBtnSize: (platform === 'ios') ? 25 : 23,
  radioSelectedColorAndroid: '#3F51B5',

    // New Variable
  radioBtnLineHeight: (platform === 'ios') ? 29 : 24,

  radioColor: '#7e7e7e',

  get radioSelectedColor() {
    return color(this.radioColor).darken(0.2).hexString();
  },

    // Spinner
  defaultSpinnerColor: '#45D56E',
  inverseSpinnerColor: '#1A191B',

    // Tabs
  tabBgColor: '#F8F8F8',
  tabFontSize: 15,
  tabTextColor: '#222222',

    // Text
  textColor: '#000',
  inverseTextColor: '#fff',
  noteFontSize: 14,

    // Title
  titleFontfamily: (platform === 'ios') ? 'System' : 'Roboto_medium',
  titleFontSize: (platform === 'ios') ? 17 : 19,
  subTitleFontSize: (platform === 'ios') ? 12 : 14,
  subtitleColor: (platform === 'ios') ? '#8e8e93' : '#FFF',

    // New Variable
  titleFontColor: (platform === 'ios') ? '#000' : '#FFF',

    // Other
  borderRadiusBase: (platform === 'ios') ? 5 : 2,
  borderWidth: (1/PixelRatio.getPixelSizeForLayoutSize(1)),
  contentPadding: 10,

  get darkenHeader() {
    return color(this.tabBgColor).darken(0.03).hexString();
  },

  dropdownBg: '#000',
  dropdownLinkColor: '#414142',
  inputLineHeight: 24,
  jumbotronBg: '#C9C9CE',
  jumbotronPadding: 30,
  deviceWidth,
  deviceHeight,

    // New Variable
  inputGroupRoundedBorderRadius: 30,
};
<commit_msg>Tab colors corrected<commit_after>import color from 'color';

import { Platform, Dimensions, PixelRatio } from 'react-native';

const deviceHeight = Dimensions.get('window').height;
const deviceWidth = Dimensions.get('window').width;
const platform = Platform.OS;
const platformStyle = undefined;

export default {
  platformStyle,
  platform,
    // AndroidRipple
  androidRipple: true,
  androidRippleColor: 'rgba(256, 256, 256, 0.3)',
  androidRippleColorDark: 'rgba(0, 0, 0, 0.15)',

    // Badge
  badgeBg: '#ED1727',
  badgeColor: '#fff',
    // New Variable
  badgePadding: (platform === 'ios') ? 3 : 0,

    // Button
  btnFontFamily: (platform === 'ios') ? 'System' : 'Roboto_medium',
  btnDisabledBg: '#b5b5b5',
  btnDisabledClr: '#f1f1f1',

    // CheckBox
  CheckboxRadius: (platform === 'ios') ? 13 : 0,
  CheckboxBorderWidth: (platform === 'ios') ? 1 : 2,
  CheckboxPaddingLeft: (platform === 'ios') ? 4 : 2,
  CheckboxPaddingBottom: (platform === 'ios') ? 0 : 5,
  CheckboxIconSize: (platform === 'ios') ? 21 : 14,
  CheckboxIconMarginTop: (platform === 'ios') ? undefined : 1,
  CheckboxFontSize: (platform === 'ios') ? (23 / 0.9) : 18,
  DefaultFontSize: 17,
  checkboxBgColor: '#039BE5',
  checkboxSize: 20,
  checkboxTickColor: '#fff',

  // Segment
  segmentBackgroundColor: (platform === 'ios') ? '#F8F8F8' : '#3F51B5',
  segmentActiveBackgroundColor: (platform === 'ios') ? '#007aff' : '#fff',
  segmentTextColor: (platform === 'ios') ? '#007aff' : '#fff',
  segmentActiveTextColor: (platform === 'ios') ? '#fff' : '#3F51B5',
  segmentBorderColor: (platform === 'ios') ? '#007aff' : '#fff',
  segmentBorderColorMain: (platform === 'ios') ? '#a7a6ab' : '#3F51B5',

    // New Variable
  get defaultTextColor() {
    return this.textColor;
  },

  get btnPrimaryBg() {
    return this.brandPrimary;
  },
  get btnPrimaryColor() {
    return this.inverseTextColor;
  },
  get btnInfoBg() {
    return this.brandInfo;
  },
  get btnInfoColor() {
    return this.inverseTextColor;
  },
  get btnSuccessBg() {
    return this.brandSuccess;
  },
  get btnSuccessColor() {
    return this.inverseTextColor;
  },
  get btnDangerBg() {
    return this.brandDanger;
  },
  get btnDangerColor() {
    return this.inverseTextColor;
  },
  get btnWarningBg() {
    return this.brandWarning;
  },
  get btnWarningColor() {
    return this.inverseTextColor;
  },
  get btnTextSize() {
    return (platform === 'ios') ? this.fontSizeBase * 1.1 :
        this.fontSizeBase - 1;
  },
  get btnTextSizeLarge() {
    return this.fontSizeBase * 1.5;
  },
  get btnTextSizeSmall() {
    return this.fontSizeBase * 0.8;
  },
  get borderRadiusLarge() {
    return this.fontSizeBase * 3.8;
  },

  buttonPadding: 6,

  get iconSizeLarge() {
    return this.iconFontSize * 1.5;
  },
  get iconSizeSmall() {
    return this.iconFontSize * 0.6;
  },

    // Card
  cardDefaultBg: '#fff',

      // Color
  brandPrimary: (platform === 'ios') ? '#007aff' : '#4F3381',
  brandInfo: '#62B1F6',
  brandSuccess: '#5cb85c',
  brandDanger: '#d9534f',
  brandWarning: '#f0ad4e',
  brandSidebar: '#252932',

    // Font
  fontFamily: (platform === 'ios') ? 'System' : 'Roboto',
  fontSizeBase: 15,

  get fontSizeH1() {
    return this.fontSizeBase * 1.8;
  },
  get fontSizeH2() {
    return this.fontSizeBase * 1.6;
  },
  get fontSizeH3() {
    return this.fontSizeBase * 1.4;
  },

    // Footer
  footerHeight: 55,
  footerDefaultBg: (platform === 'ios') ? '#F8F8F8' : '#4179F7',

    // FooterTab
  tabBarTextColor: (platform === 'ios') ? '#6b6b6b' : '#b3c7f9',
  tabBarTextSize: (platform === 'ios') ? 14 : 11,
  activeTab: (platform === 'ios') ? '#007aff' : '#fff',
  sTabBarActiveTextColor: '#007aff',
  tabBarActiveTextColor: (platform === 'ios') ? '#007aff' : '#fff',
  tabActiveBgColor: (platform === 'ios') ? '#cde1f9' : '#4F3381',

    // Tab
  tabDefaultBg: (platform === 'ios') ? '#F8F8F8' : '#4F3381',
  topTabBarTextColor: (platform === 'ios') ? '#6b6b6b' : '#b3c7f9',
  topTabBarActiveTextColor: (platform === 'ios') ? '#007aff' : '#fff',
  topTabActiveBgColor: (platform === 'ios') ? '#cde1f9' : undefined,
  topTabBarBorderColor: (platform === 'ios') ? '#a7a6ab' : '#fff',
  topTabBarActiveBorderColor: (platform === 'ios') ? '#007aff' : '#fff',

    // Header
  toolbarBtnColor: (platform === 'ios') ? '#007aff' : '#fff',
  toolbarDefaultBg: (platform === 'ios') ? '#F8F8F8' : '#4F3381',
  toolbarHeight: (platform === 'ios') ? 64 : 56,
  toolbarIconSize: (platform === 'ios') ? 20 : 22,
  toolbarSearchIconSize: (platform === 'ios') ? 20 : 23,
  toolbarInputColor: (platform === 'ios') ? '#CECDD2' : '#fff',
  searchBarHeight: (platform === 'ios') ? 30 : 40,
  toolbarInverseBg: '#222',
  toolbarTextColor: (platform === 'ios') ? '#000' : '#fff',
  toolbarDefaultBorder: (platform === 'ios') ? '#a7a6ab' : '#3F51B5',
  iosStatusbar: (platform === 'ios') ? 'dark-content' : 'light-content',
  get statusBarColor() {
    return color(this.toolbarDefaultBg).darken(0.2).hexString();
  },

    // Icon
  iconFamily: 'Ionicons',
  iconFontSize: (platform === 'ios') ? 30 : 28,
  iconMargin: 7,
  iconHeaderSize: (platform === 'ios') ? 33 : 24,

    // InputGroup
  inputFontSize: 17,
  inputBorderColor: '#D9D5DC',
  inputSuccessBorderColor: '#2b8339',
  inputErrorBorderColor: '#ed2f2f',

  get inputColor() {
    return this.textColor;
  },
  get inputColorPlaceholder() {
    return '#575757';
  },

  inputGroupMarginBottom: 10,
  inputHeightBase: 50,
  inputPaddingLeft: 5,

  get inputPaddingLeftIcon() {
    return this.inputPaddingLeft * 8;
  },

    // Line Height
  btnLineHeight: 19,
  lineHeightH1: 32,
  lineHeightH2: 27,
  lineHeightH3: 22,
  iconLineHeight: (platform === 'ios') ? 37 : 30,
  lineHeight: (platform === 'ios') ? 20 : 24,

    // List
  listBorderColor: '#c9c9c9',
  listDividerBg: '#f4f4f4',
  listItemHeight: 45,
  listBtnUnderlayColor: '#DDD',

    // Card
  cardBorderColor: '#ccc',

    // Changed Variable
  listItemPadding: (platform === 'ios') ? 10 : 12,

  listNoteColor: '#808080',
  listNoteSize: 13,

    // Progress Bar
  defaultProgressColor: '#E4202D',
  inverseProgressColor: '#1A191B',

    // Radio Button
  radioBtnSize: (platform === 'ios') ? 25 : 23,
  radioSelectedColorAndroid: '#3F51B5',

    // New Variable
  radioBtnLineHeight: (platform === 'ios') ? 29 : 24,

  radioColor: '#7e7e7e',

  get radioSelectedColor() {
    return color(this.radioColor).darken(0.2).hexString();
  },

    // Spinner
  defaultSpinnerColor: '#45D56E',
  inverseSpinnerColor: '#1A191B',

    // Tabs
  tabBgColor: '#F8F8F8',
  tabFontSize: 15,
  tabTextColor: '#222222',

    // Text
  textColor: '#000',
  inverseTextColor: '#fff',
  noteFontSize: 14,

    // Title
  titleFontfamily: (platform === 'ios') ? 'System' : 'Roboto_medium',
  titleFontSize: (platform === 'ios') ? 17 : 19,
  subTitleFontSize: (platform === 'ios') ? 12 : 14,
  subtitleColor: (platform === 'ios') ? '#8e8e93' : '#FFF',

    // New Variable
  titleFontColor: (platform === 'ios') ? '#000' : '#FFF',

    // Other
  borderRadiusBase: (platform === 'ios') ? 5 : 2,
  borderWidth: (1/PixelRatio.getPixelSizeForLayoutSize(1)),
  contentPadding: 10,

  get darkenHeader() {
    return color(this.tabBgColor).darken(0.03).hexString();
  },

  dropdownBg: '#000',
  dropdownLinkColor: '#414142',
  inputLineHeight: 24,
  jumbotronBg: '#C9C9CE',
  jumbotronPadding: 30,
  deviceWidth,
  deviceHeight,

    // New Variable
  inputGroupRoundedBorderRadius: 30,
};
<|endoftext|>