<commit_before>/*!
    Copyright (C) 2017 Google Inc.
    Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
*/

(function (can) {
  'use strict';
  /* Default Sate for Assessment should be 'Not Started' */
  var defaultState = 'Not Started';
  /**
   * Simple Component to add color indication for Assessment State Name
   */
  can.Component.extend('stateColorsMap', {
    tag: 'state-colors-map',
    template: '<span style="color: {{color}};">{{state}}</span>',
    viewModel: {
      define: {
        state: {
          type: String,
          value: defaultState
        },
        color: {
          get: function () {
            var color = this.attr('colorsMap')[this.attr('state')];
            if (!color) {
              console.warn('State of the Object is not defined in Color Map: ',
                this.attr('state'));
            }
            /* Set default 'Not Started' State Color in case incorrect state is provided */
            return color || this.attr('colorsMap')[defaultState];
          }
        },
        colorsMap: {
          type: '*',
          value: function () {
            return {
              'Not Started': '#bdbdbd',
              'In Progress': '#ffab40',
              'Ready for Review': '#1378bb',
              Verified: '#333',
              Completed: '#8bc34a'
            };
          }
        }
      }
    }
  });
})(window.can);<commit_msg>Modify State Colors Map Component to test it easily<commit_after>/*!
    Copyright (C) 2017 Google Inc.
    Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
*/

(function (can, GGRC) {
  'use strict';
  /* Default Sate for Assessment should be 'Not Started' */
  var defaultState = 'Not Started';
  var tpl = '<span style="color: {{color}};">{{state}}</span>';
  /* Predefined Colors Mapping Object for Assessment */
  var defaultColorsMap = {
    'Not Started': '#bdbdbd',
    'In Progress': '#ffab40',
    'Ready for Review': '#1378bb',
    Verified: '#333',
    Completed: '#8bc34a'
  };
  /**
   * can.Map(ViewModel) presenting behavior of State Colors Map Component
   * @type {can.Map}
   */
  var viewModel = GGRC.Components.ViewModels.StateColorsMap = can.Map.extend({
    define: {
      state: {
        type: 'string',
        value: defaultState
      },
      color: {
        get: function () {
          var colorsMap = this.attr('colorsMap') || defaultColorsMap;
          var color = colorsMap[this.attr('state')];
          if (!color) {
            console.warn('State of the Instance is not defined in Colors Map: ',
              this.attr('state'));
          }
          /* Set default 'Not Started' State Color in case incorrect state is provided */
          return color || colorsMap[defaultState];
        }
      },
      colorsMap: {
        type: '*',
        value: function () {
          return defaultColorsMap;
        }
      }
    }
  });
  /**
   * Simple Component to add color indication for Assessment State Name
   */
  can.Component.extend('stateColorsMap', {
    tag: 'state-colors-map',
    template: tpl,
    viewModel: viewModel
  });
})(window.can, window.GGRC);
{'fraction_non_alphanumeric': 0.1408717624763108, 'fraction_numerical': 0.011370814908401769, 'mean_word_length': 2.0540019286403086, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6746118', 'n_tokens_mistral': 937, 'n_tokens_neox': 910, 'n_words': 252}