Guest User

Untitled

a guest
Apr 26th, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. ...
  2.  
  3. describe("#last_selector", function() {
  4. it("produces a chain nth-child selectors to select the last closed tag at the time of the call", function() {
  5. var a_selector;
  6. var b_selector;
  7. var c_selector;
  8.  
  9. with(builder) {
  10. div(function() {
  11. a_selector = div({'class': "a"}, function() {
  12. div();
  13. b_selector = div({'class': "b"});
  14. div(function() {
  15. c_selector = div({'class': "c"})
  16. });
  17. });
  18. })
  19. }
  20.  
  21. var doc = $(builder.to_string());
  22. expect(a_selector).to(match, '> :nth-child(1)')
  23. expect(doc.find(a_selector).hasClass('a')).to(equal, true);
  24.  
  25. expect(b_selector).to(match, '> :nth-child(1) > :nth-child(2)')
  26. expect(doc.find(b_selector).hasClass('b')).to(equal, true);
  27.  
  28. expect(c_selector).to(match, '> :nth-child(1) > :nth-child(3) > :nth-child(1)')
  29. expect(doc.find(c_selector).hasClass('c')).to(equal, true);
  30. });
  31. ...
Add Comment
Please, Sign In to add comment