fixed bug with insert-right that was causing broken invariant

This commit is contained in:
Danny Yoo 2011-09-08 14:48:08 -04:00
parent e30a1d0be1
commit 6b78d5154f
3 changed files with 20 additions and 18 deletions

View File

@ -131,30 +131,34 @@
(view->xexp (view->xexp
(view-insert-right (view-insert-right
(view-down (view-focus (->view (xexp->dom '(html (head) (view-down
(body (h1 (@ (id "header"))) (view-down
(p (@ (id "para")) (view-focus (->view (xexp->dom '(html (head)
(ul (li "one"))))))) (body (h1 (@ (id "header")))
"para")) (p (@ (id "para"))
(ul (li "one")))))))
"para")))
(xexp->dom '(li "two")))) (xexp->dom '(li "two"))))
(view->xexp (view->xexp
(view-insert-right (view-insert-right
(view-insert-right (view-insert-right
(view-down (view-focus (->view (xexp->dom '(html (head) (view-down
(body (h1 (@ (id "header"))) (view-down (view-focus (->view (xexp->dom '(html (head)
(p (@ (id "para")) (body (h1 (@ (id "header")))
(ul (li "one"))))))) (p (@ (id "para"))
"para")) (ul (li "one")))))))
"para")))
(xexp->dom '(li "two"))) (xexp->dom '(li "two")))
(xexp->dom '(li "three")))) (xexp->dom '(li "three"))))
(view->xexp (view->xexp
(view-insert-left (view-insert-left
(view-down (view-focus (->view (xexp->dom '(html (head) (view-down
(body (h1 (@ (id "header"))) (view-down (view-focus (->view (xexp->dom '(html (head)
(p (@ (id "para")) (body (h1 (@ (id "header")))
(ul (li "one"))))))) (p (@ (id "para"))
"para")) (ul (li "one")))))))
"para")))
(xexp->dom '(li "zero")))) (xexp->dom '(li "zero"))))

View File

@ -235,8 +235,6 @@
MockView.prototype.updateCss = function(name, value) { MockView.prototype.updateCss = function(name, value) {
return this.act( return this.act(
function(cursor) { function(cursor) {
console.log($(cursor.node[0].cloneNode(false))
.css(name, value).get(0));
return cursor.replaceNode([$(cursor.node[0].cloneNode(false)) return cursor.replaceNode([$(cursor.node[0].cloneNode(false))
.css(name, value).get(0)] .css(name, value).get(0)]
.concat(cursor.node.slice(1))); .concat(cursor.node.slice(1)));

View File

@ -171,7 +171,7 @@ var TreeCursor = (function() {
TreeCursor.prototype.insertRight = function(n) { TreeCursor.prototype.insertRight = function(n) {
return new TreeCursor(this.parent, return new TreeCursor(this.parent,
n, n,
this.prevs.concat(this.node), this.prevs.concat([this.node]),
this.nexts, this.nexts,
this.openF, this.openF,
this.closeF, this.closeF,