frankshearar/zipr — Issue #25: Left/right causes changes to be forgotten
Author: frankshearar
Created: 2012-02-26 21:04:17+00:00
State: open

t = Node.new(:root, [Leaf.new(:left), Leaf.new(:right)])
z = t.zipper
new_t = z.down.replace(Leaf.new(:links)).right.root
new_t.should == Node.new(:root, [Leaf.new(:links), Leaf.new(:right)])

The above spec fails because the path of contexts - the path to the root - doesn't go through the changed node. As a result the rooting process doesn't go through a "this has changed" context, and the edit is lost. The same thing will happen for rightmost, left, leftmost... but not down.