|
@@ -17,65 +17,71 @@ tearDown
|
|
lastChild := document body lastChild.
|
|
lastChild := document body lastChild.
|
|
self assert: lastChild equals: fixtureDiv.
|
|
self assert: lastChild equals: fixtureDiv.
|
|
document body removeChild: lastChild
|
|
document body removeChild: lastChild
|
|
|
|
+!
|
|
|
|
+
|
|
|
|
+testedClass
|
|
|
|
+
|
|
|
|
+ ^Domite
|
|
! !
|
|
! !
|
|
|
|
|
|
!DOMiteTest methodsFor: 'testing'!
|
|
!DOMiteTest methodsFor: 'testing'!
|
|
|
|
|
|
testDefaultInsertElement
|
|
testDefaultInsertElement
|
|
- Domite new << (Domite newElement: 'p').
|
|
|
|
|
|
+
|
|
|
|
+ self testedClass new << (self testedClass newElement: 'p').
|
|
self assert: (document body innerHTML endsWith: '<p></p>').
|
|
self assert: (document body innerHTML endsWith: '<p></p>').
|
|
document body removeChild: document body lastChild
|
|
document body removeChild: document body lastChild
|
|
!
|
|
!
|
|
|
|
|
|
testDefaultInsertString
|
|
testDefaultInsertString
|
|
- Domite new << 'a foo in a bar'.
|
|
|
|
|
|
+ self testedClass new << 'a foo in a bar'.
|
|
self assert: (document body innerHTML endsWith: 'a foo in a bar').
|
|
self assert: (document body innerHTML endsWith: 'a foo in a bar').
|
|
document body removeChild: document body lastChild
|
|
document body removeChild: document body lastChild
|
|
!
|
|
!
|
|
|
|
|
|
testDefaultInsertStringInFragment
|
|
testDefaultInsertStringInFragment
|
|
- Domite new << (Domite newStream << 'a foo in a bar').
|
|
|
|
|
|
+ self testedClass new << (self testedClass newStream << 'a foo in a bar').
|
|
self assert: (document body innerHTML endsWith: 'a foo in a bar').
|
|
self assert: (document body innerHTML endsWith: 'a foo in a bar').
|
|
document body removeChild: document body lastChild
|
|
document body removeChild: document body lastChild
|
|
!
|
|
!
|
|
|
|
|
|
testFromBadSelectorIsInvalid
|
|
testFromBadSelectorIsInvalid
|
|
| d |
|
|
| d |
|
|
- d := Domite at: '#goo'.
|
|
|
|
|
|
+ d := self testedClass at: '#goo'.
|
|
self assert: d isInvalid.
|
|
self assert: d isInvalid.
|
|
- d := Domite at: 'body'.
|
|
|
|
|
|
+ d := self testedClass at: 'body'.
|
|
self deny: d isInvalid.
|
|
self deny: d isInvalid.
|
|
- d := Domite at: 'html body div#fixture'.
|
|
|
|
|
|
+ d := self testedClass at: 'html body div#fixture'.
|
|
self deny: d isInvalid
|
|
self deny: d isInvalid
|
|
!
|
|
!
|
|
|
|
|
|
testInsertDomNode
|
|
testInsertDomNode
|
|
| d |
|
|
| d |
|
|
- d := Domite fromElement: fixtureDiv.
|
|
|
|
|
|
+ d := self testedClass fromElement: fixtureDiv.
|
|
d << (document createElement: 'pre').
|
|
d << (document createElement: 'pre').
|
|
self assert: (document body innerHTML endsWith: '>sentinel<pre></pre></div>')
|
|
self assert: (document body innerHTML endsWith: '>sentinel<pre></pre></div>')
|
|
!
|
|
!
|
|
|
|
|
|
testInsertDomNodeInFragment
|
|
testInsertDomNodeInFragment
|
|
| d |
|
|
| d |
|
|
- d := Domite at: '#fixture'.
|
|
|
|
- d << (Domite newStream << (document createElement: 'script')).
|
|
|
|
|
|
+ d := self testedClass at: '#fixture'.
|
|
|
|
+ d << (self testedClass newStream << (document createElement: 'script')).
|
|
self assert: (document body innerHTML endsWith: '>sentinel<script></script></div>')
|
|
self assert: (document body innerHTML endsWith: '>sentinel<script></script></div>')
|
|
!
|
|
!
|
|
|
|
|
|
testInsertElement
|
|
testInsertElement
|
|
| d |
|
|
| d |
|
|
- d := Domite at: 'html body div#fixture'.
|
|
|
|
- d << (Domite newElement: 'p').
|
|
|
|
|
|
+ d := self testedClass at: 'html body div#fixture'.
|
|
|
|
+ d << (self testedClass newElement: 'p').
|
|
self assert: (document body innerHTML endsWith: '>sentinel<p></p></div>')
|
|
self assert: (document body innerHTML endsWith: '>sentinel<p></p></div>')
|
|
!
|
|
!
|
|
|
|
|
|
testInsertElementTwoLevel
|
|
testInsertElementTwoLevel
|
|
| d p s |
|
|
| d p s |
|
|
- d := Domite fromElement: fixtureDiv.
|
|
|
|
- p := Domite newElement: 'p'.
|
|
|
|
|
|
+ d := self testedClass fromElement: fixtureDiv.
|
|
|
|
+ p := self testedClass newElement: 'p'.
|
|
d << p.
|
|
d << p.
|
|
- s := Domite newElement: 'span'.
|
|
|
|
|
|
+ s := self testedClass newElement: 'span'.
|
|
p << s.
|
|
p << s.
|
|
s << 'dom-mite'.
|
|
s << 'dom-mite'.
|
|
self assert: (document body innerHTML endsWith: '>sentinel<p><span>dom-mite</span></p></div>')
|
|
self assert: (document body innerHTML endsWith: '>sentinel<p><span>dom-mite</span></p></div>')
|
|
@@ -83,49 +89,49 @@ testInsertElementTwoLevel
|
|
|
|
|
|
testInsertElementTwoLevelViaFragments
|
|
testInsertElementTwoLevelViaFragments
|
|
| d p s |
|
|
| d p s |
|
|
- d := Domite at: '#fixture'.
|
|
|
|
- p := Domite newElement: 'p'.
|
|
|
|
- d << (Domite newStream << p).
|
|
|
|
- s := Domite newElement: 'span'.
|
|
|
|
- p << (Domite newStream << s).
|
|
|
|
- s << (Domite newStream << 'dom-mite').
|
|
|
|
|
|
+ d := self testedClass at: '#fixture'.
|
|
|
|
+ p := self testedClass newElement: 'p'.
|
|
|
|
+ d << (self testedClass newStream << p).
|
|
|
|
+ s := self testedClass newElement: 'span'.
|
|
|
|
+ p << (self testedClass newStream << s).
|
|
|
|
+ s << (self testedClass newStream << 'dom-mite').
|
|
self assert: (document body innerHTML endsWith: '>sentinel<p><span>dom-mite</span></p></div>')
|
|
self assert: (document body innerHTML endsWith: '>sentinel<p><span>dom-mite</span></p></div>')
|
|
!
|
|
!
|
|
|
|
|
|
testInsertElementTwoLevelViaTwoLevelFragments
|
|
testInsertElementTwoLevelViaTwoLevelFragments
|
|
| d p s |
|
|
| d p s |
|
|
- d := Domite fromElement: fixtureDiv.
|
|
|
|
- p := Domite newElement: 'p'.
|
|
|
|
- d << (Domite newStream << (Domite newStream << p)).
|
|
|
|
- s := Domite newElement: 'span'.
|
|
|
|
- p << (Domite newStream << (Domite newStream << s)).
|
|
|
|
- s << (Domite newStream << (Domite newStream << 'dom-mite')).
|
|
|
|
|
|
+ d := self testedClass fromElement: fixtureDiv.
|
|
|
|
+ p := self testedClass newElement: 'p'.
|
|
|
|
+ d << (self testedClass newStream << (self testedClass newStream << p)).
|
|
|
|
+ s := self testedClass newElement: 'span'.
|
|
|
|
+ p << (self testedClass newStream << (self testedClass newStream << s)).
|
|
|
|
+ s << (self testedClass newStream << (self testedClass newStream << 'dom-mite')).
|
|
self assert: (document body innerHTML endsWith: '>sentinel<p><span>dom-mite</span></p></div>')
|
|
self assert: (document body innerHTML endsWith: '>sentinel<p><span>dom-mite</span></p></div>')
|
|
!
|
|
!
|
|
|
|
|
|
testInsertString
|
|
testInsertString
|
|
| d |
|
|
| d |
|
|
- d := Domite fromElement: fixtureDiv.
|
|
|
|
|
|
+ d := self testedClass fromElement: fixtureDiv.
|
|
d << 'a foo in a bar'.
|
|
d << 'a foo in a bar'.
|
|
self assert: (document body innerHTML endsWith: '>sentinela foo in a bar</div>')
|
|
self assert: (document body innerHTML endsWith: '>sentinela foo in a bar</div>')
|
|
!
|
|
!
|
|
|
|
|
|
testInsertStringInFragment
|
|
testInsertStringInFragment
|
|
| d |
|
|
| d |
|
|
- d := Domite at: '#fixture'.
|
|
|
|
- d << (Domite newStream << 'a foo in a bar').
|
|
|
|
|
|
+ d := self testedClass at: '#fixture'.
|
|
|
|
+ d << (self testedClass newStream << 'a foo in a bar').
|
|
self assert: (document body innerHTML endsWith: '>sentinela foo in a bar</div>')
|
|
self assert: (document body innerHTML endsWith: '>sentinela foo in a bar</div>')
|
|
!
|
|
!
|
|
|
|
|
|
testInsertTable
|
|
testInsertTable
|
|
| d tbl tr |
|
|
| d tbl tr |
|
|
- d := Domite at: 'html body div#fixture'.
|
|
|
|
- tbl := Domite newElement: 'table'.
|
|
|
|
|
|
+ d := self testedClass at: 'html body div#fixture'.
|
|
|
|
+ tbl := self testedClass newElement: 'table'.
|
|
|
|
|
|
- tr := Domite newElement: 'tr'.
|
|
|
|
- tr << ((Domite newElement: 'td') << 'A').
|
|
|
|
- tr << ((Domite newElement: 'td') << 'B').
|
|
|
|
- tr << ((Domite newElement: 'td') << 'C').
|
|
|
|
|
|
+ tr := self testedClass newElement: 'tr'.
|
|
|
|
+ tr << ((self testedClass newElement: 'td') << 'A').
|
|
|
|
+ tr << ((self testedClass newElement: 'td') << 'B').
|
|
|
|
+ tr << ((self testedClass newElement: 'td') << 'C').
|
|
|
|
|
|
tbl << tr.
|
|
tbl << tr.
|
|
|
|
|
|
@@ -142,10 +148,10 @@ testInsertTable
|
|
|
|
|
|
testMultipleInserts
|
|
testMultipleInserts
|
|
| d p s |
|
|
| d p s |
|
|
- d := Domite fromElement: fixtureDiv.
|
|
|
|
- p := Domite newElement: 'p'.
|
|
|
|
|
|
+ d := self testedClass fromElement: fixtureDiv.
|
|
|
|
+ p := self testedClass newElement: 'p'.
|
|
d << p.
|
|
d << p.
|
|
- s := Domite newElement: 'span'.
|
|
|
|
|
|
+ s := self testedClass newElement: 'span'.
|
|
d << s.
|
|
d << s.
|
|
d << 'dom-mite'.
|
|
d << 'dom-mite'.
|
|
self assert: (document body innerHTML endsWith: '>sentinel<p></p><span></span>dom-mite</div>')
|
|
self assert: (document body innerHTML endsWith: '>sentinel<p></p><span></span>dom-mite</div>')
|
|
@@ -153,10 +159,10 @@ testMultipleInserts
|
|
|
|
|
|
testMultipleInsertsWithClear
|
|
testMultipleInsertsWithClear
|
|
| d p s |
|
|
| d p s |
|
|
- d := Domite at: '#fixture'.
|
|
|
|
- p := Domite newElement: 'p'.
|
|
|
|
|
|
+ d := self testedClass at: '#fixture'.
|
|
|
|
+ p := self testedClass newElement: 'p'.
|
|
d << p.
|
|
d << p.
|
|
- s := Domite newElement: 'span'.
|
|
|
|
|
|
+ s := self testedClass newElement: 'span'.
|
|
d << s.
|
|
d << s.
|
|
d resetContents.
|
|
d resetContents.
|
|
d << 'dom-mite'.
|
|
d << 'dom-mite'.
|
|
@@ -167,10 +173,10 @@ testMultipleInsertsWithClear
|
|
|
|
|
|
testMultipleInsertsWithClearInBetween
|
|
testMultipleInsertsWithClearInBetween
|
|
| d p s |
|
|
| d p s |
|
|
- d := Domite fromElement: fixtureDiv.
|
|
|
|
- p := Domite newElement: 'p'.
|
|
|
|
|
|
+ d := self testedClass fromElement: fixtureDiv.
|
|
|
|
+ p := self testedClass newElement: 'p'.
|
|
d << p.
|
|
d << p.
|
|
- s := Domite newElement: 'span'.
|
|
|
|
|
|
+ s := self testedClass newElement: 'span'.
|
|
d << s.
|
|
d << s.
|
|
d resetContents.
|
|
d resetContents.
|
|
d << 'dom-mite'.
|
|
d << 'dom-mite'.
|