All files / addon/components/bootstrap simple-select.js

50% Statements 1/2
100% Branches 0/0
0% Functions 0/1
50% Lines 1/2

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74                1x                                                                                                                                  
import Component from '@ember/component';
import layout from '../../templates/components/bootstrap/simple-select';
import { PropTypes } from 'ember-prop-types';
import {
  BuilderForPropTypes,
  BuilderForPropDefaults
} from 'ember-bootstrap-controls/utils/prop-definition-tools';
 
export const propDefinitions = {
  autofocus: {
    default: false,
    description: 'This Boolean attribute lets you specify that a form control should have input focus when the page loads. Only one form element in a document can have the autofocus attribute.',
    type: PropTypes.bool,
  },
  bootstrapCustomClass: {
    default: false,
    description: 'This Boolean attribute lets you specify custom-select class should be applied to the select.',
    type: PropTypes.bool,
  },
  disabled: {
    description: 'Indicates whether the control is disabled',
    type: PropTypes.bool,
  },
  errors: {
    description: 'An array of EmberData errors to display.',
    type: PropTypes.arrayOf(PropTypes.string),
  },
  help: {
    description: 'Additonal text to provide additional context to the user that is displayed below the input.',
    type: PropTypes.string,
  },
  multiple: {
    default: false,
    description: 'This Boolean attribute indicates that multiple options can be selected in the list. If it is not specified, then only one option can be selected at a time. When multiple is specified, most browsers will show a scrolling list box instead of a single line dropdown.',
    type: PropTypes.bool,
  },
  required: {
    default: false,
    description: 'Indicates that the user must fill in a value before submitting a form.',
    type: PropTypes.bool,
  },
  srOnly: {
    default: false,
    description: 'Indicated that the label should be hidden to all devices except screen readers',
    type: PropTypes.bool,
  },
  value: {
    description: 'A string that is the value for the control.',
    type: PropTypes.string.isRequired,
  },
  label: {
    default: 'Text',
    description: 'The label shown above the input box.',
    type: PropTypes.string,
  },
  options: {
    description: 'A collection of option values for each radio button.',
    type: PropTypes.arrayOf(PropTypes.object).isRequired,
  },
  onChange: {
    description: 'A function that is called when the radio is changed.',
    type: PropTypes.func.isRequired,
  },
};
 
export default Component.extend({
  layout,
  propTypes: BuilderForPropTypes(propDefinitions),
 
  getDefaultProps() {
    return BuilderForPropDefaults(propDefinitions)
  },
});