Skip to content

Commit

Permalink
add tests for relative plugins (not just relative plugin resources)
Browse files Browse the repository at this point in the history
  • Loading branch information
unscriptable committed Sep 18, 2012
1 parent 9cf8ad2 commit b0dce0a
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
40 changes: 19 additions & 21 deletions test/relative-plugins.html
@@ -1,25 +1,8 @@
<!DOCTYPE HTML>
<html>
<head>
<title>main curl test file</title>

<script>

// mock console for IE
if (!window.console) console = {};
if (!('log' in console)) {
console._msg = [];
console.log = function (msg) {
var _msg = this._msg;
_msg.push([].join.call(arguments, ' '));
clearTimeout(this._timeout);
this._timeout = setTimeout(function () {
alert(_msg.join('\n'));
}, 100);
};
}
<title>relative plugins and resources</title>

</script>
<script src="../src/curl.js" type="text/javascript"></script>
<!--<script src="../dist/curl-kitchen-sink/curl.js" type="text/javascript"></script>-->

Expand All @@ -33,15 +16,30 @@
},
[
'aView/controller',
'support/requires-fake',
'domReady!'
]
).then(
function (aView) {
document.body.appendChild(document.createTextNode('SUCCESS: all files loaded'));
aView.render(document.getElementById('test'));
function (aView, rf) {
var testEl;
testEl = document.getElementById('test');
write('SUCCESS: should load all files');
write((rf ? 'SUCCESS' : 'FAILED') + ': should load a module that requires a relative plugin');
aView.render(testEl);
write((testEl.innerHTML ? 'SUCCESS' : 'FAILED') + ': should render a view that requires relative plugin resources');
},
function (ex) {
write('FAILED: should load all files - ' + ex.message);
}
);

function write (msg) {
curl(['domReady!'], function () {
document.body.appendChild(document.createElement('div')).innerHTML = msg;
})
}


</script>

</head>
Expand Down
5 changes: 5 additions & 0 deletions test/support/requires-fake.js
@@ -0,0 +1,5 @@
define(['./fake!foo'], function (foo) {

return {};

});

0 comments on commit b0dce0a

Please sign in to comment.