Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ...
- describe("#last_selector", function() {
- it("produces a chain nth-child selectors to select the last closed tag at the time of the call", function() {
- var a_selector;
- var b_selector;
- var c_selector;
- with(builder) {
- div(function() {
- a_selector = div({'class': "a"}, function() {
- div();
- b_selector = div({'class': "b"});
- div(function() {
- c_selector = div({'class': "c"})
- });
- });
- })
- }
- var doc = $(builder.to_string());
- expect(a_selector).to(match, '> :nth-child(1)')
- expect(doc.find(a_selector).hasClass('a')).to(equal, true);
- expect(b_selector).to(match, '> :nth-child(1) > :nth-child(2)')
- expect(doc.find(b_selector).hasClass('b')).to(equal, true);
- expect(c_selector).to(match, '> :nth-child(1) > :nth-child(3) > :nth-child(1)')
- expect(doc.find(c_selector).hasClass('c')).to(equal, true);
- });
- ...
Add Comment
Please, Sign In to add comment