selects done after the script tag fail #5

Closed
wants to merge 1 commit into
from
View
@@ -11,5 +11,11 @@
<script type="text/javascript">console.log(i<j)</script>
</div>
<div class="a">!!!</div>
+ <div class="c">boop</div>
+ <ul>
+ <li>test</li>
+ <li>this</li>
+ <li>out</li>
+ </ul>
</body>
</html>
View
@@ -3,7 +3,7 @@ var trumpet = require('../');
var fs = require('fs');
test('script', function (t) {
- t.plan(2);
+ t.plan(6);
var tr = trumpet();
fs.createReadStream(__dirname + '/script.html').pipe(tr);
@@ -12,7 +12,20 @@ test('script', function (t) {
t.equal(node.attributes.type, 'text/javascript');
node.html(function (src) {
t.equal(src, 'console.log(i<j)');
- t.end();
+ });
+ });
+
+ tr.select('title', function (node) {
+ t.equal(node.name, 'title');
+ node.html(function (html) {
+ t.equal(html, 'beep');
+ });
+ });
+
+ tr.select('.c', function (node) {
+ t.equal(node.name, 'div');
+ node.html(function (html) {
+ t.equal(html, 'boop');
});
});
});