-
Notifications
You must be signed in to change notification settings - Fork 216
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
stop failing if dev includes 'curl' as the new apiName or 'define' as…
… the new defineName. also added some more tests to test that configuring apiName or defineName after loading curl works as expected.
- Loading branch information
John Hann
committed
Jul 16, 2012
1 parent
497779a
commit 9964b1e
Showing
7 changed files
with
155 additions
and
58 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>apiName/apiContext curl test file</title> | ||
|
||
<script> | ||
|
||
// simulate existing curl | ||
function existingCurl () {} | ||
curl = existingCurl; | ||
|
||
</script> | ||
<script src="../src/curl.js" type="text/javascript"></script> | ||
|
||
<script type="text/javascript"> | ||
|
||
var foo = {}, | ||
cfg = { | ||
apiName: 'bar', | ||
apiContext: foo, | ||
paths: { | ||
curl: '../src/curl/' | ||
} | ||
}; | ||
curl( | ||
cfg, | ||
[ 'stuff/three', 'domReady!' ] | ||
).then( | ||
function (three) { | ||
var restoredPrev, createdNew; | ||
restoredPrev = curl == existingCurl ? 'SUCCESS' : 'FAILED'; | ||
createdNew = foo && foo.bar && typeof foo.bar == 'function' && foo.bar.version ? 'SUCCESS' : 'FAILED'; | ||
document.body.appendChild(document.createElement('div')).innerHTML = restoredPrev + ' previous global curl restored'; | ||
document.body.appendChild(document.createElement('div')).innerHTML = createdNew + ' new custom curl created'; | ||
} | ||
); | ||
|
||
</script> | ||
|
||
</head> | ||
<body> | ||
</body> | ||
</html> |
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<!DOCTYPE HTML> | ||
<html> | ||
<head> | ||
<title>apiName/apiContext curl test file</title> | ||
|
||
<script> | ||
|
||
// simulate existing define | ||
function existingDefine () {} | ||
define = existingDefine; | ||
|
||
</script> | ||
<script src="../src/curl.js" type="text/javascript"></script> | ||
|
||
</head> | ||
|
||
<body> | ||
</body> | ||
|
||
<script type="text/javascript"> | ||
|
||
var foo = {}, | ||
cfg = { | ||
defineName: 'bar', | ||
defineContext: foo, | ||
paths: { | ||
curl: '../src/curl/' | ||
} | ||
}; | ||
curl( | ||
cfg, | ||
[ 'support/foo-bar-define/simple' ] | ||
).then( | ||
function (three) { | ||
var restoredPrev, createdNew; | ||
restoredPrev = define == existingDefine ? 'SUCCESS' : 'FAILED'; | ||
createdNew = foo && foo.bar && foo.bar.amd ? 'SUCCESS' : 'FAILED'; | ||
document.body.appendChild(document.createElement('div')).innerHTML = restoredPrev + ' previous global define() restored'; | ||
document.body.appendChild(document.createElement('div')).innerHTML = createdNew + ' new custom define() created'; | ||
} | ||
); | ||
|
||
</script> | ||
|
||
</html> |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
foo.bar([], function () { | ||
|
||
return 1; | ||
|
||
}); |