I added data-binding support for Combo boxes.
I also committed a Rakefile to be able to run tests using jrake.
Simply run: jrake test_core
Right now, it only covers the core tests for Glimmer. In the future, I will add a task to handle all tests in the test directory.
attr_accessor :country, :country_options
self.country_options=["", "Canada", "US", "Mexico"]
self.country = "Canada"
selection bind(Person.new, :country)
This produces a tiny shell with a combo box that has "Canada" preselected:
Since convention over configuration is one of the principles behind Glimmer's design, when declaring data-binding for a combo box, there is no need to declare it for both the property being bound (e.g. country) and the collection that contains the available options (e.g. US, Canada, Mexico.) Simply ensure that the collection property on the model follows the convention of having the same name as the property being bound suffixed with "_options", and Glimmer will figure out the rest during data-binding.
Take a look at this unit test for more details on how combo box data-binding is expected to work:
Next up is List box data-binding support. Stay tuned!