adding some test cases for navigating, editing the tree
This commit is contained in:
parent
d19e8562ac
commit
901b4d9305
|
@ -1,3 +1,5 @@
|
||||||
""
|
""
|
||||||
"some text"
|
"some text"
|
||||||
(html (head) (body (p "hello world, this is a test") (div (@ (id "a div")) "some text")))
|
(html (head) (body (p "hello world, this is a test") (div (@ (id "a div")) "some text")))
|
||||||
|
"blah"
|
||||||
|
(html (head) (body (p (@ (class "baz")))))
|
|
@ -16,6 +16,28 @@
|
||||||
(view-text updated-new-view) ;; should be "some text"
|
(view-text updated-new-view) ;; should be "some text"
|
||||||
|
|
||||||
(view->xexp (view-up (view-up updated-new-view)))
|
(view->xexp (view-up (view-up updated-new-view)))
|
||||||
;; should be:
|
|
||||||
; (html (head) (body (p "hello world, this is a test")
|
|
||||||
; (div (@ (id "a div")) "some text")))
|
(view-attr (view-down
|
||||||
|
(view-right
|
||||||
|
(view-down
|
||||||
|
(->view (xexp->dom `(html (head)
|
||||||
|
(body (p (@ (class "blah"))))))))))
|
||||||
|
"class")
|
||||||
|
|
||||||
|
|
||||||
|
(define (my-view-top v)
|
||||||
|
(cond [(view-up? v)
|
||||||
|
(my-view-top (view-up v))]
|
||||||
|
[else
|
||||||
|
v]))
|
||||||
|
|
||||||
|
(view->xexp
|
||||||
|
(my-view-top
|
||||||
|
(update-view-attr (view-down
|
||||||
|
(view-right
|
||||||
|
(view-down
|
||||||
|
(->view (xexp->dom `(html (head)
|
||||||
|
(body (p (@ (class "blah"))))))))))
|
||||||
|
"class"
|
||||||
|
"baz")))
|
||||||
|
|
|
@ -194,7 +194,7 @@
|
||||||
return this.act(
|
return this.act(
|
||||||
function(cursor) {
|
function(cursor) {
|
||||||
return cursor.replaceNode([cursor.node[0]]
|
return cursor.replaceNode([cursor.node[0]]
|
||||||
.concat([document.createTextNode(text)]));
|
.concat([[document.createTextNode(text)]]));
|
||||||
},
|
},
|
||||||
function(eventHandlers) { return eventHandlers; },
|
function(eventHandlers) { return eventHandlers; },
|
||||||
function(view) {
|
function(view) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user