Created
December 2, 2011 01:32
-
-
Save davidascher/1421253 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test("david exploring view selectors", function(){ | |
var obj = $$({ | |
model: { | |
}, | |
view: { | |
format: '<div id="1" class="grandpa"><div id="2" class="other parent"><div id="3" class="child other andthen">test</div></div></div>', | |
}, | |
controller: {}, | |
myFunction: function(){} | |
}); // obj | |
$$.document.append(obj); // necessary for IE | |
validateObject( obj ); | |
equals( obj.view.$('#2').html(), '<div id="3" class="child other andthen">test</div>', 'search by id'); | |
equals( obj.view.$('.parent').html(), '<div id="3" class="child other andthen">test</div>', 'search by id'); | |
equals( obj.view.$('#3').html(), 'test', 'search by ID with no subchild'); | |
equals( obj.view.$('.child').html(), 'test', 'search by class with no subchild'); | |
equals( obj.view.$().html(), '<div id="2" class="other parent"><div id="3" class="child other andthen">test</div></div>', 'return all children'); | |
// is there a way to get the full outer node (starting w/ id=1)? | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment