adding tests for css updating; be careful: trying to make text-decoration blink appears to have no effect
This commit is contained in:
parent
901b4d9305
commit
2126c6c513
|
@ -2,4 +2,8 @@
|
||||||
"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"
|
"blah"
|
||||||
(html (head) (body (p (@ (class "baz")))))
|
"baz"
|
||||||
|
(html (head) (body (p (@ (class "baz")))))
|
||||||
|
"line-through"
|
||||||
|
"underline"
|
||||||
|
(html (head) (body (p (@ (style "text-decoration: underline; ")))))
|
||||||
|
|
|
@ -18,6 +18,15 @@
|
||||||
(view->xexp (view-up (view-up updated-new-view)))
|
(view->xexp (view-up (view-up updated-new-view)))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
(define (my-view-top v)
|
||||||
|
(cond [(view-up? v)
|
||||||
|
(my-view-top (view-up v))]
|
||||||
|
[else
|
||||||
|
v]))
|
||||||
|
|
||||||
|
|
||||||
|
;; Trying attribute editing
|
||||||
(view-attr (view-down
|
(view-attr (view-down
|
||||||
(view-right
|
(view-right
|
||||||
(view-down
|
(view-down
|
||||||
|
@ -25,12 +34,14 @@
|
||||||
(body (p (@ (class "blah"))))))))))
|
(body (p (@ (class "blah"))))))))))
|
||||||
"class")
|
"class")
|
||||||
|
|
||||||
|
(view-attr (update-view-attr (view-down
|
||||||
(define (my-view-top v)
|
(view-right
|
||||||
(cond [(view-up? v)
|
(view-down
|
||||||
(my-view-top (view-up v))]
|
(->view (xexp->dom `(html (head)
|
||||||
[else
|
(body (p (@ (class "blah"))))))))))
|
||||||
v]))
|
"class"
|
||||||
|
"baz")
|
||||||
|
"class")
|
||||||
|
|
||||||
(view->xexp
|
(view->xexp
|
||||||
(my-view-top
|
(my-view-top
|
||||||
|
@ -41,3 +52,32 @@
|
||||||
(body (p (@ (class "blah"))))))))))
|
(body (p (@ (class "blah"))))))))))
|
||||||
"class"
|
"class"
|
||||||
"baz")))
|
"baz")))
|
||||||
|
|
||||||
|
|
||||||
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
|
(view-css (view-down
|
||||||
|
(view-right
|
||||||
|
(view-down
|
||||||
|
(->view (xexp->dom `(html (head)
|
||||||
|
(body (p (@ (style "text-decoration: line-through"))))))))))
|
||||||
|
"text-decoration")
|
||||||
|
|
||||||
|
(view-css (update-view-css (view-down
|
||||||
|
(view-right
|
||||||
|
(view-down
|
||||||
|
(->view (xexp->dom `(html (head)
|
||||||
|
(body (p (@ (style "text-decoration: line-through"))))))))))
|
||||||
|
"text-decoration"
|
||||||
|
"underline")
|
||||||
|
"text-decoration")
|
||||||
|
|
||||||
|
(view->xexp
|
||||||
|
(my-view-top
|
||||||
|
(update-view-css (view-down
|
||||||
|
(view-right
|
||||||
|
(view-down
|
||||||
|
(->view (xexp->dom `(html (head)
|
||||||
|
(body (p (@ (style "text-decoration: line-through"))))))))))
|
||||||
|
"text-decoration"
|
||||||
|
"underline")))
|
||||||
|
|
|
@ -211,7 +211,7 @@
|
||||||
MockView.prototype.updateAttr = function(name, value) {
|
MockView.prototype.updateAttr = function(name, value) {
|
||||||
return this.act(
|
return this.act(
|
||||||
function(cursor) {
|
function(cursor) {
|
||||||
return cursor.replaceNode([$(cursor.node[0].cloneNode(true))
|
return cursor.replaceNode([$(cursor.node[0].cloneNode(false))
|
||||||
.attr(name, value).get(0)]
|
.attr(name, value).get(0)]
|
||||||
.concat(cursor.node.slice(1)));
|
.concat(cursor.node.slice(1)));
|
||||||
},
|
},
|
||||||
|
@ -235,7 +235,9 @@
|
||||||
MockView.prototype.updateCss = function(name, value) {
|
MockView.prototype.updateCss = function(name, value) {
|
||||||
return this.act(
|
return this.act(
|
||||||
function(cursor) {
|
function(cursor) {
|
||||||
return cursor.replaceNode([$(cursor.node[0].cloneNode(true))
|
console.log($(cursor.node[0].cloneNode(false))
|
||||||
|
.css(name, value).get(0));
|
||||||
|
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)));
|
||||||
},
|
},
|
||||||
|
@ -259,7 +261,7 @@
|
||||||
MockView.prototype.updateFormValue = function(value) {
|
MockView.prototype.updateFormValue = function(value) {
|
||||||
return this.act(
|
return this.act(
|
||||||
function(cursor) {
|
function(cursor) {
|
||||||
return cursor.replaceNode([$(cursor.node[0].cloneNode(true))
|
return cursor.replaceNode([$(cursor.node[0].cloneNode(false))
|
||||||
.val(value).get(0)]
|
.val(value).get(0)]
|
||||||
.concat(cursor.node.slice(1)));
|
.concat(cursor.node.slice(1)));
|
||||||
},
|
},
|
||||||
|
@ -367,7 +369,7 @@
|
||||||
MockView.prototype.show = function() {
|
MockView.prototype.show = function() {
|
||||||
return this.act(
|
return this.act(
|
||||||
function(cursor) {
|
function(cursor) {
|
||||||
return cursor.replaceNode([$(cursor.node[0].cloneNode(true))
|
return cursor.replaceNode([$(cursor.node[0].cloneNode(false))
|
||||||
.show().get(0)]
|
.show().get(0)]
|
||||||
.concat(cursor.node.slice(1)));
|
.concat(cursor.node.slice(1)));
|
||||||
},
|
},
|
||||||
|
@ -381,7 +383,7 @@
|
||||||
MockView.prototype.hide = function() {
|
MockView.prototype.hide = function() {
|
||||||
return this.act(
|
return this.act(
|
||||||
function(cursor) {
|
function(cursor) {
|
||||||
return cursor.replaceNode([$(cursor.node[0].cloneNode(true))
|
return cursor.replaceNode([$(cursor.node[0].cloneNode(false))
|
||||||
.hide().get(0)]
|
.hide().get(0)]
|
||||||
.concat(cursor.node.slice(1)));
|
.concat(cursor.node.slice(1)));
|
||||||
},
|
},
|
||||||
|
@ -423,9 +425,9 @@
|
||||||
while (cursor.canRight()) {
|
while (cursor.canRight()) {
|
||||||
cursor = cursor.right();
|
cursor = cursor.right();
|
||||||
}
|
}
|
||||||
return cursor.insertRight([domNode.cloneNode(true)]);
|
return cursor.insertRight(domNodeToArrayTree(domNode));
|
||||||
} else {
|
} else {
|
||||||
return cursor.insertDown([domNode.cloneNode(true)]);
|
return cursor.insertDown(domNodeToArrayTree(domNode));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(eventHandlers) { return eventHandlers; },
|
function(eventHandlers) { return eventHandlers; },
|
||||||
|
|
Loading…
Reference in New Issue
Block a user