Feature/select optgroup (closes #520)

This is built on @yihui's pull request #520, but with two main changes:

* `choicesWithNames` always converts `choices` to a named list, which simplifies a lot of other code.
* There are tests which exercise some corner cases.

The update*Input code still needs some work at this point.
You removed `[[1]]` on `choice` here, and `choice` could be a vector of length > 1, e.g. `firstChoice(list(A=c("a", "b"), C="c"))`.