web-apps/vendor/requirejs/tests/packages/config/config.html
Maxim Kadushkin 741b10515d webapps added
2016-03-10 21:48:53 -03:00

61 lines
1.7 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<title>require.js: Packages Config Test</title>
<script type="text/javascript" src="../../../require.js"></script>
<script type="text/javascript" src="../../doh/runner.js"></script>
<script type="text/javascript" src="../../doh/_browserRunner.js"></script>
<script>
define('sparkle/main', ['module'], function (module) {
return {
size: module.config().size
};
});
define('sparkle', ['sparkle/main'], function (main) {
return main;
})
require.config({
config: {
'sparkle/main': {
size: 'large'
},
'pixie/index': {
apiKey: 'maple'
}
},
packages: [
'sparkle',
{
name: 'pixie',
main: './index.js'
}
]
});
require(['sparkle', 'pixie'], function (sparkle, pixie) {
doh.register(
"packagesConfig",
[
function packagesConfig(t){
t.is('large', sparkle.size);
t.is('maple', pixie.apiKey);
}
]
);
doh.run();
});
</script>
</head>
<body>
<h1>require.js: Packages Config Test</h1>
<p>Make sure module config for a package is only targeted to the main
module, but is given to the module name.
<a href="https://github.com/jrburke/r.js/issues/435">More info</a></p>
<p>Check console for messages</p>
</body>
</html>