Assert the given option is selected from the select with label
    (recommended), name or id.

    If multiple selections are supported other options may be selected.
344401
def assert_single_selected(self, option_name, select_name):
    
    option = find_option(world.browser, select_name, option_name)
    assert option.is_selected(), "Option should be selected."
61383
private List<?> findValidOptions(final List<?> options, final List<?> selected,
			final boolean handleInvalid) {
		// No selection made
		if (selected == null || selected.isEmpty()) {
			// No Selection required, or no options to select
			if (isAllowNoSelection() || options == null || options.isEmpty()) {
				return null;
			} else { // Selection is required
				// Check if NULL is an option
				if (selected == null && SelectListUtil.containsOption(options, null)) {
					return null;
				}

				// Must have a selected option
				throw new IllegalStateException(
						"A valid option must be selected for lists that require a selected option.");
			}
		}

		// Check we have valid options (If options are matched via Option/Code or Legacy Matching, then return a list of
		// the actual options)
		List<Object> validSelections = new ArrayList<>();

		for (Object selectedOption : selected) {
			boolean found = false;

			if (options != null) {
				if (selectedOption == null) {
					found = SelectListUtil.containsOption(options, null);
					if (found) {
						validSelections.add(null);
					}
				} else {
					Object option = SelectListUtil.getOptionWithMatching(options, selectedOption);
					if (option != null) {
						found = true;
						validSelections.add(option);
					}
				}
			}

			if (!found) {
				if (isEditable() && selectedOption instanceof String) {
					validSelections.add(selectedOption);
				} else if (handleInvalid) { // Handle invalid option
					List<?> valid = doHandleInvalidOption(selectedOption);
					setSelected(valid);
					return valid;
				} else {
					throw new IllegalStateException("The selection \"" + selectedOption
							+ "\" is not an available option.");
				}
			}
		}

		return validSelections;

	}
71903
public static OptionElement findByName(List<OptionElement> options, String name) {
    checkNotNull(options, "options");
    checkNotNull(name, "name");

    OptionElement found = null;
    for (OptionElement option : options) {
      if (option.name().equals(name)) {
        if (found != null) {
          throw new IllegalStateException("Multiple options match name: " + name);
        }
        found = option;
      }
    }
    return found;
  }
153873
function(element, options) {
        this.name = name;
        this.$ = $(element);
        this.id = $.zui.uuid();
        this.selectOrder = 1;
        this.selections = {};

        this.getOptions(options);
        this._init();
    }
300202
def check_for_list_option option_name
      return nil if @options[option_name].nil?

      return [@options[option_name]] if @options[option_name].is_a?(String) or @options[option_name].is_a(Hash)
      return @options[option_name] if @options[option_name].is_a?(Array)

      raise "Invalid data type provided for option #{option_name}: a list was expected. Please provide a single string element or an array of strings."
    end
1013379
def has_option(self, option_name):
		
		if self.prefix:
			option_name = self.prefix + self.seperator + option_name
		item_names = option_name.split(self.seperator)
		node = self._storage
		for item_name in item_names:
			if node is None:
				return False
			if not item_name in node:
				return False
			node = node[item_name]
		return True
1132315
function(id) {
        var item = Selectivity.findNestedById(this.results, id);
        if (item && !item.disabled && item.selectable !== false) {
            var options = { id: id, item: item };
            if (this.selectivity.triggerEvent('selectivity-selecting', options)) {
                this.selectivity.triggerEvent('selectivity-selected', options);
            }
        }
    }
469172
def selected(self, request, tag):
        
        if self.option.selected:
            tag(selected='selected')
        return tag
161232
def label_with_id(label_id, options = {})
      if options && options[:index] then
        label(:id => label_id.to_s, :index => options[:index]).text
      else
        label(:id, label_id.to_s).text
      end
    end
209369
public boolean somethingSelected() {
        boolean isSelected = false;
        if (input()) {
            WebElement webElement = element.getWebElement();
            if ("input".equalsIgnoreCase(webElement.getTagName())) {
                isSelected = webElement.isSelected();
            } else if (SELECT.equalsIgnoreCase(webElement.getTagName())) {
                Select dropdown = new Select(webElement);
                isSelected = !dropdown.getAllSelectedOptions().isEmpty();
            }
        }
        return isSelected;
    }
858688
function(options, select) {
                if (options.length === 0) {
                    return this.nonSelectedText;
                }
                else {
                    var selected = '';
                    var delimiter = this.delimiterText;

                    options.each(function () {
                        var label = ($(this).attr('label') !== undefined) ? $(this).attr('label') : $(this).text();
                        selected += label + delimiter;
                    });
                    return selected.substr(0, selected.length - 2);
                }
            }
600508
def validate(self, value, model_instance, **kwargs):
        
        self.get_choices_form_class().validate(value, model_instance, **kwargs)
734516
def option_compare ( opt_form, opt_app )
      case opt_form[:t]
      when OPTION_PREFIX_SHORT
        return true if opt_form[:n][0, opt_app.shortname.length] == opt_app.shortname
      when OPTION_PREFIX_LONG
	return true if opt_form[:n].split('=')[0] == opt_app.longname
      end
      return false
    end
1290975
def iselect(select, tag, namespaces=None, limit=0, flags=0, **kwargs):
    """"""

    for el in compile(select, namespaces, flags, **kwargs).iselect(tag, limit):
        yield el
696852
public function toOptions($selected=0, $id_as_label=false)
    {
        if (count($this->unique) != 1) {
            return '';
        }
        $id_col = $this->unique[0];
        if ($id_as_label) {
            $label_col = $id_col;
        } else {
            // use first non-ID column for the label
            $label_col = array_keys($this->columns);
            foreach ($label_col as $col) {
                if ($col != $id_col) {
                    $label_col = $col;
                    break;
                }
            }
        }
        $ret = array_reduce($this->find($label_col), 
            function ($ret, $obj) use ($selected, $id_col, $label_col) {
                return $ret . sprintf('<option %s value="%d">%s</option>',
                        $selected == $obj->$id_col() ? 'selected' : '',
                        $obj->$id_col(),
                        $obj->$label_col()
                );
            }, 
            ''
        );

        return $ret;
    }
919315
def create_option(
            self, name, value, label, selected, index,
            subindex=None, attrs=None):
        """"""
        index = str(index) if subindex is None else "%s%s%s" % (
            index, self.id_separator, subindex)
        if attrs is None:
            attrs = {}
        option_attrs = self.build_attrs(
            self.attrs, attrs) if self.option_inherits_attrs else {}
        if selected:
            option_attrs.update(self.checked_attribute)
        if 'id' in option_attrs:
            if self.use_nice_ids:
                option_attrs['id'] = "%s%s%s" % (
                    option_attrs['id'],
                    self.id_separator,
                    slugify(label.lower())
                    )
            else:
                option_attrs['id'] = self.id_for_label(
                    option_attrs['id'], index)
        return {
            'name': name,
            'value': value,
            'label': label,
            'selected': selected,
            'index': index,
            'attrs': option_attrs,
            'type': self.input_type,
            'template_name': self.option_template_name,
            'wrap_label': True,
            }
264112
def set_option(self, name, value):
        """"""
        _assert_value_is_valid(name)
        self._options[name] = value