-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Fix ngjq #11182
Fix ngjq #11182
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html ng-app="test" ng-jq> | ||
<body> | ||
{{jqueryVersion}} | ||
|
||
<script src="../../../../bower_components/jquery/dist/jquery.js"></script> | ||
<script src="angular.js"></script> | ||
<script type="text/javascript" src="script.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
angular.module('test', []) | ||
.run(function($rootScope) { | ||
$rootScope.jqueryVersion = window.angular.element().jquery || 'jqLite'; | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<!DOCTYPE html> | ||
<html ng-app="test" ng-jq="jQuery_2_1_0"> | ||
<body> | ||
{{jqueryVersion}} | ||
|
||
<script src="../../../../bower_components/jquery/dist/jquery.js"></script> | ||
<script src="http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js"></script> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should switch the order of these two jquery script lines because the last loaded jquery wins. If we dropped the |
||
<script> | ||
var jQuery_2_1_0 = jQuery.noConflict(); | ||
</script> | ||
<script src="angular.js"></script> | ||
<script type="text/javascript" src="script.js"></script> | ||
</body> | ||
</html> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
'use strict'; | ||
|
||
angular.module('test', []) | ||
.run(function($rootScope) { | ||
$rootScope.jqueryVersion = window.angular.element().jquery || 'jqLite'; | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
describe('Customizing the jqlite / jquery version', function() { | ||
|
||
it('should be able to force jqlite', function() { | ||
loadFixture("ngJq").andWaitForAngular(); | ||
expect(element(by.binding('jqueryVersion')).getText()).toBe('jqLite'); | ||
}); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It might be a good idea to also test that E.g. imagine 'jquery.js' isn't properly loaded in the future for whatever reason (e.g. directory is moved). It would be good to catch this in the test (and fix). |
||
|
||
it('should be able to use a specific version jQuery', function() { | ||
loadFixture("ngJqJquery").andWaitForAngular(); | ||
expect(element(by.binding('jqueryVersion')).getText()).toBe('2.1.0'); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,10 @@ function testExists(testname) { | |
} | ||
|
||
function rewriteTestFile(testname, testfile) { | ||
if (testfile.indexOf('http') === 0) { | ||
return testfile; | ||
} | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks good There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Although this would match... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, that is much better. Honestly I just wanted to get the tests to work. ;) |
||
var i = 0; | ||
while (testfile[i] === '/') ++i; | ||
testfile = testfile.slice(i); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line breaks jshint rules. It should either be made into the functional form, or perhaps easier just remove it.