Smalltalk createPackage: 'Silk-Tests'! DOMiteTest subclass: #SilkInheritedTest instanceVariableNames: '' package: 'Silk-Tests'! !SilkInheritedTest methodsFor: 'fixture'! testedClass ^ Silk ! ! TestCase subclass: #SilkTest instanceVariableNames: 'fixtureDiv' package: 'Silk-Tests'! !SilkTest methodsFor: 'fixture'! assertBodyEndsWith: aString | sanitizedBody sanitizedAssertion | sanitizedBody := document body innerHTML replace: '\s*' with: ''. sanitizedAssertion := aString replace: '\s*' with: ''. self assert: sanitizedBody size >= sanitizedAssertion size. self assert: (sanitizedBody last: sanitizedAssertion size) equals: sanitizedAssertion ! setUp fixtureDiv := document createElement: 'div'. document body appendChild: fixtureDiv. fixtureDiv setAttribute: 'id' to: 'fixture'. fixtureDiv innerHTML: 'sentinel' ! tearDown | lastChild | lastChild := document body lastChild. self assert: lastChild equals: fixtureDiv. document body removeChild: lastChild ! ! !SilkTest methodsFor: 'testing'! testInsertTable | d tbl | d := 'html body div#fixture' asSilk. tbl := d TABLE. tbl TR TD: 'A'; TD: 'B'; TD: 'C'. tbl TR TD: 'D'; TD: 'E'; TD: 'F'. self assertBodyEndsWith: '>sentinel
| A | B | C |
| D | E | F |