Permalink
Browse files

Add tests for pull #2 96baffb and 0c7e885

  • Loading branch information...
1 parent 96baffb commit 2ab31b90730a71fd8fb7888a66dec85bcd32d60c Harry Fuecks committed Nov 9, 2010
Showing with 18 additions and 0 deletions.
  1. +3 −0 testdata/test.html
  2. +15 −0 tests/soupselect.js
View
@@ -17,6 +17,9 @@ <h2 id="header2">An H2</h2>
<a href="http://bob.example.org/" rel="friend met" id="bob">Bob</a>
<h2 id="header3">Another H2</h2>
<a id="me" href="http://simonwillison.net/" rel="me">me</a>
+ Test <span id="xx">foo1<span id="yy">bar1</span>
+ <span id="yx">bar2</span></span>
+ OK <span id="xy">foo2 <strong>seriously</strong></span>
</div>
<p lang="en" id="lang-en">English</p>
<p lang="en-gb" id="lang-en-gb">English UK</p>
View
@@ -71,6 +71,13 @@ exports.basicSelectors = {
test.done();
},
+ tags_in_tags: function(test) {
+ runTest(test, function(dom) {
+ assertSelects(test, dom, 'span span', ['yx', 'yy']);
+ });
+ test.done();
+ },
+
tag_in_tag_many: function(test) {
['html div', 'html body div', 'body div'].forEach(function(selector) {
runTest(test, function(dom) {
@@ -124,6 +131,14 @@ exports.basicSelectors = {
test.done();
},
+ multi_class: function(test) {
+ runTest(test, function(dom) {
+ var els = select(dom, 'p.class1.class2.class3');
+ test.equal(els.length, 1);
+ });
+ test.done();
+ },
+
one_id: function(test) {
runTest(test, function(dom) {
['div#inner', '#inner', 'div div#inner'].forEach(function(selector) {

0 comments on commit 2ab31b9

Please sign in to comment.