Baobab Fixes and Additional Specs

Hey @caitp —if you have a chance, I'd love for you to look over these commits. The first three are minor fixes we've made for Baobab and additional specs that cover those changes. The last one is a larger refactor that removes a lot of duplicate logic from the constructors of the individual classes and adds a dozen or so tests for the logic in the base class constructor. Since I haven't written many JS tests, it'd be great to get your feedback before I write more!

Sorry these are consolidated into a single PR — I suppose I should have filed an issue and PR for each one but things have been all over the place today.
Try to use the following pattern: `i` for current index, `ii` for maximum index --- it's sort of mnemonic and easy to keep in memory.

```js
for (var i=0, ii = keys.length; i < ii; ++i) {
  ...
}
```