pharo-spec / Spec

Spec is a framework in Pharo for describing user interfaces.
MIT License
62 stars 65 forks source link

SpDropListPresenter: ArgumentsCountMismatch: This block accepts 2 arguments, but was called with 1 argument #1663

Open hernanmd opened 1 day ago

hernanmd commented 1 day ago

The method comment states that aBlock could receive up to 3 arguments:

SpDropListPresenter>>whenSelectionChangedDo: aBlock
    "Inform when the selection is changed.
     The method should be used only if you are interested in the fact that there was 
     a change, without caring about what has changed.
     If you are interested in the items, use `SpDropListPresenter>>#whenSelectedItemChanged:`

     `aBlock` receive 3 optional arguments: 
     - new value 
     - old value 
     - announcement triggered"

However, when 2 arguments are passed, an ArgumentsCountMismatch exception is raised.

How to reproduce:

SpDropListPresenter new
    items: #(1 2 3 4);
    whenSelectionChangedDo: [ : newValue : oldValue | self haltIf: [ oldValue = newValue ] ];
    open.