varvet / serenade.js

Client side MVC framework
http://serenadejs.org
Other
524 stars 27 forks source link

Dependent property does not always trigger a change event #87

Closed ghost closed 11 years ago

ghost commented 11 years ago
class @parent extends Serenade.Model
  @property "selection"

class @child extends Serenade.Model
  @property "parent"
  @property "selected"
    dependsOn: "parent.selection"
    get: ->
      @parent.selection is this

parent = new @parent()
child  = new @child(parent: parent)
parent.selection = child

# Allows test to pass:
# child.selected_property.trigger()
expect(=>
  console.log(child.selected)
  parent.selection = undefined
  console.log(child.selected)
).to.triggerEvent child.selected_property