Skip to content
Browse files

Test for #26

  • Loading branch information...
1 parent e2fe45a commit 36e464a6a46124614983c7206f161bb0d2350b57 @jrburke committed
View
1 tests/all.js
@@ -9,3 +9,4 @@ doh.registerUrl("text", "../plugins/text.html");
doh.registerUrl("coffee", "../plugins/coffee.html");
doh.registerUrl("shim", "../shim/shim.html");
doh.registerUrl("unorderedSeparate", "../unordered/separate.html");
+doh.registerUrl("emptyFactory", "../emptyFactory/emptyFactory.html");
View
29 tests/emptyFactory/emptyFactory.html
@@ -0,0 +1,29 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>almond: Empty Factory Test</title>
+ <script type="text/javascript" src="../doh/runner.js"></script>
+ <script type="text/javascript" src="../doh/_browserRunner.js"></script>
+ <script type="text/javascript" src="../../almond.js"></script>
+ <script type="text/javascript" src="emptyFactory.js"></script>
+ <script type="text/javascript">
+ doh.register(
+ 'emptyFactory',
+ [
+ function emptyFactory(t){
+ t.is('bread', bread.name);
+ t.is('yeast', bread.ingredient.name);
+ t.is('bin', bread.ingredient.bin.name);
+ t.is(undefined, bread.ingredient.water);
+ }
+ ]
+ );
+ doh.run();
+ </script>
+</head>
+<body>
+ <h1>almond: Empty Factory Test</h1>
+ <p>Module that has an empty factory function.</p>
+ <p>Check console for messages</p>
+</body>
+</html>
View
29 tests/emptyFactory/emptyFactory.js
@@ -0,0 +1,29 @@
+
+define("bread", ['yeast'], function (yeast) {
+ return {
+ name: 'bread',
+ ingredient: yeast
+ };
+});
+
+//Test undefined exports.
+define("water", function () {});
+
+define("bin", ['water'], function (water) {
+ return {
+ name: 'bin',
+ water: water
+ };
+});
+
+define("yeast", ['water', 'bin'], function(water, bin) {
+ return {
+ name: 'yeast',
+ water: water,
+ bin: bin
+ };
+});
+
+//Using sync require, but callback-require([], function(){}) is suggested.
+//This form only used in some particular CommonJS module bundling.
+var bread = require('bread');
View
4 tests/mapConfig/mapConfig-built.js
@@ -1,5 +1,5 @@
/**
- * almond 0.1.0zdev Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
+ * almond 0.1.0+ Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
@@ -244,7 +244,7 @@ var requirejs, require, define;
if (cjsModule && cjsModule.exports !== undef &&
cjsModule.exports !== defined[name]) {
defined[name] = cjsModule.exports;
- } else if (ret !== undef) {
+ } else if (ret !== undef || !usingExports) {
//Use the return value from the function.
defined[name] = ret;
}
View
4 tests/mapConfig/mapConfigStar-built.js
@@ -1,5 +1,5 @@
/**
- * almond 0.1.0zdev Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
+ * almond 0.1.0+ Copyright (c) 2011, The Dojo Foundation All Rights Reserved.
* Available via the MIT or new BSD license.
* see: http://github.com/jrburke/almond for details
*/
@@ -244,7 +244,7 @@ var requirejs, require, define;
if (cjsModule && cjsModule.exports !== undef &&
cjsModule.exports !== defined[name]) {
defined[name] = cjsModule.exports;
- } else if (ret !== undef) {
+ } else if (ret !== undef || !usingExports) {
//Use the return value from the function.
defined[name] = ret;
}
View
13 tests/unordered/separate.js
@@ -1,13 +1,22 @@
-define.unordered = true;
define("bread", function(require, exports, module) {
exports.name = 'bread';
exports.ingredient = require('yeast').name;
});
+//Test undefined exports.
+define("water", function () {});
+
+define("bin", function(require, exports, module) {
+ exports.name = "bin";
+ exports.water = require("water");
+});
+
define("yeast", function(require,exports,module){
module.exports = {
- name: 'yeast'
+ name: 'yeast',
+ water: require("water"),
+ bin: require("bin")
};
});

0 comments on commit 36e464a

Please sign in to comment.
Something went wrong with that request. Please try again.