mirror of
https://github.com/zhigang1992/angular.js.git
synced 2026-04-24 03:55:49 +08:00
fix($browser.addJs): make addJs jQuery compatible
Change addJs implementation to avoid use of jQuery because of issues that affect angular-ie-compat.js. See inlined comment for more info.
This commit is contained in:
@@ -505,4 +505,28 @@ describe('browser', function(){
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('addJs', function() {
|
||||
|
||||
it('should append a script tag to body', function() {
|
||||
browser.addJs('http://localhost/bar.js');
|
||||
expect(scripts.length).toBe(1);
|
||||
expect(scripts[0].src).toBe('http://localhost/bar.js');
|
||||
expect(scripts[0].id).toBe('');
|
||||
});
|
||||
|
||||
|
||||
it('should append a script with an id to body', function() {
|
||||
browser.addJs('http://localhost/bar.js', 'foo-id');
|
||||
expect(scripts.length).toBe(1);
|
||||
expect(scripts[0].src).toBe('http://localhost/bar.js');
|
||||
expect(scripts[0].id).toBe('foo-id');
|
||||
});
|
||||
|
||||
|
||||
it('should return the appended script element', function() {
|
||||
var script = browser.addJs('http://localhost/bar.js');
|
||||
expect(script).toBe(scripts[0]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user