mirror of
https://github.com/Hopiu/angular.js.git
synced 2026-03-17 07:40:22 +00:00
add specs for jqLite wrapping/node creation
tests cover: - creating comment tags from a string - creating script tag from a string - wrapping document fragment
This commit is contained in:
parent
a2c4271128
commit
2d9dd1c172
1 changed files with 19 additions and 0 deletions
|
|
@ -41,12 +41,31 @@ describe('jqLite', function(){
|
|||
expect(selected.length).toEqual(1);
|
||||
expect(selected[0]).toEqual(text);
|
||||
});
|
||||
|
||||
it('should allow construction with html', function(){
|
||||
var nodes = jqLite('<div>1</div><span>2</span>');
|
||||
expect(nodes.length).toEqual(2);
|
||||
expect(nodes[0].innerHTML).toEqual('1');
|
||||
expect(nodes[1].innerHTML).toEqual('2');
|
||||
});
|
||||
|
||||
it('should allow creation of comment tags', function() {
|
||||
var nodes = jqLite('<!-- foo -->');
|
||||
expect(nodes.length).toBe(1);
|
||||
expect(nodes[0].nodeType).toBe(8);
|
||||
});
|
||||
|
||||
it('should allow creation of script tags', function() {
|
||||
var nodes = jqLite('<script></script>');
|
||||
expect(nodes.length).toBe(1);
|
||||
expect(nodes[0].tagName.toUpperCase()).toBe('SCRIPT');
|
||||
});
|
||||
|
||||
it('should wrap document fragment', function() {
|
||||
var fragment = jqLite(document.createDocumentFragment());
|
||||
expect(fragment.length).toBe(1);
|
||||
expect(fragment[0].nodeType).toBe(11);
|
||||
});
|
||||
});
|
||||
|
||||
describe('scope', function() {
|
||||
|
|
|
|||
Loading…
Reference in a new issue